From 2a07b2d18faa832de6c23c2ac1490a8e00b13e36 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 1 Dec 2015 00:38:30 +0000 Subject: [PATCH] Make team chests the color of the team --- mods/ctf_team_chest/init.lua | 77 ++++++++++-------- .../textures/default_chest_front_blue.png | Bin 0 -> 625 bytes .../textures/default_chest_front_red.png | Bin 0 -> 614 bytes .../textures/default_chest_side_blue.png | Bin 0 -> 564 bytes .../textures/default_chest_side_red.png | Bin 0 -> 556 bytes .../textures/default_chest_top_blue.png | Bin 0 -> 593 bytes .../textures/default_chest_top_red.png | Bin 0 -> 587 bytes mods/default/textures/default_chest_lock.png | Bin 469 -> 0 bytes mods/tsm_chests/init.lua | 6 +- .../textures/default_chest_front.png | Bin .../textures/default_chest_side.png | Bin .../textures/default_chest_top.png | Bin 12 files changed, 44 insertions(+), 39 deletions(-) create mode 100644 mods/ctf_team_chest/textures/default_chest_front_blue.png create mode 100644 mods/ctf_team_chest/textures/default_chest_front_red.png create mode 100644 mods/ctf_team_chest/textures/default_chest_side_blue.png create mode 100644 mods/ctf_team_chest/textures/default_chest_side_red.png create mode 100644 mods/ctf_team_chest/textures/default_chest_top_blue.png create mode 100644 mods/ctf_team_chest/textures/default_chest_top_red.png delete mode 100644 mods/default/textures/default_chest_lock.png rename mods/{default => tsm_chests}/textures/default_chest_front.png (100%) rename mods/{default => tsm_chests}/textures/default_chest_side.png (100%) rename mods/{default => tsm_chests}/textures/default_chest_top.png (100%) 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 0000000000000000000000000000000000000000..3dabef4c1aab7f834f9a0cdf4815ad337af8307e GIT binary patch literal 625 zcmV-%0*?KOP)763fO_YV6e?UjH(QJ2%M(Xi9~ z`4s^BuhNZM01A`CIWPu*2B%zyLTVXQP1=(|l?ml6wRbiofMlU@t+D8w%T3YTdh_VP zy@yXfPFD2#rO9WTZ`ZC~C+n18@0u?Gh^W5IggQ3S(V$?Ab^AlVl6?O5WA(zhyX$kC zAKI6fX6lJ|emXott-ZS?0jSDk62}0#LzbT+qa1MiC2mek2koHcq-Z2-FOD%LT#%!J* z4?98!NgPWrECB$F3mSH^--ld!Tn9o2Tu8>ab46i|$HiZ9XEyx@+2+#@T@kli00000 LNkvXXu0mjf*+vN_ literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..02305af6c75c21cf32934c35cb6132b2e7aaca52 GIT binary patch literal 614 zcmV-s0-61ZP)j zK~yNuosvyU8(|cM&-*oB&W8!64#o(Df?^gf+z4H?%Od`Q{ts9F5!d|z;!0?7XS*n3 zp{QV8h(e_Vl7>tYCo}h*_w8aryS8V0c{ul+d)d1*#d9P9ylJ%(DKo7XgaAO+)-%PJ zU`%rE2?0Pd_Tk|{0!XA>k7Mb&UYY`^o}Q}NOhu6lL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;dgfuMi}B^@X+q?^&zVPH u&^CnMT?e2b>iXUijZEJU|7FmdoBj&{Q@k=fC0eWi0000%n*R*Z{C@5?%kGb1wfgcnS zOgYcmMZ36Iv=+dz4?{?my{L0-wKOCFgvg)1r^&&)ZFPEnev(&~GOYkGb6e=#D618K zOv~%r{czk)z|)tn+Cnc^uImSznaWb{(|BiNF zFvU8Xp8(jou-XrXq_dHf)Jl+&Sz;d&DY0C+$st8QE43Tq=IFimF==K90YkFLD8vMS z8CJ{xfbWZp49T|8Q~yc=7+V{Q1Musin}E&Dm(OI%*_roV>xuE+a|}XJQ`*sCeRnef zN?Re7+pW9JZ>2LyW{eyF4}5=k(6(yoit>5_LVq~^`Ida&ZSKbBQ`!neLP!893;_1^ flTk%H_PzfBuWji{(7b_|00000NkvXXu0mjf5n2(Q literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..5bc699b57456f188b682c089e31a67a2f9672077 GIT binary patch literal 587 zcmV-R0<`^!P)?C8~pgBkvIa@E%gJhp{2^{g5KM zpn8B{3CssPJV1QAy~SsO06g5?&5SuZXNdr0N-^`%dn2V3B9YQaSxu+yPqFe?GQbtF3qathbYJkPalU4KY$ zo(v(wjJkwUVo50a8i}pw7PnfbP?unvz=vBQjzdT%^Y5WrZN2=?)vE9Nn^kk4O+BxW z&T6L^bts{$4D~S)P}eN%+kNse%wn2hF{)00000 LNkvXXu0mjfS`O4= 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