Merge pull request 'Fix crash when rightclicking parrot' (#2965) from fix_parrot_rightclick_crash into master

Reviewed-on: MineClone2/MineClone2#2965
Reviewed-by: AFCMS <afcm.contact@gmail.com>
Reviewed-by: PrairieWind <prairie.astronomer1@gmail.com>
This commit is contained in:
PrairieWind 2022-11-15 21:50:17 +00:00
commit 4e9190bbcf
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
self_rot = self.object:get_attach():get_rotation()
end
if self.rot then
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 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
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)
else