From 191b09f62adeb8def0c185035cefb35834463718 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 27 Jan 2017 12:42:05 +0100 Subject: [PATCH] Move chests to new mcl_chests mod --- mods/craftingpack/crafting/creative.lua | 2 +- mods/default/crafting.lua | 15 - mods/default/nodes.lua | 255 ----------------- mods/mcl_chests/depends.txt | 1 + mods/mcl_chests/init.lua | 260 ++++++++++++++++++ .../textures/default_chest_bg.png | Bin .../textures/default_chest_front.png | Bin .../textures/default_chest_front_big.png | Bin .../textures/default_chest_side.png | Bin .../textures/default_chest_side_big.png | Bin .../textures/default_chest_top.png | Bin .../textures/default_chest_top_big.png | Bin mods/mcl_hoppers/init.lua | 18 +- mods/redstone/mesecons_mvps/init.lua | 8 +- 14 files changed, 275 insertions(+), 284 deletions(-) create mode 100644 mods/mcl_chests/depends.txt create mode 100644 mods/mcl_chests/init.lua rename mods/{default => mcl_chests}/textures/default_chest_bg.png (100%) rename mods/{default => mcl_chests}/textures/default_chest_front.png (100%) rename mods/{default => mcl_chests}/textures/default_chest_front_big.png (100%) rename mods/{default => mcl_chests}/textures/default_chest_side.png (100%) rename mods/{default => mcl_chests}/textures/default_chest_side_big.png (100%) rename mods/{default => mcl_chests}/textures/default_chest_top.png (100%) rename mods/{default => mcl_chests}/textures/default_chest_top_big.png (100%) diff --git a/mods/craftingpack/crafting/creative.lua b/mods/craftingpack/crafting/creative.lua index d59a3354f..a5c44a61b 100644 --- a/mods/craftingpack/crafting/creative.lua +++ b/mods/craftingpack/crafting/creative.lua @@ -271,7 +271,7 @@ crafting.set_creative_formspec = function(player, start_i, pagenum, show, page, "item_image_button[4.938,8.37;1,1;default:stick;matr;]".. --materials tab(name, "matr") .. "tooltip[matr;Materials]".. - "item_image_button[9.19,8.37;1,1;default:chest;inv;]".. --inventory + "item_image_button[9.19,8.37;1,1;mcl_chests:chest;inv;]".. --inventory tab(name, "inv") .. "tooltip[inv;Survival Inventory]".. "list[detached:trash;main;9,7;1,1;]".. diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index 5a4c81c33..bfc859bf3 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -450,15 +450,6 @@ minetest.register_craft({ } }) -minetest.register_craft({ - output = 'default:chest', - recipe = { - {'group:wood', 'group:wood', 'group:wood'}, - {'group:wood', '', 'group:wood'}, - {'group:wood', 'group:wood', 'group:wood'}, - } -}) - minetest.register_craft({ output = 'default:furnace', recipe = { @@ -1018,12 +1009,6 @@ minetest.register_craft({ burntime = 15, }) -minetest.register_craft({ - type = "fuel", - recipe = "default:chest", - burntime = 15, -}) - minetest.register_craft({ type = "fuel", recipe = "default:fishing_rod", diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 76a3a47af..ab2840fca 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -1286,261 +1286,6 @@ minetest.register_node("default:lava_source", { groups = {lava=3, liquid=2, igniter=3, not_in_creative_inventory=1}, }) - -local function get_chest_neighborpos(pos, param2, side) - if side == "right" then - if param2 == 0 then - return {x=pos.x-1, y=pos.y, z=pos.z} - elseif param2 == 1 then - return {x=pos.x, y=pos.y, z=pos.z+1} - elseif param2 == 2 then - return {x=pos.x+1, y=pos.y, z=pos.z} - elseif param2 == 3 then - return {x=pos.x, y=pos.y, z=pos.z-1} - end - else - if param2 == 0 then - return {x=pos.x+1, y=pos.y, z=pos.z} - elseif param2 == 1 then - return {x=pos.x, y=pos.y, z=pos.z-1} - elseif param2 == 2 then - return {x=pos.x-1, y=pos.y, z=pos.z} - elseif param2 == 3 then - return {x=pos.x, y=pos.y, z=pos.z+1} - end - end -end - -minetest.register_node("default:chest", { - description = "Chest", - tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", - "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, - paramtype2 = "facedir", - stack_max = 64, - groups = {choppy=2,oddly_breakable_by_hand=2, deco_block=1}, - is_ground_content = false, - sounds = default.node_sound_wood_defaults(), - on_construct = function(pos) - local param2 = minetest.get_node(pos).param2 - local meta = minetest.get_meta(pos) - if minetest.get_node(get_chest_neighborpos(pos, param2, "right")).name == "default:chest" then - minetest.set_node(pos, {name="default:chest_right",param2=param2}) - local p = get_chest_neighborpos(pos, param2, "right") - meta:set_string("formspec", - "size[9,11.5]".. - "background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]".. - default.inventory_header.. - "list[nodemeta:"..p.x..","..p.y..","..p.z..";main;0,0.5;9,3;]".. - "list[current_name;main;0,3.5;9,3;]".. - "list[current_player;main;0,7.5;9,3;9]".. - "list[current_player;main;0,10.75;9,1;]".. - "listring[current_player;main]".. - "listring[nodemeta:"..p.x..","..p.y..","..p.z..";main]".. - "listring[current_player;main]".. - "listring[current_name;main]") - minetest.swap_node(p, { name = "default:chest_left", param2 = param2 }) - local m = minetest.get_meta(p) - m:set_string("formspec", - "size[9,11.5]".. - "background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]".. - default.inventory_header.. - "list[current_name;main;0,0.5;9,3;]".. - "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3.5;9,3;]".. - "list[current_player;main;0,7.5;9,3;9]".. - "list[current_player;main;0,10.75;9,1;]".. - "listring[current_player;main]".. - "listring[current_name;main]".. - "listring[current_player;main]".. - "listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main]") - elseif minetest.get_node(get_chest_neighborpos(pos, param2, "left")).name == "default:chest" then - minetest.set_node(pos, {name="default:chest_left",param2=param2}) - local p = get_chest_neighborpos(pos, param2, "left") - meta:set_string("formspec", - "size[9,11.5]".. - "background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]".. - default.inventory_header.. - "list[current_name;main;0,0.5;9,3;]".. - "list[nodemeta:"..p.x..","..p.y..","..p.z..";main;0,3.5;9,3;]".. - "list[current_player;main;0,7.5;9,3;9]".. - "list[current_player;main;0,10.75;9,1;]".. - "listring[current_player;main]".. - "listring[current_name;main]".. - "listring[current_player;main]".. - "listring[nodemeta:"..p.x..","..p.y..","..p.z..";main]") - minetest.swap_node(p, { name = "default:chest_right", param2 = param2 }) - local m = minetest.get_meta(p) - m:set_string("formspec", - "size[9,11.5]".. - "background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]".. - default.inventory_header.. - "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]".. - "list[current_name;main;0,3.5;9,3;]".. - "list[current_player;main;0,7.5;9,3;9]".. - "list[current_player;main;0,10.75;9,1;]".. - "listring[current_player;main]".. - "listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main]".. - "listring[current_player;main]".. - "listring[current_name;main]") - else - meta:set_string("formspec", - "size[9,8.75]".. - "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. - default.inventory_header.. - "list[current_name;main;0,0.5;9,3;]".. - "list[current_player;main;0,4.5;9,3;9]".. - "list[current_player;main;0,7.74;9,1;]".. - "listring[current_name;main]".. - "listring[current_player;main]") - end - local inv = meta:get_inventory() - inv:set_size("main", 9*3) - end, - after_dig_node = function(pos, oldnode, oldmetadata, digger) - local meta = minetest.get_meta(pos) - local meta2 = meta - meta:from_table(oldmetadata) - local inv = meta:get_inventory() - for i=1,inv:get_size("main") do - local stack = inv:get_stack("main", i) - if not stack:is_empty() then - local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} - minetest.add_item(p, stack) - end - end - meta:from_table(meta2:to_table()) - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at "..minetest.pos_to_string(pos)) - end, -}) - -minetest.register_node("default:chest_left", { - tiles = {"default_chest_top_big.png", "default_chest_top_big.png", "default_chest_side.png", - "default_chest_side.png", "default_chest_side_big.png^[transformFX", "default_chest_front_big.png"}, - paramtype2 = "facedir", - groups = {choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, - drop = "default:chest", - is_ground_content = false, - sounds = default.node_sound_wood_defaults(), - on_destruct = function(pos) - local n = minetest.get_node(pos) - if n.name == "default:chest" then - return - end - local param2 = n.param2 - local p = get_chest_neighborpos(pos, param2, "left") - if not p or minetest.get_node(p).name ~= "default:chest_right" then - return - end - local meta = minetest.get_meta(p) - meta:set_string("formspec", - "size[9,8.75]".. - "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. - default.inventory_header.. - "list[current_name;main;0,0.5;9,3;]".. - "list[current_player;main;0,4.5;9,3;9]".. - "list[current_player;main;0,7.74;9,1;]".. - "listring[current_name;main]".. - "listring[current_player;main]") - minetest.swap_node(p, { name = "default:chest", param2 = param2 }) - end, - after_dig_node = function(pos, oldnode, oldmetadata, digger) - local meta = minetest.get_meta(pos) - local meta2 = meta - meta:from_table(oldmetadata) - local inv = meta:get_inventory() - for i=1,inv:get_size("main") do - local stack = inv:get_stack("main", i) - if not stack:is_empty() then - local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} - minetest.add_item(p, stack) - end - end - meta:from_table(meta2:to_table()) - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at "..minetest.pos_to_string(pos)) - end, -}) - -minetest.register_node("default:chest_right", { - tiles = {"default_chest_top_big.png^[transformFX", "default_chest_top_big.png^[transformFX", "default_chest_side.png", - "default_chest_side.png", "default_chest_side_big.png", "default_chest_front_big.png^[transformFX"}, - paramtype2 = "facedir", - groups = {choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, - drop = "default:chest", - is_ground_content = false, - sounds = default.node_sound_wood_defaults(), - on_destruct = function(pos) - local n = minetest.get_node(pos) - if n.name == "default:chest" then - return - end - local param2 = n.param2 - local p = get_chest_neighborpos(pos, param2, "right") - if not p or minetest.get_node(p).name ~= "default:chest_left" then - return - end - local meta = minetest.get_meta(p) - meta:set_string("formspec", - "size[9,8.75]".. - "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. - default.inventory_header.. - "list[current_name;main;0,0.5;9,3;]".. - "list[current_player;main;0,4.5;9,3;9]".. - "list[current_player;main;0,7.74;9,1;]".. - "listring[current_name;main]".. - "listring[current_player;main]") - minetest.swap_node(p, { name = "default:chest", param2 = param2 }) - end, - after_dig_node = function(pos, oldnode, oldmetadata, digger) - local meta = minetest.get_meta(pos) - local meta2 = meta - meta:from_table(oldmetadata) - local inv = meta:get_inventory() - for i=1,inv:get_size("main") do - local stack = inv:get_stack("main", i) - if not stack:is_empty() then - local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} - minetest.add_item(p, stack) - end - end - meta:from_table(meta2:to_table()) - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at "..minetest.pos_to_string(pos)) - end, -}) - - - minetest.register_node("default:cobble", { description = "Cobblestone", tiles = {"default_cobble.png"}, diff --git a/mods/mcl_chests/depends.txt b/mods/mcl_chests/depends.txt new file mode 100644 index 000000000..4ad96d515 --- /dev/null +++ b/mods/mcl_chests/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/mcl_chests/init.lua b/mods/mcl_chests/init.lua new file mode 100644 index 000000000..582e12d8a --- /dev/null +++ b/mods/mcl_chests/init.lua @@ -0,0 +1,260 @@ +local function get_chest_neighborpos(pos, param2, side) + if side == "right" then + if param2 == 0 then + return {x=pos.x-1, y=pos.y, z=pos.z} + elseif param2 == 1 then + return {x=pos.x, y=pos.y, z=pos.z+1} + elseif param2 == 2 then + return {x=pos.x+1, y=pos.y, z=pos.z} + elseif param2 == 3 then + return {x=pos.x, y=pos.y, z=pos.z-1} + end + else + if param2 == 0 then + return {x=pos.x+1, y=pos.y, z=pos.z} + elseif param2 == 1 then + return {x=pos.x, y=pos.y, z=pos.z-1} + elseif param2 == 2 then + return {x=pos.x-1, y=pos.y, z=pos.z} + elseif param2 == 3 then + return {x=pos.x, y=pos.y, z=pos.z+1} + end + end +end + +minetest.register_node("mcl_chests:chest", { + description = "Chest", + tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, + paramtype2 = "facedir", + stack_max = 64, + groups = {choppy=2,oddly_breakable_by_hand=2, deco_block=1}, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), + on_construct = function(pos) + local param2 = minetest.get_node(pos).param2 + local meta = minetest.get_meta(pos) + if minetest.get_node(get_chest_neighborpos(pos, param2, "right")).name == "mcl_chests:chest" then + minetest.set_node(pos, {name="mcl_chests:chest_right",param2=param2}) + local p = get_chest_neighborpos(pos, param2, "right") + meta:set_string("formspec", + "size[9,11.5]".. + "background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]".. + default.inventory_header.. + "list[nodemeta:"..p.x..","..p.y..","..p.z..";main;0,0.5;9,3;]".. + "list[current_name;main;0,3.5;9,3;]".. + "list[current_player;main;0,7.5;9,3;9]".. + "list[current_player;main;0,10.75;9,1;]".. + "listring[current_player;main]".. + "listring[nodemeta:"..p.x..","..p.y..","..p.z..";main]".. + "listring[current_player;main]".. + "listring[current_name;main]") + minetest.swap_node(p, { name = "mcl_chests:chest_left", param2 = param2 }) + local m = minetest.get_meta(p) + m:set_string("formspec", + "size[9,11.5]".. + "background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]".. + default.inventory_header.. + "list[current_name;main;0,0.5;9,3;]".. + "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3.5;9,3;]".. + "list[current_player;main;0,7.5;9,3;9]".. + "list[current_player;main;0,10.75;9,1;]".. + "listring[current_player;main]".. + "listring[current_name;main]".. + "listring[current_player;main]".. + "listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main]") + elseif minetest.get_node(get_chest_neighborpos(pos, param2, "left")).name == "mcl_chests:chest" then + minetest.set_node(pos, {name="mcl_chests:chest_left",param2=param2}) + local p = get_chest_neighborpos(pos, param2, "left") + meta:set_string("formspec", + "size[9,11.5]".. + "background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]".. + default.inventory_header.. + "list[current_name;main;0,0.5;9,3;]".. + "list[nodemeta:"..p.x..","..p.y..","..p.z..";main;0,3.5;9,3;]".. + "list[current_player;main;0,7.5;9,3;9]".. + "list[current_player;main;0,10.75;9,1;]".. + "listring[current_player;main]".. + "listring[current_name;main]".. + "listring[current_player;main]".. + "listring[nodemeta:"..p.x..","..p.y..","..p.z..";main]") + minetest.swap_node(p, { name = "mcl_chests:chest_right", param2 = param2 }) + local m = minetest.get_meta(p) + m:set_string("formspec", + "size[9,11.5]".. + "background[-0.19,-0.25;9.41,12.5;crafting_inventory_chest_large.png]".. + default.inventory_header.. + "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]".. + "list[current_name;main;0,3.5;9,3;]".. + "list[current_player;main;0,7.5;9,3;9]".. + "list[current_player;main;0,10.75;9,1;]".. + "listring[current_player;main]".. + "listring[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main]".. + "listring[current_player;main]".. + "listring[current_name;main]") + else + meta:set_string("formspec", + "size[9,8.75]".. + "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. + default.inventory_header.. + "list[current_name;main;0,0.5;9,3;]".. + "list[current_player;main;0,4.5;9,3;9]".. + "list[current_player;main;0,7.74;9,1;]".. + "listring[current_name;main]".. + "listring[current_player;main]") + end + local inv = meta:get_inventory() + inv:set_size("main", 9*3) + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + local meta = minetest.get_meta(pos) + local meta2 = meta + meta:from_table(oldmetadata) + local inv = meta:get_inventory() + for i=1,inv:get_size("main") do + local stack = inv:get_stack("main", i) + if not stack:is_empty() then + local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} + minetest.add_item(p, stack) + end + end + meta:from_table(meta2:to_table()) + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) + +minetest.register_node("mcl_chests:chest_left", { + tiles = {"default_chest_top_big.png", "default_chest_top_big.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side_big.png^[transformFX", "default_chest_front_big.png"}, + paramtype2 = "facedir", + groups = {choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + drop = "mcl_chests:chest", + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), + on_destruct = function(pos) + local n = minetest.get_node(pos) + if n.name == "mcl_chests:chest" then + return + end + local param2 = n.param2 + local p = get_chest_neighborpos(pos, param2, "left") + if not p or minetest.get_node(p).name ~= "mcl_chests:chest_right" then + return + end + local meta = minetest.get_meta(p) + meta:set_string("formspec", + "size[9,8.75]".. + "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. + default.inventory_header.. + "list[current_name;main;0,0.5;9,3;]".. + "list[current_player;main;0,4.5;9,3;9]".. + "list[current_player;main;0,7.74;9,1;]".. + "listring[current_name;main]".. + "listring[current_player;main]") + minetest.swap_node(p, { name = "mcl_chests:chest", param2 = param2 }) + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + local meta = minetest.get_meta(pos) + local meta2 = meta + meta:from_table(oldmetadata) + local inv = meta:get_inventory() + for i=1,inv:get_size("main") do + local stack = inv:get_stack("main", i) + if not stack:is_empty() then + local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} + minetest.add_item(p, stack) + end + end + meta:from_table(meta2:to_table()) + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) + +minetest.register_node("mcl_chests:chest_right", { + tiles = {"default_chest_top_big.png^[transformFX", "default_chest_top_big.png^[transformFX", "default_chest_side.png", + "default_chest_side.png", "default_chest_side_big.png", "default_chest_front_big.png^[transformFX"}, + paramtype2 = "facedir", + groups = {choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + drop = "mcl_chests:chest", + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), + on_destruct = function(pos) + local n = minetest.get_node(pos) + if n.name == "mcl_chests:chest" then + return + end + local param2 = n.param2 + local p = get_chest_neighborpos(pos, param2, "right") + if not p or minetest.get_node(p).name ~= "mcl_chests:chest_left" then + return + end + local meta = minetest.get_meta(p) + meta:set_string("formspec", + "size[9,8.75]".. + "background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]".. + default.inventory_header.. + "list[current_name;main;0,0.5;9,3;]".. + "list[current_player;main;0,4.5;9,3;9]".. + "list[current_player;main;0,7.74;9,1;]".. + "listring[current_name;main]".. + "listring[current_player;main]") + minetest.swap_node(p, { name = "mcl_chests:chest", param2 = param2 }) + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + local meta = minetest.get_meta(pos) + local meta2 = meta + meta:from_table(oldmetadata) + local inv = meta:get_inventory() + for i=1,inv:get_size("main") do + local stack = inv:get_stack("main", i) + if not stack:is_empty() then + local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} + minetest.add_item(p, stack) + end + end + meta:from_table(meta2:to_table()) + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) + +minetest.register_craft({ + output = 'mcl_chests:chest', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', '', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) \ No newline at end of file diff --git a/mods/default/textures/default_chest_bg.png b/mods/mcl_chests/textures/default_chest_bg.png similarity index 100% rename from mods/default/textures/default_chest_bg.png rename to mods/mcl_chests/textures/default_chest_bg.png diff --git a/mods/default/textures/default_chest_front.png b/mods/mcl_chests/textures/default_chest_front.png similarity index 100% rename from mods/default/textures/default_chest_front.png rename to mods/mcl_chests/textures/default_chest_front.png diff --git a/mods/default/textures/default_chest_front_big.png b/mods/mcl_chests/textures/default_chest_front_big.png similarity index 100% rename from mods/default/textures/default_chest_front_big.png rename to mods/mcl_chests/textures/default_chest_front_big.png diff --git a/mods/default/textures/default_chest_side.png b/mods/mcl_chests/textures/default_chest_side.png similarity index 100% rename from mods/default/textures/default_chest_side.png rename to mods/mcl_chests/textures/default_chest_side.png diff --git a/mods/default/textures/default_chest_side_big.png b/mods/mcl_chests/textures/default_chest_side_big.png similarity index 100% rename from mods/default/textures/default_chest_side_big.png rename to mods/mcl_chests/textures/default_chest_side_big.png diff --git a/mods/default/textures/default_chest_top.png b/mods/mcl_chests/textures/default_chest_top.png similarity index 100% rename from mods/default/textures/default_chest_top.png rename to mods/mcl_chests/textures/default_chest_top.png diff --git a/mods/default/textures/default_chest_top_big.png b/mods/mcl_chests/textures/default_chest_top_big.png similarity index 100% rename from mods/default/textures/default_chest_top_big.png rename to mods/mcl_chests/textures/default_chest_top_big.png diff --git a/mods/mcl_hoppers/init.lua b/mods/mcl_hoppers/init.lua index b262e14ef..7385fe5b5 100644 --- a/mods/mcl_hoppers/init.lua +++ b/mods/mcl_hoppers/init.lua @@ -1,6 +1,6 @@ -local chest = minetest.get_content_id("default:chest") +local chest = minetest.get_content_id("mcl_chests:chest") local mcl_hoppers_formspec = "size[9,7]".. @@ -156,7 +156,7 @@ minetest.register_abm({ minetest.register_abm({ nodenames = {"mcl_hoppers:hopper"}, - neighbors = {"default:chest","default:chest_left","default:chest_right","mcl_hoppers:hopper","mcl_hoppers:hopper_side","default:furnace","default:furnace_active"}, + neighbors = {"mcl_chests:chest","mcl_chests:chest_left","mcl_chests:chest_right","mcl_hoppers:hopper","mcl_hoppers:hopper_side","mcl_furnaces:furnace","mcl_furnaces:furnace_active"}, interval = 1.0, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) @@ -172,7 +172,7 @@ minetest.register_abm({ local b = vm:get_node_at({x=pos.x,y=pos.y+1,z=pos.z}).name --the mcl_hoppers input - if b == "default:chest" then + if b == "mcl_chests:chest" then --mcl_hoppers inventory local meta = minetest.get_meta(pos); local inv = meta:get_inventory() @@ -203,7 +203,7 @@ minetest.register_abm({ end end end - if b == "default:furnace" or b == "default:furnace_active" then + if b == "mcl_furnaces:furnace" or b == "mcl_furnaces:furnace_active" then --mcl_hoppers inventory local meta = minetest.get_meta(pos); local inv = meta:get_inventory() @@ -237,7 +237,7 @@ minetest.register_abm({ end --the mcl_hoppers output - if a == "default:chest" or a == "default:chest_left" or a == "default:chest_right" or a == "mcl_hoppers:hopper" or a == "mcl_hoppers:hopper_side" then + if a == "mcl_chests:chest" or a == "mcl_chests:chest_left" or a == "mcl_chests:chest_right" or a == "mcl_hoppers:hopper" or a == "mcl_hoppers:hopper_side" then --mcl_hoppers inventory local meta = minetest.get_meta(pos); local inv = meta:get_inventory() @@ -311,7 +311,7 @@ minetest.register_abm({ minetest.register_abm({ nodenames = {"mcl_hoppers:hopper_side"}, - neighbors = {"default:chest","default:chest_left","default_chest_right","mcl_hoppers:hopper","mcl_hoppers:hopper_side","default:furnace","default:furnace_active"}, + neighbors = {"mcl_chests:chest","mcl_chests:chest_left","mcl_chests:chest_right","mcl_hoppers:hopper","mcl_hoppers:hopper_side","mcl_furnaces:furnace","mcl_furnaces:furnace_active"}, interval = 1.0, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) @@ -338,7 +338,7 @@ minetest.register_abm({ local b = vm:get_node_at({x=pos.x,y=pos.y+1,z=pos.z}).name --the mcl_hoppers input - if b == "default:chest" or b == "default:chest_left" or b == "default:chest_right" then + if b == "mcl_chests:chest" or b == "mcl_chests:chest_left" or b == "mcl_chests:chest_right" then --mcl_hoppers inventory local meta = minetest.get_meta(pos); local inv = meta:get_inventory() @@ -402,7 +402,7 @@ minetest.register_abm({ end --the mcl_hoppers output - if a == "default:chest" or a == "default:chest_left" or "default:chest_right" or a == "mcl_hoppers:hopper" or a == "mcl_hoppers:hopper_side" then + if a == "mcl_chests:chest" or a == "mcl_chests:chest_left" or "mcl_chests:chest_right" or a == "mcl_hoppers:hopper" or a == "mcl_hoppers:hopper_side" then --print("test") --room_for_item(listname, stack) --mcl_hoppers inventory @@ -520,7 +520,7 @@ minetest.register_craft({ output = "mcl_hoppers:hopper_item", recipe = { {"default:steel_ingot","","default:steel_ingot"}, - {"default:steel_ingot","default:chest","default:steel_ingot"}, + {"default:steel_ingot","mcl_chests:chest","default:steel_ingot"}, {"","default:steel_ingot",""}, } }) diff --git a/mods/redstone/mesecons_mvps/init.lua b/mods/redstone/mesecons_mvps/init.lua index a416039c1..25faa05e6 100644 --- a/mods/redstone/mesecons_mvps/init.lua +++ b/mods/redstone/mesecons_mvps/init.lua @@ -123,10 +123,10 @@ function mesecon:mvps_pull_all(pos, direction) -- pos: pos of mvps; direction: d minetest.remove_node(oldpos) end -mesecon:register_mvps_stopper("default:chest") -mesecon:register_mvps_stopper("default:chest_left") -mesecon:register_mvps_stopper("default:chest_right") -mesecon:register_mvps_stopper("default:furnace") +mesecon:register_mvps_stopper("mcl_chests:chest") +mesecon:register_mvps_stopper("mcl_chests:chest_left") +mesecon:register_mvps_stopper("mcl_chests:chest_right") +mesecon:register_mvps_stopper("mcl_furnaces:furnace") mesecon:register_mvps_stopper("default:sign") mesecon:register_mvps_stopper("default:obsidian") mesecon:register_mvps_stopper("default:bedrock")