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.
This commit is contained in:
Vanessa Ezekowitz 2017-02-06 07:40:46 -05:00
parent a493933105
commit b3538e3941
4 changed files with 142 additions and 35 deletions

View File

@ -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..")"
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),
minetest.register_node("homedecor:bathroom_tiles_dark", {
description = S("Bathroom/kitchen tiles (dark)"),
tiles = {
coloredtile,
coloredtile,
coloredtile,
coloredtile,
"("..coloredtile..")^[transformR90",
"("..coloredtile..")^[transformR90"
{ name = "homedecor_bathroom_tiles_bg.png", color = 0xff606060 },
"homedecor_bathroom_tiles_bg.png"
},
groups = {cracky=3},
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(),
})
end
after_dig_node = unifieddyes.after_dig_node
})
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: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
})

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 259 B