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

@ -46,7 +46,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
local node = minetest.get_node(pos)
if self.timer>0.2 then
local objs = minetest.env: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}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_build_entity" and obj:get_luaentity().name ~= "__builtin:item" then
@ -56,7 +56,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
end
minetest.add_item(self.lastpos, {name=self.stack:get_name()})
local toughness = 0.95
if self.breaks < toughness then
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_build')
else
minetest.add_item(self.lastpos, 'default:stick')