Fix some mob-related death bugs
This commit is contained in:
parent
3a28081683
commit
cb08062926
1 changed files with 12 additions and 5 deletions
|
@ -201,7 +201,7 @@ end
|
||||||
-- attack player/mob
|
-- attack player/mob
|
||||||
local do_attack = function(self, player)
|
local do_attack = function(self, player)
|
||||||
|
|
||||||
if self.state == "attack" then
|
if self.state == "attack" or self.state == "die" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -799,6 +799,9 @@ local check_for_death = function(self, cause, cmi_cause)
|
||||||
collide_with_objects = false,
|
collide_with_objects = false,
|
||||||
})
|
})
|
||||||
set_velocity(self, 0)
|
set_velocity(self, 0)
|
||||||
|
local acc = self.object:get_acceleration()
|
||||||
|
acc.x, acc.z = 0, 0
|
||||||
|
self.object:set_acceleration(acc)
|
||||||
|
|
||||||
local length = 0
|
local length = 0
|
||||||
-- default death function and die animation (if defined)
|
-- default death function and die animation (if defined)
|
||||||
|
@ -819,7 +822,7 @@ local check_for_death = function(self, cause, cmi_cause)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Remove body after a few seconds and drop stuff
|
||||||
minetest.after(length, function(self)
|
minetest.after(length, function(self)
|
||||||
if not self.object:get_luaentity() then
|
if not self.object:get_luaentity() then
|
||||||
return
|
return
|
||||||
|
@ -1251,7 +1254,7 @@ local do_jump = function(self)
|
||||||
|
|
||||||
-- when in air move forward
|
-- when in air move forward
|
||||||
minetest.after(0.3, function(self, v)
|
minetest.after(0.3, function(self, v)
|
||||||
if not self.object or not self.object:get_luaentity() then
|
if (not self.object) or (not self.object:get_luaentity()) or (self.state == "die") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.object:set_acceleration({
|
self.object:set_acceleration({
|
||||||
|
@ -3303,6 +3306,10 @@ local mob_step = function(self, dtime)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local yaw = 0
|
local yaw = 0
|
||||||
|
|
||||||
|
if mobs_debug then
|
||||||
|
update_tag(self)
|
||||||
|
end
|
||||||
|
|
||||||
-- Despawning: when lifetimer expires, remove mob
|
-- Despawning: when lifetimer expires, remove mob
|
||||||
if remove_far
|
if remove_far
|
||||||
and self.can_despawn == true
|
and self.can_despawn == true
|
||||||
|
@ -3334,8 +3341,8 @@ local mob_step = function(self, dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if mobs_debug then
|
if self.state == "die" then
|
||||||
update_tag(self)
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.jump_sound_cooloff > 0 then
|
if self.jump_sound_cooloff > 0 then
|
||||||
|
|
Reference in a new issue