1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-12-20 16:55:19 +01:00

remove random pickaxe or stick and add digged node and throwing:arrow_dig

fix crash if not player in function throwing_shoot_arrow()
    "LuaEntity name "" not defined" and "functions.lua:34: attempt to index a nil value"
fix crash,  "self.*" not defined after self.object:remove()
    "dig_arrow.lua:67: attempt to index field 'player' (a nil value)"
This commit is contained in:
2015-07-21 20:59:59 +02:00
parent 6ddba5a15e
commit 3f288ae184
2 changed files with 8 additions and 13 deletions

View File

@@ -55,12 +55,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
local toughness = 0.9
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_dig')
else
minetest.add_item(self.lastpos, 'default:stick')
end
minetest.add_item(self.lastpos, "throwing:arrow_dig")
end
end
end
@@ -68,18 +63,15 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if self.lastpos.x~=nil then
if node.name ~= "air" then
self.object:remove()
if minetest.get_item_group(node.name, "unbreakable") == 0
and areas:canInteract(self.lastpos, self.player:get_player_name())
and node.diggable ~= false then
minetest.set_node(pos, {name = "air"})
end
local toughness = 0.65
if math.random() < toughness then
minetest.add_item(self.lastpos, 'default:pick_steel')
else
minetest.add_item(self.lastpos, 'default:stick')
end
minetest.add_item(self.lastpos, node.name)
minetest.add_item(self.lastpos, "throwing:arrow_dig")
self.object:remove()
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}