summaryrefslogtreecommitdiff
path: root/homedecor/bathroom_furniture.lua
diff options
context:
space:
mode:
Diffstat (limited to 'homedecor/bathroom_furniture.lua')
-rw-r--r--homedecor/bathroom_furniture.lua131
1 files changed, 96 insertions, 35 deletions
diff --git a/homedecor/bathroom_furniture.lua b/homedecor/bathroom_furniture.lua
index 99dc699..585327b 100644
--- a/homedecor/bathroom_furniture.lua
+++ b/homedecor/bathroom_furniture.lua
@@ -1,43 +1,53 @@
local S = homedecor_i18n.gettext
-local bathroom_tile_colors = {
- { "1", S("white/grey"), "#c0c0c0:200" },
- { "2", S("white/dark grey"), "#404040:150" },
- { "3", S("white/black"), "#000000:200" },
- { "4", S("black/dark grey"), "" },
- { "red", S("white/red"), "#d00000:150" },
- { "green", S("white/green"), "#00d000:150" },
- { "blue", S("white/blue"), "#0000d0:150" },
- { "yellow", S("white/yellow"), "#ffff00:150" },
- { "tan", S("white/tan"), "#ceaf42:150" }
-}
-
-for _, c in ipairs(bathroom_tile_colors) do
- local color, shade, hue = unpack(c)
-
- local coloredtile = "homedecor_bathroom_tiles_bg.png^(homedecor_bathroom_tiles_fg.png^[colorize:"..hue..")"
+minetest.register_node("homedecor:bathroom_tiles_dark", {
+ description = S("Bathroom/kitchen tiles (dark)"),
+ tiles = {
+ { name = "homedecor_bathroom_tiles_bg.png", color = 0xff606060 },
+ "homedecor_bathroom_tiles_fg.png"
+ },
+ drawtype = "mesh",
+ mesh = "homedecor_block_with_overlay.obj",
+ paramtype = "light",
+ paramtype2 = "color",
+ palette = "unifieddyes_palette.png",
+ groups = {cracky=3, ud_param2_colorable = 1},
+ sounds = default.node_sound_stone_defaults(),
+ after_dig_node = unifieddyes.after_dig_node
+})
- if color == "4" then
- coloredtile = "(homedecor_bathroom_tiles_bg.png^[colorize:#000000:75)"..
- "^(homedecor_bathroom_tiles_fg.png^[colorize:#000000:200)"
- end
+minetest.register_node("homedecor:bathroom_tiles_medium", {
+ description = S("Bathroom/kitchen tiles (medium)"),
+ tiles = {
+ { name = "homedecor_bathroom_tiles_bg.png", color = 0xffc0c0c0 },
+ "homedecor_bathroom_tiles_fg.png"
+ },
+ drawtype = "mesh",
+ mesh = "homedecor_block_with_overlay.obj",
+ paramtype = "light",
+ paramtype2 = "color",
+ palette = "unifieddyes_palette.png",
+ groups = {cracky=3, ud_param2_colorable = 1},
+ sounds = default.node_sound_stone_defaults(),
+ after_dig_node = unifieddyes.after_dig_node
+})
- minetest.register_node("homedecor:tiles_"..color, {
- description = S("Bathroom/kitchen tiles (@1)", shade),
- tiles = {
- coloredtile,
- coloredtile,
- coloredtile,
- coloredtile,
- "("..coloredtile..")^[transformR90",
- "("..coloredtile..")^[transformR90"
- },
- groups = {cracky=3},
- paramtype = "light",
- sounds = default.node_sound_stone_defaults(),
- })
-end
+minetest.register_node("homedecor:bathroom_tiles_light", {
+ description = S("Bathroom/kitchen tiles (light)"),
+ tiles = {
+ { name = "homedecor_bathroom_tiles_bg.png", color = 0xffffffff },
+ "homedecor_bathroom_tiles_fg.png"
+ },
+ drawtype = "mesh",
+ mesh = "homedecor_block_with_overlay.obj",
+ paramtype = "light",
+ paramtype2 = "color",
+ palette = "unifieddyes_palette.png",
+ groups = {cracky=3, ud_param2_colorable = 1},
+ sounds = default.node_sound_stone_defaults(),
+ after_dig_node = unifieddyes.after_dig_node
+})
local tr_cbox = {
type = "fixed",
@@ -102,3 +112,54 @@ homedecor.register("medicine_cabinet_open", {
minetest.swap_node(pos, node)
end,
})
+
+-- convert old static nodes
+
+homedecor.old_static_bathroom_tiles = {
+ "homedecor:tiles_1",
+ "homedecor:tiles_2",
+ "homedecor:tiles_3",
+ "homedecor:tiles_4",
+ "homedecor:tiles_red",
+ "homedecor:tiles_tan",
+ "homedecor:tiles_yellow",
+ "homedecor:tiles_green",
+ "homedecor:tiles_blue"
+}
+
+local old_to_color = {
+ "light_grey",
+ "grey",
+ "black",
+ "black"
+}
+
+minetest.register_lbm({
+ name = "homedecor:convert_bathroom_tiles",
+ label = "Convert bathroom tiles to use param2 color",
+ run_at_every_load = true,
+ nodenames = homedecor.old_static_bathroom_tiles,
+ action = function(pos, node)
+ local name = node.name
+ local newname = "homedecor:bathroom_tiles_light"
+ local a,b = string.find(node.name, "_")
+ local color = string.sub(node.name, a + 1)
+
+ if color == "tan" then
+ color = "yellow_s50"
+ elseif color == "1" or color == "2" or color == "3" or color == "4" then
+ if color == "4" then
+ newname = "homedecor:bathroom_tiles_medium"
+ end
+ color = old_to_color[tonumber(color)]
+ elseif color ~= "yellow" then
+ color = color.."_s50"
+ end
+
+ local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color)
+
+ minetest.set_node(pos, { name = newname, param2 = paletteidx })
+ local meta = minetest.get_meta(pos)
+ meta:set_string("dye", "unifieddyes:"..color)
+ end
+})