Convert 'strenght' to 'strength' in beacons and guard against no effect string metadata set, fix whitespace in mcl_beacons/init.lua

This commit is contained in:
teknomunk 2024-05-28 20:19:51 -05:00
parent 95228500a9
commit 2fc3d92550
1 changed files with 18 additions and 14 deletions

View File

@ -212,24 +212,29 @@ local function effect_player(effect,pos,power_level, effect_level,player)
end
local function apply_effects_to_all_players(pos)
local meta = minetest.get_meta(pos)
local meta = minetest.get_meta(pos)
local effect_string = meta:get_string("effect")
local effect_level = meta:get_int("effect_level")
local effect_level = meta:get_int("effect_level")
local power_level = beacon_blockcheck(pos)
local power_level = beacon_blockcheck(pos)
if effect_level == 2 and power_level < 4 then --no need to run loops when beacon is in an invalid setup :P
if effect_string == "strenght" then
effect_string = "strength"
meta:set_string("effect", effect_string)
end
if effect_string == "" or ( effect_level == 2 and power_level < 4 ) then --no need to run loops when beacon is in an invalid setup :P
return
end
local beacon_distance = (power_level + 1) * 10
local beacon_distance = (power_level + 1) * 10
for _, player in pairs(minetest.get_connected_players()) do
if vector.distance(pos, player:get_pos()) <= beacon_distance then
if not clear_obstructed_beam(pos) then
effect_player(effect_string, pos, power_level, effect_level, player)
end
end
if vector.distance(pos, player:get_pos()) <= beacon_distance then
if not clear_obstructed_beam(pos) then
effect_player(effect_string, pos, power_level, effect_level, player)
end
end
end
end
@ -363,7 +368,6 @@ minetest.register_node("mcl_beacons:beacon", {
node = minetest.get_node({x=pos.x,y=y,z=pos.z})
end
if minetest.get_item_group(node.name, "glass") ~= 0 or minetest.get_item_group(node.name,"material_glass") ~= 0 then
beam_palette_index = get_beacon_beam(node.name)
end