1
0
Fork 0

make mobs predict jumps before even getting too close to a bock.

This commit is contained in:
epCode 2022-10-14 13:50:36 -07:00 committed by cora
parent 44ba08cb8b
commit f242655b13
1 changed files with 9 additions and 2 deletions

View File

@ -1409,9 +1409,16 @@ local do_jump = function(self)
return false
end
local v = self.object:get_velocity()
local v2 = abs(v.x)+abs(v.z)*.833
local jump_c_multiplier = 1
if v2/self.walk_velocity/2>1 then
jump_c_multiplier = v2/self.walk_velocity/2
end
-- where is front
local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5)
local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5)
local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+.4
local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+.4
-- what is in front of mob?
nod = node_ok({