From c1eda2246a1e7130f475702ec0ecb8cccb1badca Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sat, 25 Feb 2017 02:11:47 -0500 Subject: [PATCH] convert lavalamps to UD extended palette --- lavalamp/init.lua | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/lavalamp/init.lua b/lavalamp/init.lua index bac1616..5a90074 100644 --- a/lavalamp/init.lua +++ b/lavalamp/init.lua @@ -22,7 +22,8 @@ minetest.register_node("lavalamp:lavalamp", { inventory_image = "lavalamp_lamp_inv.png", paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, walkable = false, light_source = 14, @@ -50,7 +51,8 @@ minetest.register_node("lavalamp:lavalamp_off", { }, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, walkable = false, selection_box = { @@ -117,7 +119,7 @@ minetest.register_lbm({ color = "violet" end - local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, false) + local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended") minetest.set_node(pos, { name = "lavalamp:lavalamp", param2 = paletteidx }) local meta = minetest.get_meta(pos) @@ -125,3 +127,20 @@ minetest.register_lbm({ end }) + +minetest.register_lbm({ + name = "lavalamp:recolor", + label = "Convert 89-color lamps to use UD extended palette", + run_at_every_load = false, + nodenames = { + "lavalamp:lavalamp", + "lavalamp:lavalamp_off" + }, + 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 +})