diff --git a/mods/ctf_team_chest/init.lua b/mods/ctf_team_chest/init.lua index afe8fd1..ca2365b 100644 --- a/mods/ctf_team_chest/init.lua +++ b/mods/ctf_team_chest/init.lua @@ -10,40 +10,47 @@ local chest_formspec = "listring[current_player;main]" .. default.get_hotbar_bg(0,4.85) -minetest.register_node("ctf_team_chest: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", - groups = {choppy = 2, oddly_breakable_by_hand = 2}, - legacy_facedir_simple = true, - is_ground_content = false, - sounds = default.node_sound_wood_defaults(), - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", chest_formspec) - meta:set_string("infotext", "Chest") - local inv = meta:get_inventory() - inv:set_size("main", 8*4) - end, - can_dig = function(pos,player) - return false - 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 -}) - +local colors = {"red", "blue"} +for _, color in pairs(colors) do + minetest.register_node("ctf_team_chest:chest_" .. color, { + description = "Chest", + tiles = { + "default_chest_top_" .. color .. ".png", + "default_chest_top_" .. color .. ".png", + "default_chest_side_" .. color .. ".png", + "default_chest_side_" .. color .. ".png", + "default_chest_side_" .. color .. ".png", + "default_chest_front_" .. color .. ".png"}, + paramtype2 = "facedir", + groups = {choppy = 2, oddly_breakable_by_hand = 2}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", chest_formspec) + meta:set_string("infotext", "Chest") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + return false + 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 + }) +end minetest.register_on_generated(function(minp, maxp, seed) for tname, team in pairs(ctf.teams) do @@ -52,7 +59,7 @@ minetest.register_on_generated(function(minp, maxp, seed) minp.y <= flag.y and maxp.y >= flag.y and minp.z <= flag.z and maxp.z >= flag.z then - local chest = {name = "ctf_team_chest:chest"} + local chest = {name = "ctf_team_chest:chest_" .. team.data.color} local dz = 2 if flag.z < 0 then dz = -2 diff --git a/mods/ctf_team_chest/textures/default_chest_front_blue.png b/mods/ctf_team_chest/textures/default_chest_front_blue.png new file mode 100644 index 0000000..3dabef4 Binary files /dev/null and b/mods/ctf_team_chest/textures/default_chest_front_blue.png differ diff --git a/mods/ctf_team_chest/textures/default_chest_front_red.png b/mods/ctf_team_chest/textures/default_chest_front_red.png new file mode 100644 index 0000000..02305af Binary files /dev/null and b/mods/ctf_team_chest/textures/default_chest_front_red.png differ diff --git a/mods/ctf_team_chest/textures/default_chest_side_blue.png b/mods/ctf_team_chest/textures/default_chest_side_blue.png new file mode 100644 index 0000000..584b81b Binary files /dev/null and b/mods/ctf_team_chest/textures/default_chest_side_blue.png differ diff --git a/mods/ctf_team_chest/textures/default_chest_side_red.png b/mods/ctf_team_chest/textures/default_chest_side_red.png new file mode 100644 index 0000000..066aa80 Binary files /dev/null and b/mods/ctf_team_chest/textures/default_chest_side_red.png differ diff --git a/mods/ctf_team_chest/textures/default_chest_top_blue.png b/mods/ctf_team_chest/textures/default_chest_top_blue.png new file mode 100644 index 0000000..75ce5eb Binary files /dev/null and b/mods/ctf_team_chest/textures/default_chest_top_blue.png differ diff --git a/mods/ctf_team_chest/textures/default_chest_top_red.png b/mods/ctf_team_chest/textures/default_chest_top_red.png new file mode 100644 index 0000000..5bc699b Binary files /dev/null and b/mods/ctf_team_chest/textures/default_chest_top_red.png differ diff --git a/mods/default/textures/default_chest_lock.png b/mods/default/textures/default_chest_lock.png deleted file mode 100644 index 73f46c7..0000000 Binary files a/mods/default/textures/default_chest_lock.png and /dev/null differ diff --git a/mods/tsm_chests/init.lua b/mods/tsm_chests/init.lua index 141a4ff..bde97b8 100644 --- a/mods/tsm_chests/init.lua +++ b/mods/tsm_chests/init.lua @@ -39,11 +39,9 @@ minetest.register_node("tsm_chests:chest", { sounds = default.node_sound_wood_defaults(), allow_metadata_inventory_put = function(pos, listname, index, stack, player) if player then - minetest.chat_send_player(player:get_player_name(), "You're not allowed to put things in chests!") + minetest.chat_send_player(player:get_player_name(), + "You're not allowed to put things in treasure chests!") return 0 - else - --minetest.chat_send_all("Error! Non player putting things in chests") - return -1 end end, on_construct = function(pos) diff --git a/mods/default/textures/default_chest_front.png b/mods/tsm_chests/textures/default_chest_front.png similarity index 100% rename from mods/default/textures/default_chest_front.png rename to mods/tsm_chests/textures/default_chest_front.png diff --git a/mods/default/textures/default_chest_side.png b/mods/tsm_chests/textures/default_chest_side.png similarity index 100% rename from mods/default/textures/default_chest_side.png rename to mods/tsm_chests/textures/default_chest_side.png diff --git a/mods/default/textures/default_chest_top.png b/mods/tsm_chests/textures/default_chest_top.png similarity index 100% rename from mods/default/textures/default_chest_top.png rename to mods/tsm_chests/textures/default_chest_top.png