mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 12:01:06 +01:00
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:
parent
95228500a9
commit
2fc3d92550
1 changed files with 18 additions and 14 deletions
|
@ -159,7 +159,7 @@ local function remove_beacon_beam(pos)
|
|||
minetest.get_voxel_manip():read_from_map({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z})
|
||||
node = minetest.get_node({x=pos.x,y=y,z=pos.z})
|
||||
end
|
||||
|
||||
|
||||
if node.name == "mcl_beacons:beacon_beam" then
|
||||
minetest.remove_node({x=pos.x,y=y,z=pos.z})
|
||||
end
|
||||
|
@ -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
|
||||
|
||||
|
@ -271,7 +276,7 @@ minetest.register_node("mcl_beacons:beacon", {
|
|||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local input = inv:get_stack("input",1)
|
||||
|
||||
|
||||
if input:is_empty() then
|
||||
return
|
||||
end
|
||||
|
@ -353,7 +358,7 @@ minetest.register_node("mcl_beacons:beacon", {
|
|||
awards.unlock(sender:get_player_name(),"mcl:beacon")
|
||||
input:take_item()
|
||||
inv:set_stack("input",1,input)
|
||||
|
||||
|
||||
local beam_palette_index = 0
|
||||
remove_beacon_beam(pos)
|
||||
for y = pos.y +1, pos.y + 201 do
|
||||
|
@ -362,7 +367,6 @@ minetest.register_node("mcl_beacons:beacon", {
|
|||
minetest.get_voxel_manip():read_from_map({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z})
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue