mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-28 21:41:06 +01:00
Merge pull request 'Fix beacon crash' (#4342) from teknomunk/MineClone2:fix-beacon-crash into master
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4342 Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
This commit is contained in:
commit
f53bedc131
3 changed files with 38 additions and 18 deletions
|
@ -84,6 +84,9 @@ local pallete_order = {
|
|||
pane_magenta_flat = 16,
|
||||
pane_magenta = 16
|
||||
}
|
||||
local EFFECT_CONVERSIONS = {
|
||||
strenght = "strength"
|
||||
}
|
||||
|
||||
local function get_beacon_beam(glass_nodename)
|
||||
if glass_nodename == "air" then return 0 end
|
||||
|
@ -218,7 +221,13 @@ local function apply_effects_to_all_players(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
|
||||
local new_effect_string = EFFECT_CONVERSIONS[effect_string]
|
||||
if new_effect_string then
|
||||
effect_string = new_effect_string
|
||||
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
|
||||
|
||||
|
@ -244,8 +253,7 @@ minetest.register_node("mcl_beacons:beacon", {
|
|||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("input", 1)
|
||||
local form = formspec_string
|
||||
meta:set_string("formspec", form)
|
||||
meta:set_string("formspec", formspec_string)
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -363,7 +371,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
|
||||
|
@ -426,6 +433,15 @@ minetest.register_abm{
|
|||
apply_effects_to_all_players(pos)
|
||||
end,
|
||||
}
|
||||
minetest.register_lbm({
|
||||
label = "Update beacon formspecs (0.87.1)",
|
||||
name = "mcl_beacons:update_beacon_formspecs_0_87_1",
|
||||
nodenames = { "mcl_beacons:beacon" },
|
||||
action = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", formspec_string)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_beacons:beacon",
|
||||
|
|
|
@ -654,7 +654,7 @@ end
|
|||
minetest.register_alias("mcl_hoppers:hopper_item", "mcl_hoppers:hopper")
|
||||
|
||||
minetest.register_lbm({
|
||||
label = "Update hopper formspecs (0.60.0",
|
||||
label = "Update hopper formspecs (0.60.0)",
|
||||
name = "mcl_hoppers:update_formspec_0_60_0",
|
||||
nodenames = {"group:hopper"},
|
||||
run_at_every_load = false,
|
||||
|
|
|
@ -1832,6 +1832,10 @@ end
|
|||
|
||||
function mcl_potions.give_effect_by_level(name, object, level, duration, no_particles)
|
||||
if level == 0 then return false end
|
||||
if not registered_effects[name] then
|
||||
minetest.log("warning", "[mcl_potions] Trying to give unknown effect "..tostring(name))
|
||||
return false
|
||||
end
|
||||
if not registered_effects[name].uses_factor then
|
||||
return mcl_potions.give_effect(name, object, 0, duration, no_particles)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue