From efbc49124583bbac8cee0dd38fc81cb266c874d4 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 24 Feb 2017 19:06:17 -0500 Subject: [PATCH] use new Unified Dyes "extended" palette for bathroom tiles, table lamps, and standing lamps requires unified dyes commit d2819353 or newer --- homedecor/bathroom_furniture.lua | 28 +++++++++++++++++++++++++--- homedecor/lighting.lua | 31 +++++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/homedecor/bathroom_furniture.lua b/homedecor/bathroom_furniture.lua index 0e839fd..7a79ecd 100644 --- a/homedecor/bathroom_furniture.lua +++ b/homedecor/bathroom_furniture.lua @@ -11,7 +11,8 @@ minetest.register_node("homedecor:bathroom_tiles_dark", { mesh = "homedecor_block_with_overlay.obj", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), after_dig_node = unifieddyes.after_dig_node @@ -27,7 +28,8 @@ minetest.register_node("homedecor:bathroom_tiles_medium", { mesh = "homedecor_block_with_overlay.obj", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), after_dig_node = unifieddyes.after_dig_node @@ -43,7 +45,8 @@ minetest.register_node("homedecor:bathroom_tiles_light", { mesh = "homedecor_block_with_overlay.obj", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, groups = {cracky=3, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), after_dig_node = unifieddyes.after_dig_node @@ -163,3 +166,22 @@ minetest.register_lbm({ meta:set_string("dye", "unifieddyes:"..color) end }) + +minetest.register_lbm({ + name = "homedecor:recolor_bathroom_tiles", + label = "Convert bathroom tiles to use UD extended palette", + run_at_every_load = false, + nodenames = { + "homedecor:bathroom_tiles_light", + "homedecor:bathroom_tiles_medium", + "homedecor:bathroom_tiles_dark", + }, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + print(node.param2.." --> "..unifieddyes.convert_classic_palette[node.param2]) + minetest.swap_node(pos, { name = node.name, param2 = unifieddyes.convert_classic_palette[node.param2] }) + meta:set_string("palette", "ext") + end + end +}) diff --git a/homedecor/lighting.lua b/homedecor/lighting.lua index 369c5bd..a9f8ad5 100644 --- a/homedecor/lighting.lua +++ b/homedecor/lighting.lua @@ -414,7 +414,8 @@ local function reg_lamp(suffix, nxt, light, brightness) inventory_image = "homedecor_table_lamp_foot_inv.png^homedecor_table_lamp_top_inv.png", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, walkable = false, light_source = light, selection_box = tlamp_cbox, @@ -442,7 +443,8 @@ local function reg_lamp(suffix, nxt, light, brightness) inventory_image = "homedecor_standing_lamp_foot_inv.png^homedecor_standing_lamp_top_inv.png", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, walkable = false, light_source = light, groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, @@ -691,3 +693,28 @@ minetest.register_lbm({ meta:set_string("dye", "unifieddyes:"..color) end }) + +minetest.register_lbm({ + name = "homedecor:recolor_lighting", + label = "Convert some kinds of lights to use UD extended palette", + run_at_every_load = false, + nodenames = { + "homedecor:table_lamp_off", + "homedecor:table_lamp_low", + "homedecor:table_lamp_med", + "homedecor:table_lamp_hi", + "homedecor:table_lamp_max", + "homedecor:standing_lamp_off", + "homedecor:standing_lamp_low", + "homedecor:standing_lamp_med", + "homedecor:standing_lamp_hi", + "homedecor:standing_lamp_max", + }, + action = function(pos, node) + local meta = minetest.get_meta(pos) + if meta:get_string("palette") ~= "ext" then + minetest.swap_node(pos, { name = node.name, param2 = unifieddyes.convert_classic_palette[node.param2] }) + meta:set_string("palette", "ext") + end + end +})