mirror of
http://repo.or.cz/minetest_pyramids/tsm_pyramids.git
synced 2025-01-07 15:00:20 +01:00
Fix crash with missing attacker position
This commit is contained in:
parent
b8ffcb9afe
commit
fd0d11df1c
@ -319,6 +319,7 @@ MUMMY_DEF.on_step = function(self, dtime)
|
|||||||
if self.attacker ~= "" and minetest.setting_getbool("enable_damage") then
|
if self.attacker ~= "" and minetest.setting_getbool("enable_damage") then
|
||||||
local s = self.object:getpos()
|
local s = self.object:getpos()
|
||||||
local p = self.attacker:getpos()
|
local p = self.attacker:getpos()
|
||||||
|
if (s ~= nil and p ~= nil) then
|
||||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||||
|
|
||||||
if dist < 2 and self.attacking_timer > 0.6 then
|
if dist < 2 and self.attacking_timer > 0.6 then
|
||||||
@ -331,6 +332,7 @@ MUMMY_DEF.on_step = function(self, dtime)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_entity("pyramids:mummy", MUMMY_DEF)
|
minetest.register_entity("pyramids:mummy", MUMMY_DEF)
|
||||||
minetest.register_entity("pyramids:mummy_spawner", spawner_DEF)
|
minetest.register_entity("pyramids:mummy_spawner", spawner_DEF)
|
||||||
|
Loading…
Reference in New Issue
Block a user