mirror of
https://gitlab.com/echoes91/throwing.git
synced 2025-06-30 15:20:21 +02:00
1.0rc2, fixed nil value comparison
This commit is contained in:
@ -57,8 +57,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
local toughness = 0.9
|
||||
if self.breaks < toughness then
|
||||
minetest.add_item(self.lastpos, 'throwing:arrow_diamond')
|
||||
if math.random() < toughness then
|
||||
minetest.add_item(self.lastpos, 'throwing:arrow_torch')
|
||||
else
|
||||
minetest.add_item(self.lastpos, 'default:stick')
|
||||
end
|
||||
@ -74,46 +74,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
local dir=vector.direction(self.lastpos, pos)
|
||||
local wall=minetest.dir_to_wallmounted(dir)
|
||||
minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
|
||||
--~ if wall == 0 then Check doesn't help :(
|
||||
--~ local check_pos={self.lastpos.x, self.lastpos.y+0.5, self.lastpos.z}
|
||||
--~ if minetest.get_node(check_pos).name ~= "air" then
|
||||
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
|
||||
--~ self.object:remove()
|
||||
--~ end
|
||||
--~ elseif wall == 1 then
|
||||
--~ local check_pos={self.lastpos.x, self.lastpos.y-0.5, self.lastpos.z}
|
||||
--~ if minetest.get_node(check_pos).name ~= "air" then
|
||||
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
|
||||
--~ self.object:remove()
|
||||
--~ end
|
||||
--~ elseif wall == 2 then
|
||||
--~ local check_pos={self.lastpos.x+0.5, self.lastpos.y, self.lastpos.z}
|
||||
--~ if minetest.get_node(check_pos).name ~= "air" then
|
||||
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
|
||||
--~ self.object:remove()
|
||||
--~ end
|
||||
--~ elseif wall == 3 then
|
||||
--~ local check_pos={self.lastpos.x-0.5, self.lastpos.y, self.lastpos.z}
|
||||
--~ if minetest.get_node(check_pos).name ~= "air" then
|
||||
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
|
||||
--~ self.object:remove()
|
||||
--~ end
|
||||
--~ elseif wall == 4 then
|
||||
--~ local check_pos={self.lastpos.x, self.lastpos.y, self.lastpos.z+0.5}
|
||||
--~ if minetest.get_node(check_pos).name ~= "air" then
|
||||
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
|
||||
--~ self.object:remove()
|
||||
--~ end
|
||||
--~ elseif wall == 5 then
|
||||
--~ local check_pos={self.lastpos.x, self.lastpos.y, self.lastpos.z-0.5}
|
||||
--~ if minetest.get_node(check_pos).name ~= "air" then
|
||||
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
|
||||
--~ self.object:remove()
|
||||
--~ end
|
||||
--~ end
|
||||
else
|
||||
local toughness = 0.9
|
||||
if self.breaks < toughness then
|
||||
if math.random() < toughness then
|
||||
minetest.add_item(self.lastpos, 'throwing:arrow_torch')
|
||||
else
|
||||
minetest.add_item(self.lastpos, 'default:stick')
|
||||
|
Reference in New Issue
Block a user