forked from VoxeLibre/VoxeLibre
Review feedback implemented and planned changes
This commit is contained in:
parent
2cd6629ae1
commit
84317afc93
|
@ -335,13 +335,19 @@ function mob_class:on_step(dtime)
|
|||
|
||||
if self:check_despawn(pos, dtime) then return true end
|
||||
|
||||
self:slow_mob()
|
||||
if self:check_death_and_slow_mob() then
|
||||
minetest.log("action", "Mob is dying: ".. tostring(self.name))
|
||||
-- Do we abandon out of here now?
|
||||
end
|
||||
|
||||
-- Start: This code logically should be moved to after the die check
|
||||
if self:falling(pos) then return end
|
||||
self:check_suspend()
|
||||
|
||||
self:check_water_flow()
|
||||
|
||||
self:env_danger_movement_checks (dtime)
|
||||
-- End: This code logically should be moved to after the die check
|
||||
|
||||
if not self.fire_resistant then
|
||||
mcl_burning.tick(self.object, dtime, self)
|
||||
|
@ -349,6 +355,7 @@ function mob_class:on_step(dtime)
|
|||
if not self.object:get_pos() then return end
|
||||
end
|
||||
|
||||
-- Move to after die check?
|
||||
if mobs_debug then self:update_tag() end
|
||||
|
||||
if self.state == "die" then return end
|
||||
|
|
|
@ -279,6 +279,7 @@ function mob_class:env_danger_movement_checks(dtime)
|
|||
yaw = self:set_yaw( yaw, 8)
|
||||
end
|
||||
else
|
||||
-- This code should probably be moved to movement code
|
||||
if self.move_in_group ~= false then
|
||||
self:check_herd(dtime)
|
||||
end
|
||||
|
|
|
@ -182,17 +182,17 @@ function mob_class:collision()
|
|||
return({x,z})
|
||||
end
|
||||
|
||||
function mob_class:slow_mob()
|
||||
function mob_class:check_death_and_slow_mob()
|
||||
local d = 0.85
|
||||
if self:check_dying() then d = 0.92 end
|
||||
local dying = self:check_dying()
|
||||
if dying then d = 0.92 end
|
||||
|
||||
if self.object then
|
||||
local v = self.object:get_velocity()
|
||||
if v then
|
||||
--diffuse object velocity
|
||||
self.object:set_velocity({x = v.x*d, y = v.y, z = v.z*d})
|
||||
end
|
||||
local v = self.object:get_velocity()
|
||||
if v then
|
||||
--diffuse object velocity
|
||||
self.object:set_velocity({x = v.x*d, y = v.y, z = v.z*d})
|
||||
end
|
||||
return dying
|
||||
end
|
||||
|
||||
-- move mob in facing direction
|
||||
|
@ -520,8 +520,8 @@ function mob_class:check_for_death(cause, cmi_cause)
|
|||
})
|
||||
|
||||
self:set_velocity(0)
|
||||
if self.object then
|
||||
local acc = self.object:get_acceleration()
|
||||
local acc = self.object:get_acceleration()
|
||||
if acc then
|
||||
acc.x, acc.y, acc.z = 0, DEFAULT_FALL_SPEED, 0
|
||||
self.object:set_acceleration(acc)
|
||||
end
|
||||
|
@ -530,10 +530,7 @@ function mob_class:check_for_death(cause, cmi_cause)
|
|||
-- default death function and die animation (if defined)
|
||||
if self.instant_death then
|
||||
length = 0
|
||||
elseif self.animation
|
||||
and self.animation.die_start
|
||||
and self.animation.die_end then
|
||||
|
||||
elseif self.animation and self.animation.die_start and self.animation.die_end then
|
||||
local frames = self.animation.die_end - self.animation.die_start
|
||||
local speed = self.animation.die_speed or 15
|
||||
length = math.max(frames / speed, 0) + DEATH_DELAY
|
||||
|
@ -549,7 +546,6 @@ function mob_class:check_for_death(cause, cmi_cause)
|
|||
if not self.object:get_luaentity() then
|
||||
return
|
||||
end
|
||||
|
||||
death_handle(self)
|
||||
local dpos = self.object:get_pos()
|
||||
local cbox = self.collisionbox
|
||||
|
@ -558,6 +554,7 @@ function mob_class:check_for_death(cause, cmi_cause)
|
|||
self.object:remove()
|
||||
mcl_mobs.death_effect(dpos, yaw, cbox, not self.instant_death)
|
||||
end
|
||||
|
||||
if length <= 0 then
|
||||
kill(self)
|
||||
else
|
||||
|
@ -984,8 +981,8 @@ end
|
|||
|
||||
function mob_class:check_dying()
|
||||
if ((self.state and self.state=="die") or self:check_for_death()) and not self.animation.die_end then
|
||||
if self.object then
|
||||
local rot = self.object:get_rotation()
|
||||
local rot = self.object:get_rotation()
|
||||
if rot then
|
||||
rot.z = ((math.pi/2-rot.z)*.2)+rot.z
|
||||
self.object:set_rotation(rot)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue