diff options
Diffstat (limited to 'item_drop')
| -rw-r--r-- | item_drop/README.txt | 42 | ||||
| -rw-r--r-- | item_drop/depends.txt | 1 | ||||
| -rw-r--r-- | item_drop/init.lua | 106 | ||||
| -rw-r--r-- | item_drop/item_entity.lua | 192 | ||||
| -rw-r--r-- | item_drop/item_entity_old.lua | 126 | ||||
| -rw-r--r-- | item_drop/sounds/item_drop_pickup.1.ogg | bin | 7584 -> 0 bytes | |||
| -rw-r--r-- | item_drop/sounds/item_drop_pickup.2.ogg | bin | 7635 -> 0 bytes | |||
| -rw-r--r-- | item_drop/sounds/item_drop_pickup.3.ogg | bin | 7146 -> 0 bytes | |||
| -rw-r--r-- | item_drop/sounds/item_drop_pickup.4.ogg | bin | 7250 -> 0 bytes | 
9 files changed, 0 insertions, 467 deletions
diff --git a/item_drop/README.txt b/item_drop/README.txt deleted file mode 100644 index fe43054..0000000 --- a/item_drop/README.txt +++ /dev/null @@ -1,42 +0,0 @@ -===ITEM_DROP MOD for MINETEST-C55=== -by PilzAdam - -Introduction: -This mod adds Minecraft like drop/pick up of items to Minetest. - -How to install: -Unzip the archive an place it in minetest-base-directory/mods/minetest/ -if you have a windows client or a linux run-in-place client. If you have -a linux system-wide instalation place it in ~/.minetest/mods/minetest/. -If you want to install this mod only in one world create the folder -worldmods/ in your worlddirectory. -For further information or help see: -http://wiki.minetest.com/wiki/Installing_Mods - -How to use the mod: -Just install it an everything works. - -For developers: -You dont have to use get_drops() anymore because of changes in the -builtin files of minetest. - -License: -Sourcecode: WTFPL (see below) -Sound: WTFPL (see below) - -See also: -http://minetest.net/ - -         DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE -                    Version 2, December 2004 - - Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - -            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE -   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -  0. You just DO WHAT THE FUCK YOU WANT TO.  diff --git a/item_drop/depends.txt b/item_drop/depends.txt deleted file mode 100644 index b88d3ff..0000000 --- a/item_drop/depends.txt +++ /dev/null @@ -1 +0,0 @@ -technic diff --git a/item_drop/init.lua b/item_drop/init.lua deleted file mode 100644 index aa7ab11..0000000 --- a/item_drop/init.lua +++ /dev/null @@ -1,106 +0,0 @@ -dofile(minetest.get_modpath("item_drop").."/item_entity.lua") -time_pick = 3 - -if technic.config:get_bool("enable_item_pickup") then -	minetest.register_globalstep(function(dtime) -		for _,player in ipairs(minetest.get_connected_players()) do -			if player and player:get_hp() > 0 then -				local pos = player:getpos() -				pos.y = pos.y + 0.5 -				local inv = player:get_inventory() -				for _, object in ipairs(minetest.get_objects_inside_radius(pos, 2)) do -					if not object:is_player() and object:get_luaentity() then -						local obj = object:get_luaentity() -						if obj.name == "__builtin:item" then -							if inv and inv:room_for_item("main", ItemStack(obj.itemstring)) then -								if obj.timer > time_pick then -									inv:add_item("main", ItemStack(obj.itemstring)) -									if obj.itemstring ~= "" then -										minetest.sound_play("item_drop_pickup", -											{pos = pos, gain = 1.0, max_hear_distance = 10})  -									end -									if object:get_luaentity() then -										object:get_luaentity().itemstring = "" -										object:remove() -									end -								end -							end -						end -					end -				end -			end -		end -	end) -end - -if technic.config:get_bool("enable_item_drop") then -	function minetest.handle_node_drops(pos, drops, digger) -		for _,item in ipairs(drops) do -			local count, name -			if type(item) == "string" then -				count = 1 -				name = item -			else -				count = item:get_count() -				name = item:get_name() -			end -			for i=1,count do -				local obj = minetest.env:add_item(pos, name) -				if obj ~= nil then -					obj:get_luaentity().collect = true -					local x = math.random(1, 5) -					if math.random(1,2) == 1 then -						x = -x -					end -					local z = math.random(1, 5) -					if math.random(1,2) == 1 then -						z = -z -					end -					obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z}) -					obj:get_luaentity().timer = time_pick -					-- FIXME this doesnt work for deactiveted objects -					if minetest.setting_get("remove_items") and tonumber(minetest.setting_get("remove_items")) then -						minetest.after(tonumber(minetest.setting_get("remove_items")), function(obj) -							obj:remove() -						end, obj) -					end -				end -			end -		end -	end -end - ---[[ -minetest.register_on_dieplayer(function(name, pos) -	local inv = name:get_inventory() -	local pos = name:getpos() -	for i = 1, inv:get_size("main"), 1 do -		srcstack = inv:get_stack("main", i) -		if srcstack:to_string() ~= "" then -			pos.y = pos.y + 3 -			local obj = minetest.env:add_item(pos, srcstack:to_string()) -			local x = math.random(-5, 5) -			if x >= -2 and x <=0 then -				local x = x - 3 -			end -			if x > 0 and x <= 2 then -				local x = x + 3 -			end -			local y = math.random(3, 5) -			local z = math.random(-5, 5) -			if z >= -2 and z <= 0 then -				local z = z - 3 -			end -			if z > 0 and z <= 2 then -				local z = z + 3 -			end -			inv:set_stack("main", i, "") -			obj:setvelocity({x=x, y=y, z=z}) -		end -		if i == 32 then -			break -		end -	end -end) -]]-- -print("DROPS LOADED!") diff --git a/item_drop/item_entity.lua b/item_drop/item_entity.lua deleted file mode 100644 index fb0527f..0000000 --- a/item_drop/item_entity.lua +++ /dev/null @@ -1,192 +0,0 @@ --- Minetest: builtin/item_entity.lua - -function minetest.spawn_item(pos, item) -	-- Take item in any format -	local stack = ItemStack(item) -	local obj = minetest.env:add_entity(pos, "__builtin:item") -	obj:get_luaentity():set_item(stack:to_string()) -	return obj -end - -minetest.register_entity(":__builtin:item", { -	initial_properties = { -		hp_max = 1, -		physical = true, -		collisionbox = {-0.17,-0.17,-0.17, 0.17,0.17,0.17}, -		visual = "sprite", -		visual_size = {x=0.5, y=0.5}, -		textures = {""}, -		spritediv = {x=1, y=1}, -		initial_sprite_basepos = {x=0, y=0}, -		is_visible = false, -	}, -	 -	itemstring = '', -	physical_state = true, -	timer = 0, - -	set_item = function(self, itemstring) -		self.itemstring = itemstring -		local stack = ItemStack(itemstring) -		local itemtable = stack:to_table() -		local itemname = nil -		if itemtable then -			itemname = stack:to_table().name -		end -		local item_texture = nil -		local item_type = "" -		if minetest.registered_items[itemname] then -			item_texture = minetest.registered_items[itemname].inventory_image -			item_type = minetest.registered_items[itemname].type -		end -		prop = { -			is_visible = true, -			visual = "sprite", -			textures = {"unknown_item.png"} -		} -		if item_texture and item_texture ~= "" then -			prop.visual = "sprite" -			prop.textures = {item_texture} -			prop.visual_size = {x=0.50, y=0.50} -		else -			prop.visual = "wielditem" -			prop.textures = {itemname} -			prop.visual_size = {x=0.20, y=0.20} -			prop.automatic_rotate = math.pi * 0.25 -		end -		self.object:set_properties(prop) -	end, - -	get_staticdata = function(self) -		--return self.itemstring -		return minetest.serialize({ -			itemstring = self.itemstring, -			always_collect = self.always_collect, -			timer = self.timer, -		}) -	end, - -	on_activate = function(self, staticdata, dtime_s) -		if string.sub(staticdata, 1, string.len("return")) == "return" then -			local data = minetest.deserialize(staticdata) -			if data and type(data) == "table" then -				self.itemstring = data.itemstring -				self.always_collect = data.always_collect -				self.timer = data.timer -				if not self.timer then -					self.timer = 0 -				end -				self.timer = self.timer+dtime_s -			end -		else -			self.itemstring = staticdata -		end -		self.object:set_armor_groups({immortal=1}) -		self.object:setvelocity({x=0, y=2, z=0}) -		self.object:setacceleration({x=0, y=-10, z=0}) -		self:set_item(self.itemstring) -	end, -	 -	on_step = function(self, dtime) -		local time = tonumber(minetest.setting_get("remove_items")) -		if not time then -			time = 300 -		end -		if not self.timer then -			self.timer = 0 -		end -		self.timer = self.timer + dtime -		if time ~= 0 and (self.timer > time) then -			self.object:remove() -		end -		 -		local p = self.object:getpos() -		 -		local name = minetest.env:get_node(p).name -		if name == "default:lava_flowing" or name == "default:lava_source" then -			minetest.sound_play("builtin_item_lava", {pos=self.object:getpos(),gain = 1.0, max_hear_distance = 10}) -			self.object:remove() -			return -		end -		 -		if minetest.registered_nodes[name] and minetest.registered_nodes[name].liquidtype == "flowing" then -			get_flowing_dir = function(self) -				local pos = self.object:getpos() -				local param2 = minetest.env:get_node(pos).param2 -				for i,d in ipairs({-1, 1, -1, 1}) do -					if i<3 then -						pos.x = pos.x+d -					else -						pos.z = pos.z+d -					end -					 -					local name = minetest.env:get_node(pos).name -					local par2 = minetest.env:get_node(pos).param2 -					if name == "default:water_flowing" and par2 < param2 then -						return pos -					end -					 -					if i<3 then -						pos.x = pos.x-d -					else -						pos.z = pos.z-d -					end -				end -			end -			 -			local vec = get_flowing_dir(self) -			if vec then -				local v = self.object:getvelocity() -				if vec and vec.x-p.x > 0 then -					self.object:setvelocity({x=0.5,y=v.y,z=0}) -				elseif vec and vec.x-p.x < 0 then -					self.object:setvelocity({x=-0.5,y=v.y,z=0}) -				elseif vec and vec.z-p.z > 0 then -					self.object:setvelocity({x=0,y=v.y,z=0.5}) -				elseif vec and vec.z-p.z < 0 then -					self.object:setvelocity({x=0,y=v.y,z=-0.5}) -				end -				self.object:setacceleration({x=0, y=-10, z=0}) -				self.physical_state = true -				self.object:set_properties({ -					physical = true -				}) -				return -			end -		end -		 -		p.y = p.y - 0.3 -		local nn = minetest.env:get_node(p).name -		-- If node is not registered or node is walkably solid -		if not minetest.registered_nodes[nn] or minetest.registered_nodes[nn].walkable then -			if self.physical_state then -				self.object:setvelocity({x=0,y=0,z=0}) -				self.object:setacceleration({x=0, y=0, z=0}) -				self.physical_state = false -				self.object:set_properties({ -					physical = false -				}) -			end -		else -			if not self.physical_state then -				self.object:setvelocity({x=0,y=0,z=0}) -				self.object:setacceleration({x=0, y=-10, z=0}) -				self.physical_state = true -				self.object:set_properties({ -					physical = true -				}) -			end -		end -	end, - -	on_punch = function(self, hitter) -		if self.itemstring ~= '' then -			hitter:get_inventory():add_item("main", self.itemstring) -		end -		self.object:remove() -	end, -}) - -if minetest.setting_get("log_mods") then -	minetest.log("action", "builtin_item loaded") -end diff --git a/item_drop/item_entity_old.lua b/item_drop/item_entity_old.lua deleted file mode 100644 index 6e479a1..0000000 --- a/item_drop/item_entity_old.lua +++ /dev/null @@ -1,126 +0,0 @@ --- Minetest: builtin/item_entity.lua - -function minetest.spawn_item(pos, item) -	-- Take item in any format -	local stack = ItemStack(item) -	local obj = minetest.env:add_entity(pos, "__builtin:item") -	obj:get_luaentity():set_item(stack:to_string()) -	return obj -end - -minetest.register_entity(":__builtin:item", { -	initial_properties = { -		hp_max = 1, -		physical = true, -		collisionbox = {-0.17,-0.17,-0.17, 0.17,0.17,0.17}, -		visual = "sprite", -		visual_size = {x=0.5, y=0.5}, -		textures = {""}, -		spritediv = {x=1, y=1}, -		initial_sprite_basepos = {x=0, y=0}, -		is_visible = false, -	}, -	 -	itemstring = '', -	physical_state = true, -	timer = 0, -	 -	set_item = function(self, itemstring) -		self.itemstring = itemstring -		local stack = ItemStack(itemstring) -		local itemtable = stack:to_table() -		local itemname = nil -		if itemtable then -			itemname = stack:to_table().name -		end -		local item_texture = nil -		local item_type = "" -		if minetest.registered_items[itemname] then -			item_texture = minetest.registered_items[itemname].inventory_image -			item_type = minetest.registered_items[itemname].type -		end -		prop = { -			is_visible = true, -			visual = "sprite", -			textures = {"unknown_item.png"} -		} -		if item_texture and item_texture ~= "" then -			prop.visual = "sprite" -			prop.textures = {item_texture} -			prop.visual_size = {x=0.50, y=0.50} -		else -			prop.visual = "wielditem" -			prop.textures = {itemname} -			prop.visual_size = {x=0.20, y=0.20} -			prop.automatic_rotate = math.pi * 0.25 -		end -		self.object:set_properties(prop) -	end, - -	get_staticdata = function(self) -		--return self.itemstring -		return minetest.serialize({ -			itemstring = self.itemstring, -			always_collect = self.always_collect, -		}) -	end, - -	on_activate = function(self, staticdata) -		if string.sub(staticdata, 1, string.len("return")) == "return" then -			local data = minetest.deserialize(staticdata) -			if data and type(data) == "table" then -				self.itemstring = data.itemstring -				self.always_collect = data.always_collect -			end -		else -			self.itemstring = staticdata -		end -		self.object:set_armor_groups({immortal=1}) -		self.object:setvelocity({x=0, y=2, z=0}) -		self.object:setacceleration({x=0, y=-10, z=0}) -		self:set_item(self.itemstring) -	end, - -	on_step = function(self, dtime) -		self.timer = self.timer + dtime -		if (self.timer > 300) then -			self.object:remove() -		end -		local p = self.object:getpos() -		p.y = p.y - 0.3 -		local nn = minetest.env:get_node(p).name -		-- If node is not registered or node is walkably solid and resting on nodebox -		local v = self.object:getvelocity() -		if not minetest.registered_nodes[nn] or minetest.registered_nodes[nn].walkable and v.y == 0 then -			if self.physical_state then -				self.object:setvelocity({x=0,y=0,z=0}) -				self.object:setacceleration({x=0, y=0, z=0}) -				self.physical_state = false -				self.object:set_properties({ -					physical = false -				}) -			end -		else -			if not self.physical_state then -				self.object:setvelocity({x=0,y=0,z=0}) -				self.object:setacceleration({x=0, y=-10, z=0}) -				self.physical_state = true -				self.object:set_properties({ -					physical = true -				}) -			end -		end -	end, - -	on_punch = function(self, hitter) -		if self.itemstring ~= '' then -			local left = hitter:get_inventory():add_item("main", self.itemstring) -			if not left:is_empty() then -				self.itemstring = left:to_string() -				return -			end -		end -		self.object:remove() -	end, -}) -print("ITEM ENTITY LOADED") diff --git a/item_drop/sounds/item_drop_pickup.1.ogg b/item_drop/sounds/item_drop_pickup.1.ogg Binary files differdeleted file mode 100644 index f5ea6b9..0000000 --- a/item_drop/sounds/item_drop_pickup.1.ogg +++ /dev/null diff --git a/item_drop/sounds/item_drop_pickup.2.ogg b/item_drop/sounds/item_drop_pickup.2.ogg Binary files differdeleted file mode 100644 index 0ed4869..0000000 --- a/item_drop/sounds/item_drop_pickup.2.ogg +++ /dev/null diff --git a/item_drop/sounds/item_drop_pickup.3.ogg b/item_drop/sounds/item_drop_pickup.3.ogg Binary files differdeleted file mode 100644 index 3e2d1e0..0000000 --- a/item_drop/sounds/item_drop_pickup.3.ogg +++ /dev/null diff --git a/item_drop/sounds/item_drop_pickup.4.ogg b/item_drop/sounds/item_drop_pickup.4.ogg Binary files differdeleted file mode 100644 index 13430e2..0000000 --- a/item_drop/sounds/item_drop_pickup.4.ogg +++ /dev/null  | 
