Merge pull request #7 from xisd/patch-1

make colored metal signs optional (default to enabled)
This commit is contained in:
Vanessa Ezekowitz 2016-10-04 05:14:42 -04:00 committed by GitHub
commit 66265132dd

309
init.lua
View File

@ -9,6 +9,8 @@
-- { delta = {entity position for 270° yaw}, exact yaw expression } -- { delta = {entity position for 270° yaw}, exact yaw expression }
-- { delta = {entity position for 90° yaw}, exact yaw expression } -- { delta = {entity position for 90° yaw}, exact yaw expression }
-- } -- }
-- Made colored metal signs optionals
local enable_colored_metal_signs = true
-- CWz's keyword interact mod uses this setting. -- CWz's keyword interact mod uses this setting.
local current_keyword = minetest.setting_get("interact_keyword") or "iaccept" local current_keyword = minetest.setting_get("interact_keyword") or "iaccept"
@ -844,47 +846,48 @@ if minetest.registered_nodes["default:sign_wall_steel"] then
end end
-- metal, colored signs -- metal, colored signs
if enable_colored_metal_signs then
local sign_colors = { "green", "yellow", "red", "white_red", "white_black", "orange", "blue", "brown" }
local sign_default_text_colors = { "f", "0", "f", "4", "0", "0", "f", "f" }
local sign_colors = { "green", "yellow", "red", "white_red", "white_black", "orange", "blue", "brown" } for i, color in ipairs(sign_colors) do
local sign_default_text_colors = { "f", "0", "f", "4", "0", "0", "f", "f" } minetest.register_node(":signs:sign_wall_"..color, {
description = S("Sign ("..color..", metal)"),
for i, color in ipairs(sign_colors) do inventory_image = "signs_"..color.."_inv.png",
minetest.register_node(":signs:sign_wall_"..color, { wield_image = "signs_"..color.."_inv.png",
description = S("Sign ("..color..", metal)"), node_placement_prediction = "",
inventory_image = "signs_"..color.."_inv.png", paramtype = "light",
wield_image = "signs_"..color.."_inv.png", sunlight_propagates = true,
node_placement_prediction = "", paramtype2 = "facedir",
paramtype = "light", drawtype = "nodebox",
sunlight_propagates = true, node_box = signs_lib.metal_wall_sign_model.nodebox,
paramtype2 = "facedir", tiles = {
drawtype = "nodebox", "signs_metal_tb.png",
node_box = signs_lib.metal_wall_sign_model.nodebox, "signs_metal_tb.png",
tiles = { "signs_metal_sides.png",
"signs_metal_tb.png", "signs_metal_sides.png",
"signs_metal_tb.png", "signs_metal_back.png",
"signs_metal_sides.png", "signs_"..color.."_front.png"
"signs_metal_sides.png", },
"signs_metal_back.png", default_color = sign_default_text_colors[i],
"signs_"..color.."_front.png" groups = sign_groups,
}, on_place = function(itemstack, placer, pointed_thing)
default_color = sign_default_text_colors[i], return signs_lib.determine_sign_type(itemstack, placer, pointed_thing)
groups = sign_groups, end,
on_place = function(itemstack, placer, pointed_thing) on_construct = function(pos)
return signs_lib.determine_sign_type(itemstack, placer, pointed_thing) signs_lib.construct_sign(pos)
end, end,
on_construct = function(pos) on_destruct = function(pos)
signs_lib.construct_sign(pos) signs_lib.destruct_sign(pos)
end, end,
on_destruct = function(pos) on_receive_fields = function(pos, formname, fields, sender)
signs_lib.destruct_sign(pos) signs_lib.receive_fields(pos, formname, fields, sender)
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_punch = function(pos, node, puncher)
signs_lib.receive_fields(pos, formname, fields, sender) signs_lib.update_sign(pos)
end, end,
on_punch = function(pos, node, puncher) })
signs_lib.update_sign(pos) end
end,
})
end end
local signs_text_on_activate local signs_text_on_activate
@ -1022,134 +1025,136 @@ minetest.register_craft({
}) })
-- craft recipes for the metal signs -- craft recipes for the metal signs
if enable_colored_metal_signs then
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_green", output = "signs:sign_wall_green",
recipe = { recipe = {
{ "dye:dark_green", "dye:white", "dye:dark_green" }, { "dye:dark_green", "dye:white", "dye:dark_green" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_green 2", output = "signs:sign_wall_green 2",
recipe = { recipe = {
{ "dye:dark_green", "dye:white", "dye:dark_green" }, { "dye:dark_green", "dye:white", "dye:dark_green" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_yellow", output = "signs:sign_wall_yellow",
recipe = { recipe = {
{ "dye:yellow", "dye:black", "dye:yellow" }, { "dye:yellow", "dye:black", "dye:yellow" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_yellow 2", output = "signs:sign_wall_yellow 2",
recipe = { recipe = {
{ "dye:yellow", "dye:black", "dye:yellow" }, { "dye:yellow", "dye:black", "dye:yellow" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_red", output = "signs:sign_wall_red",
recipe = { recipe = {
{ "dye:red", "dye:white", "dye:red" }, { "dye:red", "dye:white", "dye:red" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_red 2", output = "signs:sign_wall_red 2",
recipe = { recipe = {
{ "dye:red", "dye:white", "dye:red" }, { "dye:red", "dye:white", "dye:red" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_white_red", output = "signs:sign_wall_white_red",
recipe = { recipe = {
{ "dye:white", "dye:red", "dye:white" }, { "dye:white", "dye:red", "dye:white" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_white_red 2", output = "signs:sign_wall_white_red 2",
recipe = { recipe = {
{ "dye:white", "dye:red", "dye:white" }, { "dye:white", "dye:red", "dye:white" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_white_black", output = "signs:sign_wall_white_black",
recipe = { recipe = {
{ "dye:white", "dye:black", "dye:white" }, { "dye:white", "dye:black", "dye:white" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_white_black 2", output = "signs:sign_wall_white_black 2",
recipe = { recipe = {
{ "dye:white", "dye:black", "dye:white" }, { "dye:white", "dye:black", "dye:white" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_orange", output = "signs:sign_wall_orange",
recipe = { recipe = {
{ "dye:orange", "dye:black", "dye:orange" }, { "dye:orange", "dye:black", "dye:orange" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_orange 2", output = "signs:sign_wall_orange 2",
recipe = { recipe = {
{ "dye:orange", "dye:black", "dye:orange" }, { "dye:orange", "dye:black", "dye:orange" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_blue", output = "signs:sign_wall_blue",
recipe = { recipe = {
{ "dye:blue", "dye:white", "dye:blue" }, { "dye:blue", "dye:white", "dye:blue" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_blue 2", output = "signs:sign_wall_blue 2",
recipe = { recipe = {
{ "dye:blue", "dye:white", "dye:blue" }, { "dye:blue", "dye:white", "dye:blue" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_brown", output = "signs:sign_wall_brown",
recipe = { recipe = {
{ "dye:brown", "dye:white", "dye:brown" }, { "dye:brown", "dye:white", "dye:brown" },
{ "", default_sign_metal, "" } { "", default_sign_metal, "" }
}, },
}) })
minetest.register_craft( { minetest.register_craft( {
output = "signs:sign_wall_brown 2", output = "signs:sign_wall_brown 2",
recipe = { recipe = {
{ "dye:brown", "dye:white", "dye:brown" }, { "dye:brown", "dye:white", "dye:brown" },
{ "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" } { "steel:sheet_metal", "steel:sheet_metal", "steel:sheet_metal" }
}, },
}) })
end
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"))