Make mobs slide less, and fix ageold jump dilema
This commit is contained in:
parent
2e2f56122d
commit
1f5247df06
|
@ -355,9 +355,11 @@ function mob_class:do_jump()
|
||||||
jump_c_multiplier = v2/self.walk_velocity/2
|
jump_c_multiplier = v2/self.walk_velocity/2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local yaw_dir = minetest.yaw_to_dir(self.object:get_yaw())
|
||||||
|
|
||||||
-- where is front
|
-- where is front
|
||||||
local dir_x = -math.sin(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+0.6
|
local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5)*jump_c_multiplier+yaw_dir.z
|
||||||
|
|
||||||
-- what is in front of mob?
|
-- what is in front of mob?
|
||||||
nod = node_ok({
|
nod = node_ok({
|
||||||
|
|
|
@ -184,7 +184,7 @@ function mob_class:collision()
|
||||||
end
|
end
|
||||||
|
|
||||||
function mob_class:check_death_and_slow_mob()
|
function mob_class:check_death_and_slow_mob()
|
||||||
local d = 0.85
|
local d = 0.7
|
||||||
local dying = self:check_dying()
|
local dying = self:check_dying()
|
||||||
if dying then d = 0.92 end
|
if dying then d = 0.92 end
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ function mob_class:set_velocity(v)
|
||||||
local vv = self.object:get_velocity()
|
local vv = self.object:get_velocity()
|
||||||
|
|
||||||
if vv and yaw then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -327,9 +327,9 @@ function mob_class:set_yaw(yaw, delay, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
if math.deg(yaw) > 360 then
|
if math.deg(yaw) > 360 then
|
||||||
yaw=yaw%360
|
yaw=math.rad(math.deg(yaw)%360)
|
||||||
elseif math.deg(yaw) < 0 then
|
elseif math.deg(yaw) < 0 then
|
||||||
yaw=((360*5)-yaw)%360
|
yaw=math.rad(((360*5)-math.deg(yaw))%360)
|
||||||
end
|
end
|
||||||
|
|
||||||
--calculate the shortest way to turn to find our target
|
--calculate the shortest way to turn to find our target
|
||||||
|
@ -353,7 +353,7 @@ function mob_class:set_yaw(yaw, delay, dtime)
|
||||||
ddtime = dtime
|
ddtime = dtime
|
||||||
end
|
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)))
|
self.object:set_yaw(self.object:get_yaw()+(target_shortest_path*(3.6*ddtime)))
|
||||||
if self.acc then
|
if self.acc then
|
||||||
self.acc=vector.rotate_around_axis(self.acc,vector.new(0,1,0), target_shortest_path*(3.6*ddtime))
|
self.acc=vector.rotate_around_axis(self.acc,vector.new(0,1,0), target_shortest_path*(3.6*ddtime))
|
||||||
|
|
Loading…
Reference in New Issue