1
0
Fork 0

Fix crash when rightclicking parrot

mcl-craftguide-drop-sfinv
cora 2022-11-15 21:16:48 +01:00
parent 589bf75e6a
commit 033b051689
1 changed files with 19 additions and 17 deletions

View File

@ -4497,6 +4497,7 @@ local mob_step = function(self, dtime)
if self.object:get_attach() then if self.object:get_attach() then
self_rot = self.object:get_attach():get_rotation() self_rot = self.object:get_attach():get_rotation()
end end
if self.rot then
local player_pos = self._locked_object:get_pos() local player_pos = self._locked_object:get_pos()
local direction_player = vector.direction(vector.add(self.object:get_pos(), vector.new(0, self.head_eye_height*.7, 0)), vector.add(player_pos, vector.new(0, _locked_object_eye_height, 0))) local direction_player = vector.direction(vector.add(self.object:get_pos(), vector.new(0, self.head_eye_height*.7, 0)), vector.add(player_pos, vector.new(0, _locked_object_eye_height, 0)))
local mob_yaw = math.deg(-(-(self_rot.y)-(-minetest.dir_to_yaw(direction_player))))+self.head_yaw_offset local mob_yaw = math.deg(-(-(self_rot.y)-(-minetest.dir_to_yaw(direction_player))))+self.head_yaw_offset
@ -4520,6 +4521,7 @@ local mob_step = function(self, dtime)
end end
end end
end end
end
elseif not self._locked_object and math.abs(oldr.y) > 3 and math.abs(oldr.x) < 3 then elseif not self._locked_object and math.abs(oldr.y) > 3 and math.abs(oldr.x) < 3 then
final_rotation = vector.multiply(oldr, 0.9) final_rotation = vector.multiply(oldr, 0.9)
else else