2013-03-18 00:09:42 +01:00
|
|
|
-- Various kinds of window shutters
|
|
|
|
|
2017-01-30 00:12:02 +01:00
|
|
|
local S = homedecor_i18n.gettext
|
2013-03-18 00:09:42 +01:00
|
|
|
|
2013-08-28 11:31:42 +02:00
|
|
|
local shutters = {
|
2017-01-31 02:43:40 +01:00
|
|
|
"mahogany",
|
|
|
|
"red",
|
|
|
|
"yellow",
|
|
|
|
"forest_green",
|
|
|
|
"light_blue",
|
|
|
|
"violet",
|
|
|
|
"black",
|
|
|
|
"dark_grey",
|
|
|
|
"grey",
|
|
|
|
"white",
|
2013-08-28 11:31:42 +02:00
|
|
|
}
|
|
|
|
|
2015-01-25 21:32:36 +01:00
|
|
|
local shutter_cbox = {
|
|
|
|
type = "wallmounted",
|
|
|
|
wall_top = { -0.5, 0.4375, -0.5, 0.5, 0.5, 0.5 },
|
|
|
|
wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
2015-05-04 05:47:43 +02:00
|
|
|
wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 }
|
2015-01-25 21:32:36 +01:00
|
|
|
}
|
|
|
|
|
2017-01-31 02:43:40 +01:00
|
|
|
local inv = "homedecor_window_shutter_inv.png^[colorize:#a87034:150"
|
|
|
|
|
|
|
|
homedecor.register("shutter", {
|
|
|
|
mesh = "homedecor_window_shutter.obj",
|
|
|
|
tiles = {
|
|
|
|
{ name = "homedecor_window_shutter.png", color = 0xffa87034 }
|
|
|
|
},
|
|
|
|
description = S("Wooden Shutter"),
|
|
|
|
inventory_image = inv,
|
|
|
|
wield_image = inv,
|
2017-03-18 10:51:46 +01:00
|
|
|
paramtype2 = "colorwallmounted",
|
|
|
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
2018-09-13 16:31:29 +02:00
|
|
|
airbrush_replacement_node = "homedecor:shutter_colored",
|
2017-02-05 01:41:36 +01:00
|
|
|
groups = { snappy = 3, ud_param2_colorable = 1 },
|
2017-01-31 02:43:40 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
selection_box = shutter_cbox,
|
|
|
|
node_box = shutter_cbox,
|
2017-03-18 10:51:46 +01:00
|
|
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
|
|
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
|
|
|
|
end,
|
2017-01-31 02:43:40 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
homedecor.register("shutter_colored", {
|
|
|
|
mesh = "homedecor_window_shutter.obj",
|
|
|
|
tiles = { "homedecor_window_shutter.png" },
|
|
|
|
description = S("Wooden Shutter"),
|
|
|
|
inventory_image = "homedecor_window_shutter_inv.png",
|
|
|
|
wield_image = "homedecor_window_shutter_inv.png",
|
|
|
|
paramtype2 = "colorwallmounted",
|
|
|
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
2017-02-05 01:41:36 +01:00
|
|
|
groups = { snappy = 3 , not_in_creative_inventory = 1, ud_param2_colorable = 1},
|
2017-01-31 02:43:40 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
selection_box = shutter_cbox,
|
|
|
|
node_box = shutter_cbox,
|
2017-03-18 10:51:46 +01:00
|
|
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
|
|
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
|
|
|
|
end,
|
2017-01-31 02:43:40 +01:00
|
|
|
})
|
2013-04-03 23:03:42 +02:00
|
|
|
|
|
|
|
minetest.register_alias("homedecor:shutter_purple", "homedecor:shutter_violet")
|
2017-01-31 02:43:40 +01:00
|
|
|
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",
|
2017-02-16 22:58:48 +01:00
|
|
|
run_at_every_load = false,
|
2017-01-31 02:43:40 +01:00
|
|
|
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
|
|
|
|
})
|