mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-26 11:17:30 +01:00
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
|
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
|
if self:falling(pos) then return end
|
||||||
self:check_suspend()
|
self:check_suspend()
|
||||||
|
|
||||||
self:check_water_flow()
|
self:check_water_flow()
|
||||||
|
|
||||||
self:env_danger_movement_checks (dtime)
|
self:env_danger_movement_checks (dtime)
|
||||||
|
-- End: This code logically should be moved to after the die check
|
||||||
|
|
||||||
if not self.fire_resistant then
|
if not self.fire_resistant then
|
||||||
mcl_burning.tick(self.object, dtime, self)
|
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
|
if not self.object:get_pos() then return end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Move to after die check?
|
||||||
if mobs_debug then self:update_tag() end
|
if mobs_debug then self:update_tag() end
|
||||||
|
|
||||||
if self.state == "die" then return 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)
|
yaw = self:set_yaw( yaw, 8)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
-- This code should probably be moved to movement code
|
||||||
if self.move_in_group ~= false then
|
if self.move_in_group ~= false then
|
||||||
self:check_herd(dtime)
|
self:check_herd(dtime)
|
||||||
end
|
end
|
||||||
|
@ -182,17 +182,17 @@ function mob_class:collision()
|
|||||||
return({x,z})
|
return({x,z})
|
||||||
end
|
end
|
||||||
|
|
||||||
function mob_class:slow_mob()
|
function mob_class:check_death_and_slow_mob()
|
||||||
local d = 0.85
|
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()
|
local v = self.object:get_velocity()
|
||||||
if v then
|
if v then
|
||||||
--diffuse object velocity
|
--diffuse object velocity
|
||||||
self.object:set_velocity({x = v.x*d, y = v.y, z = v.z*d})
|
self.object:set_velocity({x = v.x*d, y = v.y, z = v.z*d})
|
||||||
end
|
end
|
||||||
end
|
return dying
|
||||||
end
|
end
|
||||||
|
|
||||||
-- move mob in facing direction
|
-- move mob in facing direction
|
||||||
@ -520,8 +520,8 @@ function mob_class:check_for_death(cause, cmi_cause)
|
|||||||
})
|
})
|
||||||
|
|
||||||
self:set_velocity(0)
|
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
|
acc.x, acc.y, acc.z = 0, DEFAULT_FALL_SPEED, 0
|
||||||
self.object:set_acceleration(acc)
|
self.object:set_acceleration(acc)
|
||||||
end
|
end
|
||||||
@ -530,10 +530,7 @@ function mob_class:check_for_death(cause, cmi_cause)
|
|||||||
-- default death function and die animation (if defined)
|
-- default death function and die animation (if defined)
|
||||||
if self.instant_death then
|
if self.instant_death then
|
||||||
length = 0
|
length = 0
|
||||||
elseif self.animation
|
elseif self.animation and self.animation.die_start and self.animation.die_end then
|
||||||
and self.animation.die_start
|
|
||||||
and self.animation.die_end then
|
|
||||||
|
|
||||||
local frames = self.animation.die_end - self.animation.die_start
|
local frames = self.animation.die_end - self.animation.die_start
|
||||||
local speed = self.animation.die_speed or 15
|
local speed = self.animation.die_speed or 15
|
||||||
length = math.max(frames / speed, 0) + DEATH_DELAY
|
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
|
if not self.object:get_luaentity() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
death_handle(self)
|
death_handle(self)
|
||||||
local dpos = self.object:get_pos()
|
local dpos = self.object:get_pos()
|
||||||
local cbox = self.collisionbox
|
local cbox = self.collisionbox
|
||||||
@ -558,6 +554,7 @@ function mob_class:check_for_death(cause, cmi_cause)
|
|||||||
self.object:remove()
|
self.object:remove()
|
||||||
mcl_mobs.death_effect(dpos, yaw, cbox, not self.instant_death)
|
mcl_mobs.death_effect(dpos, yaw, cbox, not self.instant_death)
|
||||||
end
|
end
|
||||||
|
|
||||||
if length <= 0 then
|
if length <= 0 then
|
||||||
kill(self)
|
kill(self)
|
||||||
else
|
else
|
||||||
@ -984,8 +981,8 @@ end
|
|||||||
|
|
||||||
function mob_class:check_dying()
|
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.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
|
rot.z = ((math.pi/2-rot.z)*.2)+rot.z
|
||||||
self.object:set_rotation(rot)
|
self.object:set_rotation(rot)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user