0
0
Fork 0

Fix self object reference in player_in_active_range

This commit is contained in:
ancientmarinerdev 2023-01-23 01:33:28 +00:00 committed by Gitea
parent 32be8f9602
commit af86e73280
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ end
function mob_class:player_in_active_range() function mob_class:player_in_active_range()
for _,p in pairs(minetest.get_connected_players()) do for _,p in pairs(minetest.get_connected_players()) do
if vector.distance(self.object:get_pos(),p:get_pos()) <= mob_active_range then return true end local pos = self.object:get_pos()
if pos and vector.distance(pos, p:get_pos()) <= mob_active_range then return true end
-- slightly larger than the mc 32 since mobs spawn on that circle and easily stand still immediately right after spawning. -- slightly larger than the mc 32 since mobs spawn on that circle and easily stand still immediately right after spawning.
end end
end end