Fix crash for nil entity references
This commit is contained in:
parent
0eb5049218
commit
ae2bb7fd6b
1 changed files with 6 additions and 4 deletions
|
@ -207,11 +207,13 @@ end
|
||||||
|
|
||||||
shooter.punch_object = function(object, tool_caps, dir, on_blast)
|
shooter.punch_object = function(object, tool_caps, dir, on_blast)
|
||||||
local do_damage = true
|
local do_damage = true
|
||||||
if on_blast then
|
if on_blast and not object:is_player() then
|
||||||
local ent = object:get_luaentity()
|
local ent = object:get_luaentity()
|
||||||
local def = minetest.registered_entities[ent.name]
|
if ent then
|
||||||
if def.on_blast then
|
local def = minetest.registered_entities[ent.name] or {}
|
||||||
do_damage = def.on_blast(ent, tool_caps.fleshy)
|
if def.on_blast then
|
||||||
|
do_damage = def.on_blast(ent, tool_caps.fleshy)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if do_damage then
|
if do_damage then
|
||||||
|
|
Loading…
Reference in a new issue