Boar: Fix angle when escaping water / damage node

This commit is contained in:
Wuzzy 2024-03-04 12:08:57 +01:00
parent 428b4a88c6
commit c0cc017a33
2 changed files with 10 additions and 3 deletions

View File

@ -214,7 +214,6 @@ rp_mobs.microtasks.walk_straight = function(walk_speed, yaw, jump, max_timer)
return rp_mobs.create_microtask({
label = label,
on_start = function(self, mob)
minetest.log("error", "walk start")
self.statedata.jumping = false -- is true when mob is currently jumpin
self.statedata.jump_timer = 0 -- timer counting the time of the current jump, in seconds
self.statedata.stop = false -- is set to true if microtask is supposed to be finished after the current step finishes

View File

@ -98,7 +98,11 @@ local find_land_from_liquid = function(pos)
not is_walkable(upnode.name) then
best_pos = up
best_dist = dist
best_angle = angle_rad
local pos1 = vector.copy(startpos)
local pos2 = vector.copy(up)
pos1.y = 0
pos2.y = 0
best_angle = minetest.dir_to_yaw(vector.direction(pos1, pos2))
break
end
end
@ -156,7 +160,11 @@ local find_safe_node_from_pos = function(pos)
if not best_dist or dist < best_dist then
best_pos = up
best_dist = dist
best_angle = angle_rad
local pos1 = vector.copy(startpos)
local pos2 = vector.copy(up)
pos1.y = 0
pos2.y = 0
best_angle = minetest.dir_to_yaw(vector.direction(pos1, pos2))
end
break
end