forked from mtcontrib/homedecor_modpack
convert shutters to param2 colorization
craft and place an oak shutter first, then right-click it with dye to color it. dig to get back the oak + dye.
This commit is contained in:
parent
1ec16b5b53
commit
70ba7db599
@ -537,15 +537,13 @@ minetest.register_craft({
|
|||||||
recipe = "homedecor:skylight_frosted",
|
recipe = "homedecor:skylight_frosted",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Various colors of shutters
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "homedecor:shutter_oak 2",
|
output = "homedecor:shutter 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "group:stick", "group:stick" },
|
{ "group:stick", "group:stick" },
|
||||||
{ "group:stick", "group:stick" },
|
{ "group:stick", "group:stick" },
|
||||||
{ "group:stick", "group:stick" },
|
{ "group:stick", "group:stick" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -554,201 +552,6 @@ minetest.register_craft({
|
|||||||
burntime = 30,
|
burntime = 30,
|
||||||
})
|
})
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:shutter_black 4",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"dye:black"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:shutter_black",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:shutter_dark_grey 4",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"dye:dark_grey"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:shutter_dark_grey",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:shutter_grey 4",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"dye:grey"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:shutter_grey",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:shutter_white 4",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"dye:white"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:shutter_white",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:shutter_mahogany 4",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"dye:brown"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:shutter_mahogany",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
minetest.register_craft( {
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:shutter_red 4",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"dye:red"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:shutter_red",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:shutter_yellow 4",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"dye:yellow"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:shutter_yellow",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:shutter_forest_green 4",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"dye:dark_green"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:shutter_forest_green",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:shutter_light_blue 4",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"unifieddyes:light_blue"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:shutter_light_blue",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:shutter_violet 4",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"homedecor:shutter_oak",
|
|
||||||
"dye:violet"
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:shutter_violet",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "homedecor:drawer_small",
|
output = "homedecor:drawer_small",
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -3,17 +3,16 @@
|
|||||||
local S = homedecor_i18n.gettext
|
local S = homedecor_i18n.gettext
|
||||||
|
|
||||||
local shutters = {
|
local shutters = {
|
||||||
{"oak", S("unpainted oak"), "bf8a51" },
|
"mahogany",
|
||||||
{"mahogany", S("mahogany"), "822606" },
|
"red",
|
||||||
{"red", S("red"), "d00000" },
|
"yellow",
|
||||||
{"yellow", S("yellow"), "ffff00" },
|
"forest_green",
|
||||||
{"forest_green", S("forest green"), "006000" },
|
"light_blue",
|
||||||
{"light_blue", S("light blue"), "2878d8" },
|
"violet",
|
||||||
{"violet", S("violet"), "7000e0" },
|
"black",
|
||||||
{"black", S("black"), "181818" },
|
"dark_grey",
|
||||||
{"dark_grey", S("dark grey"), "404040" },
|
"grey",
|
||||||
{"grey", S("grey"), "b0b0b0" },
|
"white",
|
||||||
{"white", S("white"), "ffffff" },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local shutter_cbox = {
|
local shutter_cbox = {
|
||||||
@ -23,27 +22,85 @@ local shutter_cbox = {
|
|||||||
wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 }
|
wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 }
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s in ipairs(shutters) do
|
local inv = "homedecor_window_shutter_inv.png^[colorize:#a87034:150"
|
||||||
local name, desc, hue = unpack(s)
|
|
||||||
|
|
||||||
local tile = { name = "homedecor_window_shutter.png", color = tonumber("0xff"..hue) }
|
homedecor.register("shutter", {
|
||||||
local inv = "homedecor_window_shutter_inv.png^[colorize:#"..hue..":150"
|
mesh = "homedecor_window_shutter.obj",
|
||||||
|
tiles = {
|
||||||
|
{ name = "homedecor_window_shutter.png", color = 0xffa87034 }
|
||||||
|
},
|
||||||
|
description = S("Wooden Shutter"),
|
||||||
|
inventory_image = inv,
|
||||||
|
wield_image = inv,
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
groups = { snappy = 3 },
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
selection_box = shutter_cbox,
|
||||||
|
node_box = shutter_cbox,
|
||||||
|
after_place_node = homedecor.fix_rotation,
|
||||||
|
after_dig_node = unifieddyes.after_dig_node,
|
||||||
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
|
unifieddyes.on_rightclick(pos, node, clicker,
|
||||||
|
itemstack, pointed_thing, "homedecor:shutter_colored", "wallmounted")
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
homedecor.register("shutter_"..name, {
|
homedecor.register("shutter_colored", {
|
||||||
mesh = "homedecor_window_shutter.obj",
|
mesh = "homedecor_window_shutter.obj",
|
||||||
tiles = { tile },
|
tiles = { "homedecor_window_shutter.png" },
|
||||||
description = S("Wooden Shutter (@1)", desc),
|
description = S("Wooden Shutter"),
|
||||||
inventory_image = inv,
|
inventory_image = "homedecor_window_shutter_inv.png",
|
||||||
wield_image = inv,
|
wield_image = "homedecor_window_shutter_inv.png",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "colorwallmounted",
|
||||||
groups = { snappy = 3 },
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
||||||
sounds = default.node_sound_wood_defaults(),
|
groups = { snappy = 3 , not_in_creative_inventory = 1},
|
||||||
selection_box = shutter_cbox,
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = shutter_cbox,
|
selection_box = shutter_cbox,
|
||||||
-- collision_box doesn't accept type="wallmounted", but node_box
|
node_box = shutter_cbox,
|
||||||
-- does. Said nodeboxes create a custom collision box but are
|
after_place_node = homedecor.fix_rotation,
|
||||||
-- invisible themselves because drawtype="mesh".
|
after_dig_node = unifieddyes.after_dig_node,
|
||||||
})
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
end
|
unifieddyes.on_rightclick(pos, node, clicker,
|
||||||
|
itemstack, pointed_thing, "homedecor:shutter_colored", "wallmounted")
|
||||||
|
end,
|
||||||
|
drop = "homedecor:shutter"
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_alias("homedecor:shutter_purple", "homedecor:shutter_violet")
|
minetest.register_alias("homedecor:shutter_purple", "homedecor:shutter_violet")
|
||||||
|
minetest.register_alias("homedecor:shutter_oak", "homedecor:shutter")
|
||||||
|
|
||||||
|
-- convert to param2 coloring
|
||||||
|
|
||||||
|
homedecor.old_shutter_nodes = {}
|
||||||
|
|
||||||
|
for _, color in ipairs(shutters) do
|
||||||
|
table.insert(homedecor.old_shutter_nodes, "homedecor:shutter_"..color)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
name = "homedecor:convert_shutters",
|
||||||
|
label = "Convert shutter static nodes to use param2 color",
|
||||||
|
run_at_every_load = true,
|
||||||
|
nodenames = homedecor.old_shutter_nodes,
|
||||||
|
action = function(pos, node)
|
||||||
|
local name = node.name
|
||||||
|
local color = string.sub(name, string.find(name, "_") + 1)
|
||||||
|
|
||||||
|
if color == "mahogany" then
|
||||||
|
color = "dark_red"
|
||||||
|
elseif color == "forest_green" then
|
||||||
|
color = "dark_green"
|
||||||
|
elseif color == "light_blue" then
|
||||||
|
color = "medium_cyan"
|
||||||
|
elseif color == "red" then
|
||||||
|
color = "medium_red"
|
||||||
|
end
|
||||||
|
|
||||||
|
local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted")
|
||||||
|
local param2 = paletteidx + node.param2
|
||||||
|
|
||||||
|
minetest.set_node(pos, { name = "homedecor:shutter_colored", param2 = param2 })
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("dye", "unifieddyes:"..color)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user