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).
This commit is contained in:
Vanessa Ezekowitz 2014-08-10 11:47:44 -04:00
parent 03902e5392
commit 6d73ca3f9f
14 changed files with 91 additions and 75 deletions

View File

@ -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] sign_info = signs_lib.yard_sign_model.textpos[minetest.get_node(pos).param2 + 1]
elseif signnode.name == "signs:sign_hanging" then elseif signnode.name == "signs:sign_hanging" then
sign_info = signs_lib.hanging_sign_model.textpos[minetest.get_node(pos).param2 + 1] sign_info = signs_lib.hanging_sign_model.textpos[minetest.get_node(pos).param2 + 1]
elseif signnode.name == "default:sign_wall" elseif string.find(signnode.name, "sign_wall") then
or signnode.name == "signs:sign_wall_green"
or signnode.name == "signs:sign_wall_yellow" then
sign_info = signs_lib.wall_sign_model.textpos[minetest.get_node(pos).param2 + 1] sign_info = signs_lib.wall_sign_model.textpos[minetest.get_node(pos).param2 + 1]
else -- ...it must be a sign on a fence post. else -- ...it must be a sign on a fence post.
sign_info = signs_lib.sign_post_model.textpos[minetest.get_node(pos).param2 + 1] 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}) minetest.add_node(above, {name = "signs:sign_yard", param2 = fdir})
sign_info = signs_lib.yard_sign_model.textpos[fdir + 1] 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}) minetest.add_node(above, {name = signname, param2 = fdir})
sign_info = signs_lib.wall_sign_model.textpos[fdir + 1] sign_info = signs_lib.wall_sign_model.textpos[fdir + 1]
end end
@ -743,77 +741,47 @@ minetest.register_node(":signs:sign_post", {
}, },
}) })
minetest.register_node(":signs:sign_wall_green", { -- metal, colored signs
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,
})
minetest.register_node(":signs:sign_wall_yellow", { local sign_colors = { "green", "yellow", "red", "white_red", "white_black" }
description = S("Sign (yellow, metal)"),
inventory_image = "signs_yellow_inv.png", for _, color in ipairs(sign_colors) do
wield_image = "signs_yellow_inv.png", minetest.register_node(":signs:sign_wall_"..color, {
node_placement_prediction = "", description = S("Sign ("..color..", metal)"),
paramtype = "light", inventory_image = "signs_"..color.."_inv.png",
sunlight_propagates = true, wield_image = "signs_"..color.."_inv.png",
paramtype2 = "facedir", node_placement_prediction = "",
drawtype = "nodebox", paramtype = "light",
node_box = signs_lib.wall_sign_model.nodebox, sunlight_propagates = true,
tiles = { paramtype2 = "facedir",
"signs_yellow_top.png", drawtype = "nodebox",
"signs_yellow_bottom.png", node_box = signs_lib.wall_sign_model.nodebox,
"signs_yellow_sides.png", tiles = {
"signs_yellow_sides.png", "signs_metal_tb.png",
"signs_back_metal.png", "signs_metal_tb.png",
"signs_yellow_front.png" "signs_metal_sides.png",
}, "signs_metal_sides.png",
groups = sign_groups, "signs_metal_back.png",
on_place = function(itemstack, placer, pointed_thing) "signs_"..color.."_front.png"
return signs_lib.determine_sign_type(itemstack, placer, pointed_thing) },
end, groups = sign_groups,
on_construct = function(pos) on_place = function(itemstack, placer, pointed_thing)
signs_lib.construct_sign(pos) return signs_lib.determine_sign_type(itemstack, placer, pointed_thing)
end, end,
on_destruct = function(pos) on_construct = function(pos)
signs_lib.destruct_sign(pos) signs_lib.construct_sign(pos)
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_destruct = function(pos)
signs_lib.receive_fields(pos, formname, fields, sender) signs_lib.destruct_sign(pos)
end, end,
on_punch = function(pos, node, puncher) on_receive_fields = function(pos, formname, fields, sender)
signs_lib.update_sign(pos) signs_lib.receive_fields(pos, formname, fields, sender)
end, end,
}) on_punch = function(pos, node, puncher)
signs_lib.update_sign(pos)
end,
})
end
local signs_text_on_activate local signs_text_on_activate
@ -925,7 +893,7 @@ minetest.register_abm({
end end
}) })
-- craft recipes for the green and yellow signs -- craft recipes for the metal signs
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_green 4", 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 if minetest.setting_get("log_mods") then
minetest.log("action", S("signs loaded")) minetest.log("action", S("signs loaded"))
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

View File

Before

Width:  |  Height:  |  Size: 93 B

After

Width:  |  Height:  |  Size: 93 B

View File

Before

Width:  |  Height:  |  Size: 87 B

After

Width:  |  Height:  |  Size: 87 B

View File

Before

Width:  |  Height:  |  Size: 89 B

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B