From b3538e3941a896857ccb0981f431b176a6d7c62e Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Mon, 6 Feb 2017 07:40:46 -0500 Subject: [PATCH] convert bathroom tiles to param2 color side effect: I added a third shade of the formerly-white checker background that alternates with the colored overlay. The colored overlay follows the standard full Unified Dyes palette. --- homedecor/bathroom_furniture.lua | 133 +++++++++++++----- .../models/homedecor_block_with_overlay.obj | 44 ++++++ .../textures/homedecor_bathroom_tiles_bg.png | Bin 190 -> 202 bytes .../textures/homedecor_bathroom_tiles_fg.png | Bin 381 -> 259 bytes 4 files changed, 142 insertions(+), 35 deletions(-) create mode 100644 homedecor/models/homedecor_block_with_overlay.obj diff --git a/homedecor/bathroom_furniture.lua b/homedecor/bathroom_furniture.lua index 99dc699..6fde857 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" } -} +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_bg.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 +}) -for _, c in ipairs(bathroom_tile_colors) do - local color, shade, hue = unpack(c) +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 +}) - local coloredtile = "homedecor_bathroom_tiles_bg.png^(homedecor_bathroom_tiles_fg.png^[colorize:"..hue..")" - - 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: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,56 @@ 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) + + print(node.name.." --> "..newname, color.." ("..dump(paletteidx)..")") + + minetest.set_node(pos, { name = newname, param2 = paletteidx }) + local meta = minetest.get_meta(pos) + meta:set_string("dye", "unifieddyes:"..color) + end +}) diff --git a/homedecor/models/homedecor_block_with_overlay.obj b/homedecor/models/homedecor_block_with_overlay.obj new file mode 100644 index 0000000..9c70760 --- /dev/null +++ b/homedecor/models/homedecor_block_with_overlay.obj @@ -0,0 +1,44 @@ +# Blender v2.72 (sub 0) OBJ File: 'unifiedbricks_brick_block.blend' +# www.blender.org +o Cube +v 0.496092 0.496092 0.496092 +v 0.496092 0.496092 -0.496092 +v -0.496092 0.496092 -0.496092 +v -0.496092 0.496092 0.496092 +v 0.496092 -0.496092 0.496092 +v 0.496092 -0.496092 -0.496092 +v -0.496092 -0.496092 -0.496092 +v -0.496092 -0.496092 0.496092 +v 0.499750 0.499750 0.499750 +v 0.499750 0.499750 -0.499750 +v -0.499750 0.499750 -0.499750 +v -0.499750 0.499750 0.499750 +v 0.499750 -0.499750 0.499750 +v 0.499750 -0.499750 -0.499750 +v -0.499750 -0.499750 -0.499750 +v -0.499750 -0.499750 0.499750 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vn 0.000000 -1.000000 0.000000 +vn -1.000000 0.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 1.000000 0.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 0.000000 0.000000 1.000000 +g Cube_Cube_base +s off +f 8/1/1 7/2/1 6/3/1 5/4/1 +f 4/2/2 3/3/2 7/4/2 8/1/2 +f 1/3/3 2/4/3 3/1/3 4/2/3 +f 2/2/4 1/3/4 5/4/4 6/1/4 +f 3/2/5 2/3/5 6/4/5 7/1/5 +f 1/2/6 4/3/6 8/4/6 5/1/6 +g Cube_Cube_overlay +f 16/1/1 15/2/1 14/3/1 13/4/1 +f 12/2/2 11/3/2 15/4/2 16/1/2 +f 9/3/3 10/4/3 11/1/3 12/2/3 +f 10/2/4 9/3/4 13/4/4 14/1/4 +f 11/2/5 10/3/5 14/4/5 15/1/5 +f 9/2/6 12/3/6 16/4/6 13/1/6 diff --git a/homedecor/textures/homedecor_bathroom_tiles_bg.png b/homedecor/textures/homedecor_bathroom_tiles_bg.png index 1a204571143f70620f9a3547a87fbfa0fb5b2a6d..b8a31573248ebe471f19263b9dd3f9667ef41041 100644 GIT binary patch delta 174 zcmV;f08#(G0m=c8B!7`fL_t&-(_K! zna}!zHQE`FxghirV$UG%Y06MOTZhuNoZidz`NbMhzY+6(^|8|q$Ss`Ev}=UdJb_vt zkUEOgzpz{00q*n~zv~u|9;N|{;n?px!Ldz|4%R=c&uT$jO(%!>Qwu~~!*P06$h96b cv~n!)4|DHFQpYX(?f?J)07*qoM6N<$f@)_}=>Px# delta 162 zcmV;T0A2se0loo{B!7iTL_t&-83n-sYQ!)M05Jdmp-V^8(u?t#(19ie)LRc^9o zJ4e8G_k_J`2HfZI3v0|f_TCrdUpGYcp0IOW5S{x6GT#GYT^n=4XUqrw0TW{Qbz@~O Q!2kdN07*qoM6N<$f}*oYL;wH) diff --git a/homedecor/textures/homedecor_bathroom_tiles_fg.png b/homedecor/textures/homedecor_bathroom_tiles_fg.png index b741d563d0f6cde423a8db7490b2dce7555bffc8..a00c3a8e6f03b631418f6a8c454a6967c8d3821e 100644 GIT binary patch delta 242 zcmV3K~yNuWspm5!!Qs-pDm|t3iSR5?552J zu>u>mGm@A^Qjsz)+L|T<~6|XayOwsXB$Rut%CX+bw?ReP8h&LxX1`;2w;0%pm zWWmV%JCjK|d3KVt>8fETdM4hvxFN7Gai`x2F;FGcsPrW*STP3&Jc>n+a07*qoM6N<$g4@Du5&!@I delta 365 zcmV-z0h0cM0{sGz8Gi!+001a04^sdD0FzKmR7C&)0G5`PnVFfJo12}Tou8kdprD|l zqN1atqokyyrlzK+r>Ci@sj8}~tE;Q6t*y1SwYRsoxVX5vxw*T$yS%)-zrVl0z`(-7 z!o$PE#l^+O#>U6T$H~db%F4>j%*@Tr&Cbrw(9qD)(b3b>(|^>|)YaA1*VotB*x1_I z+S}XP+}zyW-rnEe-{Ilm;^N}t