mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-23 11:01:06 +01:00
Merge pull request 'Fix crash when rightclicking parrot' (#2965) from fix_parrot_rightclick_crash into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2965 Reviewed-by: AFCMS <afcm.contact@gmail.com> Reviewed-by: PrairieWind <prairie.astronomer1@gmail.com>
This commit is contained in:
commit
4e9190bbcf
1 changed files with 19 additions and 17 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue