Skip to content
This repository has been archived by the owner on Dec 14, 2019. It is now read-only.

Commit

Permalink
Fix crash with missing attacker position
Browse files Browse the repository at this point in the history
  • Loading branch information
BlockMen committed Jan 14, 2014
1 parent b8ffcb9 commit fd0d11d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions mummy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,16 @@ MUMMY_DEF.on_step = function(self, dtime)
if self.attacker ~= "" and minetest.setting_getbool("enable_damage") then
local s = self.object:getpos()
local p = self.attacker:getpos()
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
self.attacker:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=1}
})
self.attacking_timer = 0
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

if dist < 2 and self.attacking_timer > 0.6 then
self.attacker:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=1}
})
self.attacking_timer = 0
end
end
end
end
Expand Down

0 comments on commit fd0d11d

Please sign in to comment.