Fix crash when getting attacked by mob while in boat

This commit is contained in:
cora 2022-10-14 16:33:33 +02:00
parent 5eca209d95
commit a6a98fb7ae
1 changed files with 22 additions and 20 deletions

View File

@ -3991,6 +3991,7 @@ local mob_step = function(self, dtime)
if self._locked_object:is_player() then
_locked_object_eye_height = self._locked_object:get_properties().eye_height
end
if _locked_object_eye_height then
local self_rot = self.object:get_rotation()
if self.object:get_attach() then
self_rot = self.object:get_attach():get_rotation()
@ -4014,6 +4015,7 @@ local mob_step = function(self, dtime)
mcl_util.set_bone_position(self.object,self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.new(((mob_pitch-oldr.x)*.3)+oldr.x, 0, -(((mob_yaw-oldr.y)*.3)+oldr.y)*3))
end
end
end
elseif not self._locked_object and math.abs(oldr.y) > 3 and math.abs(oldr.x) < 3 then
mcl_util.set_bone_position(self.object,self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.multiply(oldr, 0.9))
else