mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-01-11 09:39:34 +01:00
Fix self object reference in player_in_active_range
This commit is contained in:
parent
32be8f9602
commit
af86e73280
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue