Torch arrows are almost good

This commit is contained in:
Andrea Plati 2015-03-09 22:31:30 +01:00
parent 7afbceb782
commit bdc555c290

View File

@ -46,7 +46,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if self.timer>0.2 then if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 0.5)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_torch_entity" and obj:get_luaentity().name ~= "__builtin:item" then if obj:get_luaentity().name ~= "throwing:arrow_torch_entity" and obj:get_luaentity().name ~= "__builtin:item" then
@ -64,7 +64,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if self.lastpos.x~=nil then if self.lastpos.x~=nil then
if node.name ~= "air" then if node.name ~= "air" then
self.object:remove() self.object:remove()
minetest.place_node(self.lastpos, {name="default:torch"}) local dir={x=pos.x-self.lastpos.x, y=pos.y-self.lastpos.y, z=pos.z-self.lastpos.z}
local wall=minetest.dir_to_wallmounted(dir)
minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
end end
end end
self.lastpos={x=pos.x, y=pos.y, z=pos.z} self.lastpos={x=pos.x, y=pos.y, z=pos.z}