Fix self object reference in player_in_active_range
parent
32be8f9602
commit
af86e73280
|
@ -47,7 +47,8 @@ end
|
|||
|
||||
function mob_class:player_in_active_range()
|
||||
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.
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue