forked from mtcontrib/throwing
1.0rc2, fixed nil value comparison
This commit is contained in:
@ -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')
|
||||
|
Reference in New Issue
Block a user