From 1f5247df063211d48db704fbd0fa696764c04ce4 Mon Sep 17 00:00:00 2001 From: epCode Date: Tue, 30 May 2023 11:48:32 -0700 Subject: [PATCH] Make mobs slide less, and fix ageold jump dilema --- mods/ENTITIES/mcl_mobs/movement.lua | 6 ++++-- mods/ENTITIES/mcl_mobs/physics.lua | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/movement.lua b/mods/ENTITIES/mcl_mobs/movement.lua index df86c8161..4e8ce3392 100644 --- a/mods/ENTITIES/mcl_mobs/movement.lua +++ b/mods/ENTITIES/mcl_mobs/movement.lua @@ -355,9 +355,11 @@ function mob_class:do_jump() jump_c_multiplier = v2/self.walk_velocity/2 end + local yaw_dir = minetest.yaw_to_dir(self.object:get_yaw()) + -- where is front - local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+0.6 - local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+0.6 + local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+yaw_dir.x + local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+yaw_dir.z -- what is in front of mob? nod = node_ok({ diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index 1fbe1e24d..e1b23d78a 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -184,7 +184,7 @@ function mob_class:collision() end function mob_class:check_death_and_slow_mob() - local d = 0.85 + local d = 0.7 local dying = self:check_dying() if dying then d = 0.92 end @@ -217,7 +217,7 @@ function mob_class:set_velocity(v) local vv = self.object:get_velocity() if vv and yaw then - self.acc = vector.new(((math.sin(yaw) * -v) + c_x) * .27, 0, ((math.cos(yaw) * v) + c_y) * .27) + self.acc = vector.new(((math.sin(yaw) * -v) + c_x) * .4, 0, ((math.cos(yaw) * v) + c_y) * .4) end end @@ -327,9 +327,9 @@ function mob_class:set_yaw(yaw, delay, dtime) end if math.deg(yaw) > 360 then - yaw=yaw%360 + yaw=math.rad(math.deg(yaw)%360) elseif math.deg(yaw) < 0 then - yaw=((360*5)-yaw)%360 + yaw=math.rad(((360*5)-math.deg(yaw))%360) end --calculate the shortest way to turn to find our target @@ -353,7 +353,7 @@ function mob_class:set_yaw(yaw, delay, dtime) ddtime = dtime end - if math.abs(target_shortest_path_nums) > 5 then + if math.abs(target_shortest_path_nums) > 10 then self.object:set_yaw(self.object:get_yaw()+(target_shortest_path*(3.6*ddtime))) if self.acc then self.acc=vector.rotate_around_axis(self.acc,vector.new(0,1,0), target_shortest_path*(3.6*ddtime))