From e9f259881f961d924d9c536320984383ac7b833f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 29 Mar 2020 14:35:01 +0200 Subject: [PATCH] Add LBMs to update to new node formspecs of 0.60.0 --- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 5 +- mods/ITEMS/REDSTONE/mcl_droppers/init.lua | 5 +- mods/ITEMS/mcl_anvils/init.lua | 13 ++++ mods/ITEMS/mcl_chests/init.lua | 75 ++++++++++++++------- mods/ITEMS/mcl_furnaces/init.lua | 12 ++++ mods/ITEMS/mcl_hoppers/init.lua | 11 +++ 6 files changed, 92 insertions(+), 29 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index 386c50fca9..464bc4bd8f 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -361,9 +361,10 @@ if minetest.get_modpath("doc") then doc.add_entry_alias("nodes", "mcl_dispensers:dispenser", "nodes", "mcl_dispensers:dispenser_up") end +-- Legacy minetest.register_lbm({ - label = "Update dispenser formspecs (0.51.0)", - name = "mcl_dispensers:update_formspecs_0_51_0", + label = "Update dispenser formspecs (0.60.0)", + name = "mcl_dispensers:update_formspecs_0_60_0", nodenames = { "mcl_dispensers:dispenser", "mcl_dispensers:dispenser_down", "mcl_dispensers:dispenser_up" }, action = function(pos, node) setup_dispenser(pos) diff --git a/mods/ITEMS/REDSTONE/mcl_droppers/init.lua b/mods/ITEMS/REDSTONE/mcl_droppers/init.lua index cf32abae19..6ca92b335f 100644 --- a/mods/ITEMS/REDSTONE/mcl_droppers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_droppers/init.lua @@ -209,9 +209,10 @@ if minetest.get_modpath("doc") then doc.add_entry_alias("nodes", "mcl_droppers:dropper", "nodes", "mcl_droppers:dropper_up") end +-- Legacy minetest.register_lbm({ - label = "Update dropper formspecs (0.51.0)", - name = "mcl_droppers:update_formspecs_0_51_0", + label = "Update dropper formspecs (0.60.0)", + name = "mcl_droppers:update_formspecs_0_60_0", nodenames = { "mcl_droppers:dropper", "mcl_droppers:dropper_down", "mcl_droppers:dropper_up" }, action = function(pos, node) setup_dropper(pos) diff --git a/mods/ITEMS/mcl_anvils/init.lua b/mods/ITEMS/mcl_anvils/init.lua index 994a7029e1..f2be3b852c 100644 --- a/mods/ITEMS/mcl_anvils/init.lua +++ b/mods/ITEMS/mcl_anvils/init.lua @@ -490,3 +490,16 @@ if minetest.get_modpath("doc") then doc.add_entry_alias("nodes", "mcl_anvils:anvil", "nodes", "mcl_anvils:anvil_damage_1") doc.add_entry_alias("nodes", "mcl_anvils:anvil", "nodes", "mcl_anvils:anvil_damage_2") end + +-- Legacy +minetest.register_lbm({ + label = "Update anvil formspecs (0.60.0", + name = "mcl_anvils:update_formspec_0_60_0", + nodenames = { "group:anvil" }, + run_at_every_load = false, + action = function(pos, node) + local meta = minetest.get_meta(pos) + local set_name = meta:get_string("set_name") + meta:set_string("formspec", get_anvil_formspec(set_name)) + end, +}) diff --git a/mods/ITEMS/mcl_chests/init.lua b/mods/ITEMS/mcl_chests/init.lua index c9427aa1a6..d92448c6f9 100644 --- a/mods/ITEMS/mcl_chests/init.lua +++ b/mods/ITEMS/mcl_chests/init.lua @@ -678,6 +678,19 @@ minetest.register_craft({ burntime = 15 }) +local formspec_ender_chest = "size[9,8.75]".. + "label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Ender Chest"))).."]".. + "list[current_player;enderchest;0,0.5;9,3;]".. + mcl_formspec.get_itemslot_bg(0,0.5,9,3).. + "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.74,9,1).. + "listring[current_player;enderchest]".. + "listring[current_player;main]" + + minetest.register_node("mcl_chests:ender_chest", { description = S("Ender Chest"), _tt_help = S("27 interdimensional inventory slots") .. "\n" .. S("Put items inside, retrieve them from any ender chest"), @@ -697,18 +710,7 @@ minetest.register_node("mcl_chests:ender_chest", { drop = "mcl_core:obsidian 8", on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", - "size[9,8.75]".. - "label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Ender Chest"))).."]".. - "list[current_player;enderchest;0,0.5;9,3;]".. - mcl_formspec.get_itemslot_bg(0,0.5,9,3).. - "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. - "list[current_player;main;0,4.5;9,3;9]".. - mcl_formspec.get_itemslot_bg(0,4.5,9,3).. - "list[current_player;main;0,7.74;9,1;]".. - mcl_formspec.get_itemslot_bg(0,7.74,9,1).. - "listring[current_player;enderchest]".. - "listring[current_player;main]") + meta:set_string("formspec", formspec_ender_chest) end, _mcl_blast_resistance = 3000, _mcl_hardness = 22.5, @@ -779,6 +781,18 @@ local shulker_mob_textures = { } local canonical_shulker_color = "violet" +local formspec_shulker_box = "size[9,8.75]".. + "label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Shulker Box"))).."]".. + "list[current_name;main;0,0.5;9,3;]".. + mcl_formspec.get_itemslot_bg(0,0.5,9,3).. + "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.74;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.74,9,1).. + "listring[current_name;main]".. + "listring[current_player;main]" + for color, desc in pairs(boxtypes) do local mob_texture = shulker_mob_textures[color] local is_canonical = color == canonical_shulker_color @@ -820,18 +834,7 @@ for color, desc in pairs(boxtypes) do -- on_place = minetest.rotate_node, on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", - "size[9,8.75]".. - "label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Shulker Box"))).."]".. - "list[current_name;main;0,0.5;9,3;]".. - mcl_formspec.get_itemslot_bg(0,0.5,9,3).. - "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. - "list[current_player;main;0,4.5;9,3;9]".. - mcl_formspec.get_itemslot_bg(0,4.5,9,3).. - "list[current_player;main;0,7.74;9,1;]".. - mcl_formspec.get_itemslot_bg(0,7.74,9,1).. - "listring[current_name;main]".. - "listring[current_player;main]") + meta:set_string("formspec", formspec_shulker_box) local inv = meta:get_inventory() inv:set_size("main", 9*3) end, @@ -956,7 +959,29 @@ minetest.register_lbm({ nodenames = { "mcl_chests:trapped_chest_on", "mcl_chests:trapped_chest_on_left", "mcl_chests:trapped_chest_on_right" }, run_at_every_load = true, action = function(pos, node) - minetest.log("error", "lbm!" ..minetest.pos_to_string(pos)) + minetest.log("action", "[mcl_chests] Disabled active trapped chest on load: " ..minetest.pos_to_string(pos)) chest_update_after_close(pos) end, }) + +-- Legacy +minetest.register_lbm({ + label = "Update ender chest formspecs (0.60.0", + name = "mcl_chests:update_ender_chest_formspecs_0_60_0", + nodenames = { "mcl_chests:ender_chest" }, + run_at_every_load = false, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", formspec_ender_chest) + end, +}) +minetest.register_lbm({ + label = "Update shulker box formspecs (0.60.0", + name = "mcl_chests:update_shulker_box_formspecs_0_60_0", + nodenames = { "group:shulker_box" }, + run_at_every_load = false, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", formspec_shulker_box) + end, +}) diff --git a/mods/ITEMS/mcl_furnaces/init.lua b/mods/ITEMS/mcl_furnaces/init.lua index 871e38ab04..b2c76bb7a9 100644 --- a/mods/ITEMS/mcl_furnaces/init.lua +++ b/mods/ITEMS/mcl_furnaces/init.lua @@ -417,3 +417,15 @@ if minetest.get_modpath("doc") then doc.add_entry_alias("nodes", "mcl_furnaces:furnace", "nodes", "mcl_furnaces:furnace_active") end +-- Legacy +minetest.register_lbm({ + label = "Update furnace formspecs (0.60.0", + name = "mcl_furnaces:update_formspecs_0_60_0", + -- Only update inactive furnaces because active ones should update themselves + nodenames = { "mcl_furnaces:furnace" }, + run_at_every_load = false, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", inactive_formspec) + end, +}) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index 668d6db4c8..905ad8a04f 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -486,3 +486,14 @@ end -- Legacy minetest.register_alias("mcl_hoppers:hopper_item", "mcl_hoppers:hopper") + +minetest.register_lbm({ + label = "Update hopper formspecs (0.60.0", + name = "mcl_hoppers:update_formspec_0_60_0", + nodenames = { "group:hopper" }, + run_at_every_load = false, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", mcl_hoppers_formspec) + end, +})