forked from VoxeLibre/VoxeLibre
don't get all objects in radius
This commit is contained in:
parent
1a1473e8c0
commit
a8c989edd8
|
@ -213,16 +213,15 @@ local function abm_func(pos)
|
||||||
local power_level = beacon_blockcheck(pos)
|
local power_level = beacon_blockcheck(pos)
|
||||||
local effect_string = meta:get_string("effect")
|
local effect_string = meta:get_string("effect")
|
||||||
|
|
||||||
if meta:get_int("effect_level") == 2 and power_level < 4 then --no need to run loops when beacon is in an invalid setup :Pi
|
if meta:get_int("effect_level") == 2 and power_level < 4 then --no need to run loops when beacon is in an invalid setup :P
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, (power_level+1)*10)) do
|
for _, obj in pairs(minetest.get_connected_players()) do
|
||||||
if obj:is_player() then
|
if vector.distance(pos,obj:get_pos()) > (power_level+1)*10 then return end --I used Pythagoras at first, and ignored this method lol
|
||||||
if not is_obstructed(pos) then
|
if not is_obstructed(pos) then
|
||||||
effect_player(effect_string,pos,power_level,meta:get_int("effect_level"),obj)
|
effect_player(effect_string,pos,power_level,meta:get_int("effect_level"),obj)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue