Lower and unify distance check

This commit is contained in:
cora 2022-11-25 00:25:45 +01:00
parent d0ea7c4059
commit dabc09adb2

View file

@ -36,7 +36,7 @@ end
local function addbars(self) local function addbars(self)
if not self.enable_bossbar then return end if not self.enable_bossbar then return end
for _,player in pairs(minetest.get_connected_players()) do for _,player in pairs(minetest.get_connected_players()) do
if vector.distance(self.pos,player:get_pos()) < 75 then if vector.distance(self.pos,player:get_pos()) < 64 then
local bar = mcl_bossbars.add_bar(player, {color = "red", text = self.readable_name .. ": Wave "..self.stage.." / "..self.max_stage, percentage = self.percent }, true,1) local bar = mcl_bossbars.add_bar(player, {color = "red", text = self.readable_name .. ": Wave "..self.stage.." / "..self.max_stage, percentage = self.percent }, true,1)
table.insert(self.bars,bar) table.insert(self.bars,bar)
end end
@ -120,7 +120,7 @@ function check_events(dtime)
for idx,ae in pairs(active_events) do for idx,ae in pairs(active_events) do
local player_near = false local player_near = false
for _,pl in pairs(minetest.get_connected_players()) do for _,pl in pairs(minetest.get_connected_players()) do
if ae.pos and vector.distance(pl:get_pos(),ae.pos) < 150 then player_near = true end if ae.pos and vector.distance(pl:get_pos(),ae.pos) < 64 then player_near = true end
end end
if ae.pos and not player_near then if ae.pos and not player_near then
mcl_log("[mcl_events] Event "..ae.readable_name.." at "..minetest.pos_to_string(vector.round(ae.pos)).." aborted - no players near." ) mcl_log("[mcl_events] Event "..ae.readable_name.." at "..minetest.pos_to_string(vector.round(ae.pos)).." aborted - no players near." )