From 6d73ca3f9f66226f64752d87196be7d4f417c1eb Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sun, 10 Aug 2014 11:47:44 -0400 Subject: [PATCH] Added more metal sign colors Red w/white border (e.g. "Stop" or similar), white w/red border (e.g. "Yield", "Do not enter", and similar), white w/black border (speed limit, other info signs) renamed and simplified their edge/top/bottom textures since they always have metal edges anyways (made them all use the same files). Simplified the code that creates them. Minor changes to the code that places them to facilitate this expansion (also allows for future expansion if necessary). --- signs_lib/init.lua | 166 ++++++++++-------- signs_lib/textures/signs_green_bottom.png | Bin 82 -> 0 bytes signs_lib/textures/signs_green_sides.png | Bin 82 -> 0 bytes signs_lib/textures/signs_green_top.png | Bin 82 -> 0 bytes ...ns_back_metal.png => signs_metal_back.png} | Bin ...yellow_sides.png => signs_metal_sides.png} | Bin ...s_yellow_bottom.png => signs_metal_tb.png} | Bin signs_lib/textures/signs_red_front.png | Bin 0 -> 135 bytes signs_lib/textures/signs_red_inv.png | Bin 0 -> 115 bytes .../textures/signs_white_black_front.png | Bin 0 -> 132 bytes signs_lib/textures/signs_white_black_inv.png | Bin 0 -> 101 bytes signs_lib/textures/signs_white_red_front.png | Bin 0 -> 137 bytes signs_lib/textures/signs_white_red_inv.png | Bin 0 -> 116 bytes signs_lib/textures/signs_yellow_top.png | Bin 82 -> 0 bytes 14 files changed, 91 insertions(+), 75 deletions(-) delete mode 100644 signs_lib/textures/signs_green_bottom.png delete mode 100644 signs_lib/textures/signs_green_sides.png delete mode 100644 signs_lib/textures/signs_green_top.png rename signs_lib/textures/{signs_back_metal.png => signs_metal_back.png} (100%) rename signs_lib/textures/{signs_yellow_sides.png => signs_metal_sides.png} (100%) rename signs_lib/textures/{signs_yellow_bottom.png => signs_metal_tb.png} (100%) create mode 100644 signs_lib/textures/signs_red_front.png create mode 100644 signs_lib/textures/signs_red_inv.png create mode 100644 signs_lib/textures/signs_white_black_front.png create mode 100644 signs_lib/textures/signs_white_black_inv.png create mode 100644 signs_lib/textures/signs_white_red_front.png create mode 100644 signs_lib/textures/signs_white_red_inv.png delete mode 100644 signs_lib/textures/signs_yellow_top.png diff --git a/signs_lib/init.lua b/signs_lib/init.lua index 23c4927e..04ff60b9 100644 --- a/signs_lib/init.lua +++ b/signs_lib/init.lua @@ -512,9 +512,7 @@ signs_lib.update_sign = function(pos, fields) sign_info = signs_lib.yard_sign_model.textpos[minetest.get_node(pos).param2 + 1] elseif signnode.name == "signs:sign_hanging" then sign_info = signs_lib.hanging_sign_model.textpos[minetest.get_node(pos).param2 + 1] - elseif signnode.name == "default:sign_wall" - or signnode.name == "signs:sign_wall_green" - or signnode.name == "signs:sign_wall_yellow" then + elseif string.find(signnode.name, "sign_wall") then sign_info = signs_lib.wall_sign_model.textpos[minetest.get_node(pos).param2 + 1] else -- ...it must be a sign on a fence post. sign_info = signs_lib.sign_post_model.textpos[minetest.get_node(pos).param2 + 1] @@ -593,7 +591,7 @@ function signs_lib.determine_sign_type(itemstack, placer, pointed_thing) minetest.add_node(above, {name = "signs:sign_yard", param2 = fdir}) sign_info = signs_lib.yard_sign_model.textpos[fdir + 1] - else + else -- it must be a wooden or metal wall sign. minetest.add_node(above, {name = signname, param2 = fdir}) sign_info = signs_lib.wall_sign_model.textpos[fdir + 1] end @@ -743,77 +741,47 @@ minetest.register_node(":signs:sign_post", { }, }) -minetest.register_node(":signs:sign_wall_green", { - description = S("Sign (green, metal)"), - inventory_image = "signs_green_inv.png", - wield_image = "signs_green_inv.png", - node_placement_prediction = "", - paramtype = "light", - sunlight_propagates = true, - paramtype2 = "facedir", - drawtype = "nodebox", - node_box = signs_lib.wall_sign_model.nodebox, - tiles = { - "signs_green_top.png", - "signs_green_bottom.png", - "signs_green_sides.png", - "signs_green_sides.png", - "signs_back_metal.png", - "signs_green_front.png" - }, - groups = sign_groups, - on_place = function(itemstack, placer, pointed_thing) - return signs_lib.determine_sign_type(itemstack, placer, pointed_thing) - end, - on_construct = function(pos) - signs_lib.construct_sign(pos) - end, - on_destruct = function(pos) - signs_lib.destruct_sign(pos) - end, - on_receive_fields = function(pos, formname, fields, sender) - signs_lib.receive_fields(pos, formname, fields, sender) - end, - on_punch = function(pos, node, puncher) - signs_lib.update_sign(pos) - end, -}) +-- metal, colored signs -minetest.register_node(":signs:sign_wall_yellow", { - description = S("Sign (yellow, metal)"), - inventory_image = "signs_yellow_inv.png", - wield_image = "signs_yellow_inv.png", - node_placement_prediction = "", - paramtype = "light", - sunlight_propagates = true, - paramtype2 = "facedir", - drawtype = "nodebox", - node_box = signs_lib.wall_sign_model.nodebox, - tiles = { - "signs_yellow_top.png", - "signs_yellow_bottom.png", - "signs_yellow_sides.png", - "signs_yellow_sides.png", - "signs_back_metal.png", - "signs_yellow_front.png" - }, - groups = sign_groups, - on_place = function(itemstack, placer, pointed_thing) - return signs_lib.determine_sign_type(itemstack, placer, pointed_thing) - end, - on_construct = function(pos) - signs_lib.construct_sign(pos) - end, - on_destruct = function(pos) - signs_lib.destruct_sign(pos) - end, - on_receive_fields = function(pos, formname, fields, sender) - signs_lib.receive_fields(pos, formname, fields, sender) - end, - on_punch = function(pos, node, puncher) - signs_lib.update_sign(pos) - end, -}) +local sign_colors = { "green", "yellow", "red", "white_red", "white_black" } + +for _, color in ipairs(sign_colors) do + minetest.register_node(":signs:sign_wall_"..color, { + description = S("Sign ("..color..", metal)"), + inventory_image = "signs_"..color.."_inv.png", + wield_image = "signs_"..color.."_inv.png", + node_placement_prediction = "", + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = signs_lib.wall_sign_model.nodebox, + tiles = { + "signs_metal_tb.png", + "signs_metal_tb.png", + "signs_metal_sides.png", + "signs_metal_sides.png", + "signs_metal_back.png", + "signs_"..color.."_front.png" + }, + groups = sign_groups, + on_place = function(itemstack, placer, pointed_thing) + return signs_lib.determine_sign_type(itemstack, placer, pointed_thing) + end, + on_construct = function(pos) + signs_lib.construct_sign(pos) + end, + on_destruct = function(pos) + signs_lib.destruct_sign(pos) + end, + on_receive_fields = function(pos, formname, fields, sender) + signs_lib.receive_fields(pos, formname, fields, sender) + end, + on_punch = function(pos, node, puncher) + signs_lib.update_sign(pos) + end, + }) +end local signs_text_on_activate @@ -925,7 +893,7 @@ minetest.register_abm({ end }) --- craft recipes for the green and yellow signs +-- craft recipes for the metal signs minetest.register_craft( { output = "signs:sign_wall_green 4", @@ -959,6 +927,54 @@ minetest.register_craft( { }, }) +minetest.register_craft( { + output = "signs:sign_wall_red 4", + recipe = { + { "dye:red", "dye:white", "dye:red" }, + { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" } + }, +}) + +minetest.register_craft( { + output = "signs:sign_wall_red 2", + recipe = { + { "dye:red", "dye:white", "dye:red" }, + { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } + }, +}) + +minetest.register_craft( { + output = "signs:sign_wall_white_red 4", + recipe = { + { "dye:white", "dye:red", "dye:white" }, + { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" } + }, +}) + +minetest.register_craft( { + output = "signs:sign_wall_white_red 2", + recipe = { + { "dye:white", "dye:red", "dye:white" }, + { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } + }, +}) + +minetest.register_craft( { + output = "signs:sign_wall_white_black 4", + recipe = { + { "dye:white", "dye:black", "dye:white" }, + { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" } + }, +}) + +minetest.register_craft( { + output = "signs:sign_wall_white_black 2", + recipe = { + { "dye:white", "dye:black", "dye:white" }, + { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } + }, +}) + if minetest.setting_get("log_mods") then minetest.log("action", S("signs loaded")) end diff --git a/signs_lib/textures/signs_green_bottom.png b/signs_lib/textures/signs_green_bottom.png deleted file mode 100644 index b235befb9c6360fdf95dcc0f4b04d9738e93d049..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 82 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|lAbP(AsXkCHIxMnA|`OSnf7E! dSnw`U%V&6}v)^&&fvq4#44$rjF6*2UngD`F6HfpD diff --git a/signs_lib/textures/signs_green_sides.png b/signs_lib/textures/signs_green_sides.png deleted file mode 100644 index 928507d51e3ff367ac25384fec39b50a86f5afe2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 82 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|lAbP(AsXkCHMF%iD@ZYj8uw&L eTs5dMWng%xv)@toht++cA_h-aKbLh*2~7Zg{u3Pl diff --git a/signs_lib/textures/signs_green_top.png b/signs_lib/textures/signs_green_top.png deleted file mode 100644 index b235befb9c6360fdf95dcc0f4b04d9738e93d049..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 82 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|lAbP(AsXkCHIxMnA|`OSnf7E! dSnw`U%V&6}v)^&&fvq4#44$rjF6*2UngD`F6HfpD diff --git a/signs_lib/textures/signs_back_metal.png b/signs_lib/textures/signs_metal_back.png similarity index 100% rename from signs_lib/textures/signs_back_metal.png rename to signs_lib/textures/signs_metal_back.png diff --git a/signs_lib/textures/signs_yellow_sides.png b/signs_lib/textures/signs_metal_sides.png similarity index 100% rename from signs_lib/textures/signs_yellow_sides.png rename to signs_lib/textures/signs_metal_sides.png diff --git a/signs_lib/textures/signs_yellow_bottom.png b/signs_lib/textures/signs_metal_tb.png similarity index 100% rename from signs_lib/textures/signs_yellow_bottom.png rename to signs_lib/textures/signs_metal_tb.png diff --git a/signs_lib/textures/signs_red_front.png b/signs_lib/textures/signs_red_front.png new file mode 100644 index 0000000000000000000000000000000000000000..dce72ce8ae7279aa2afb3839368a264e17a336b4 GIT binary patch literal 135 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={W{5)M8Lp+WrZ`rURVS#Ew(gH(? zUt${^Ry;o5AAC2%+uOT^m4}Dtwu|e^j9u4XUtc`YChOn|*2Q8yQ3hFze^>iFvFg~> gP`D-51SHJE;I7TNb-LkeN1(|Jp00i_>zopr06a`DX8-^I literal 0 HcmV?d00001 diff --git a/signs_lib/textures/signs_red_inv.png b/signs_lib/textures/signs_red_inv.png new file mode 100644 index 0000000000000000000000000000000000000000..12b9ed1cc6c9475059d001e95ddb334c5226cc89 GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`R-P`7Ar_~T6C^SYoH%gcz=!`p zkdm2}l9JL`xUI8m(vq96zh<+6fST7{gRBD^3>qFyIbraHkzu_txA^hGAAvwq7(8A5 KT-G@yGywoEAt@&S literal 0 HcmV?d00001 diff --git a/signs_lib/textures/signs_white_black_front.png b/signs_lib/textures/signs_white_black_front.png new file mode 100644 index 0000000000000000000000000000000000000000..10ecca00711ab545b570170bd36eba08f90bac5a GIT binary patch literal 132 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={WyggkULp+WrZ`rURVS#Ew(gH(? zUt${^RtT&61>DW>c(dui&;S4bFJJVsr>AG}M4POGD_9qc^+XwDG5%fc^TeuSS3}{J eSQC&i55xI>_8B%Q_i}*7GI+ZBxvXWB literal 0 HcmV?d00001 diff --git a/signs_lib/textures/signs_white_black_inv.png b/signs_lib/textures/signs_white_black_inv.png new file mode 100644 index 0000000000000000000000000000000000000000..e370dad9d5f58bb6577624f4c4b53da6d5a1373c GIT binary patch literal 101 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`I-V|$Ar_~T6C^SYa4h{ldG&nO yW552-H!+rwR4g+NeAODr+}6q{vfQO@AwNU20jv0HNIFi(i%p1udRvlXY+f>teB#Hr!*EWnQyD?`8ilqlMMvay!IMo9oS&dz-pV=