1.0rc2, fixed nil value comparison

This commit is contained in:
echoes91
2015-03-24 12:38:44 +01:00
parent fa887ba13c
commit 96e2d0f799
9 changed files with 96 additions and 54 deletions

View File

@ -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')