forked from MineClone5/MineClone5
Make mobs walk up stairs/slabs properly, yet not glitch out when jumping over solid nodes
This commit is contained in:
parent
df364eed28
commit
a3ff108cd4
|
@ -200,6 +200,7 @@ function mobs:register_mob(name, def)
|
||||||
|
|
||||||
use_texture_alpha = def.use_texture_alpha,
|
use_texture_alpha = def.use_texture_alpha,
|
||||||
stepheight = def.stepheight or 0.6,
|
stepheight = def.stepheight or 0.6,
|
||||||
|
stepheight_backup = def.stepheight or 0.6,
|
||||||
name = name,
|
name = name,
|
||||||
type = def.type,
|
type = def.type,
|
||||||
attack_type = def.attack_type,
|
attack_type = def.attack_type,
|
||||||
|
|
|
@ -822,7 +822,7 @@ mobs.mob_step = function(self, dtime)
|
||||||
|
|
||||||
--DEBUG TIME!
|
--DEBUG TIME!
|
||||||
|
|
||||||
mobs.do_head_logic(self)
|
--mobs.do_head_logic(self,dtime)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -844,6 +844,9 @@ mobs.mob_step = function(self, dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--make it so mobs do not glitch out when walking around/jumping
|
||||||
|
mobs.swap_auto_step_height_adjust(self)
|
||||||
|
|
||||||
--color modifier which coincides with the pause_timer
|
--color modifier which coincides with the pause_timer
|
||||||
if self.old_health and self.health < self.old_health then
|
if self.old_health and self.health < self.old_health then
|
||||||
self.object:set_texture_mod("^[colorize:red:120")
|
self.object:set_texture_mod("^[colorize:red:120")
|
||||||
|
|
|
@ -1,8 +1,23 @@
|
||||||
mobs.do_head_logic = function(self)
|
local vector_new = vector.new
|
||||||
local yaw = self.object:get_yaw()
|
|
||||||
|
mobs.do_head_logic = function(self,dtime)
|
||||||
|
|
||||||
|
--local yaw = self.object:get_yaw()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--local bone_pos = vector_new(0,5,0)
|
||||||
|
|
||||||
|
--print(yaw)
|
||||||
|
|
||||||
|
--local _, bone_rot = self.object:get_bone_position("head")
|
||||||
|
|
||||||
|
--bone_rot.x = bone_rot.x + (dtime * 10)
|
||||||
|
--bone_rot.z = bone_rot.z + (dtime * 10)
|
||||||
|
|
||||||
|
--self.object:set_bone_position("head", bone_pos, bone_rot)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--set_bone_position([bone, position, rotation])
|
||||||
end
|
end
|
|
@ -377,3 +377,15 @@ mobs.jump_move = function(self, velocity)
|
||||||
self.object:add_velocity(new_velocity_addition)
|
self.object:add_velocity(new_velocity_addition)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--make it so mobs do not glitch out and freak out
|
||||||
|
--when moving around over nodes
|
||||||
|
mobs.swap_auto_step_height_adjust = function(self)
|
||||||
|
local y_vel = self.object:get_velocity().y
|
||||||
|
|
||||||
|
if y_vel == 0 and self.stepheight ~= self.stepheight_backup then
|
||||||
|
self.stepheight = self.stepheight_backup
|
||||||
|
elseif y_vel ~= 0 and self.stepheight ~= 0 then
|
||||||
|
self.stepheight = 0
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue