convert lavalamps to UD extended palette

This commit is contained in:
Vanessa Ezekowitz 2017-02-25 02:11:47 -05:00
parent 0de4732f43
commit c1eda2246a

View File

@ -22,7 +22,8 @@ minetest.register_node("lavalamp:lavalamp", {
inventory_image = "lavalamp_lamp_inv.png", inventory_image = "lavalamp_lamp_inv.png",
paramtype = "light", paramtype = "light",
paramtype2 = "color", paramtype2 = "color",
palette = "unifieddyes_palette.png", palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
light_source = 14, light_source = 14,
@ -50,7 +51,8 @@ minetest.register_node("lavalamp:lavalamp_off", {
}, },
paramtype = "light", paramtype = "light",
paramtype2 = "color", paramtype2 = "color",
palette = "unifieddyes_palette.png", palette = "unifieddyes_palette_extended.png",
place_param2 = 240,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
selection_box = { selection_box = {
@ -117,7 +119,7 @@ minetest.register_lbm({
color = "violet" color = "violet"
end end
local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, false) local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "extended")
minetest.set_node(pos, { name = "lavalamp:lavalamp", param2 = paletteidx }) minetest.set_node(pos, { name = "lavalamp:lavalamp", param2 = paletteidx })
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -125,3 +127,20 @@ minetest.register_lbm({
end 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
})