fix mayor multiplayer bug

because i escape the loop using return after applying the effect to ONE player, which causes the other ones to not get the effect
This commit is contained in:
chmodsayshello 2022-07-23 22:15:17 +00:00 committed by cora
parent a33d3e68a2
commit cc877e1264
1 changed files with 7 additions and 11 deletions

View File

@ -64,21 +64,17 @@ local function beacon_blockcheck(pos)
end end
local function effect_player(effect,pos,power_level, effect_level) local function effect_player(effect,pos,power_level, effect_level)
local all_objects = minetest.get_objects_inside_radius(pos, (power_level+1)*10) local all_objects = minetest.get_objects_inside_radius(pos, ((power_level+1)*10))
for _,obj2 in ipairs(all_objects) do for _,obj in ipairs(all_objects) do
if obj2:is_player() then if obj:is_player() then
if effect == "swiftness" then if effect == "swiftness" then
mcl_potions.swiftness_func(obj2,effect_level,16) mcl_potions.swiftness_func(obj,effect_level,16)
return
elseif effect == "leaping" then elseif effect == "leaping" then
mcl_potions.leaping_func(obj2, effect_level, 16) mcl_potions.leaping_func(obj, effect_level, 16)
return
elseif effect == "strenght" then elseif effect == "strenght" then
mcl_potions.strength_func(obj2, effect_level, 16) mcl_potions.strength_func(obj, effect_level, 16)
return
elseif effect == "regeneration" then elseif effect == "regeneration" then
mcl_potions.regeneration_func(obj2, effect_level, 16) mcl_potions.regeneration_func(obj, effect_level, 16)
return
end end
end end
end end