Spear drops when hits the target

This commit is contained in:
Kotolegokot 2012-11-21 23:18:00 +06:00
parent 8b567f927e
commit dfcc66bb57
3 changed files with 4 additions and 3 deletions

View File

@ -31,7 +31,7 @@ function icicles.make_stalactite(pos, length)
end end
function icicles.make_stalagmite(pos, length) function icicles.make_stalagmite(pos, length)
for i = length,1,-1 do for i = 1,length do
if minetest.env:get_node({x=pos.x,y=pos.y+i-1,z=pos.z}).name == "air" then if minetest.env:get_node({x=pos.x,y=pos.y+i-1,z=pos.z}).name == "air" then
minetest.env:set_node({x=pos.x,y=pos.y+i-1,z=pos.z}, {name = "icicles:icicle_"..5-i}) minetest.env:set_node({x=pos.x,y=pos.y+i-1,z=pos.z}, {name = "icicles:icicle_"..5-i})
else return end else return end

View File

@ -74,7 +74,7 @@ instruments.list = {"pick", "axe", "shovel", "hammer", "sword", "spear", "chisel
instruments.spear.entity = { instruments.spear.entity = {
physical = false, physical = false,
timer=0, timer=0,
textures = {"spear_back.png"}, textures = {"instruments_spear_back.png"},
lastpos={}, lastpos={},
collisionbox = {0,0,0,0,0,0}, collisionbox = {0,0,0,0,0,0},
material = "stone", material = "stone",
@ -93,6 +93,7 @@ instruments.spear.entity.on_step = function(self, dtime)
if obj:get_hp()<=0 then if obj:get_hp()<=0 then
obj:remove() obj:remove()
end end
minetest.env:add_item(self.lastpos, 'instruments:spear_'..self.object:get_luaentity().material)
self.object:remove() self.object:remove()
end end
end end

View File

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 261 B