From 56beb55b63955877a2767777eb623acc0410ec83 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 24 Feb 2017 21:18:38 -0500 Subject: [PATCH] use new Unified Dyes "extended" palette requires unified dyes commit d2819353 or newer --- blocks.lua | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/blocks.lua b/blocks.lua index 079c670..882b947 100644 --- a/blocks.lua +++ b/blocks.lua @@ -39,7 +39,8 @@ minetest.register_node("bobblocks:block", { tiles = {"bobblocks_block.png"}, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, is_ground_content = false, sounds = default.node_sound_glass_defaults(), @@ -59,7 +60,8 @@ minetest.register_node("bobblocks:block_off", { drawtype = "glasslike", tiles = {"bobblocks_block.png^[opacity:"..bobblocks.opacity}, paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, is_ground_content = false, use_texture_alpha = true, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1}, @@ -81,7 +83,8 @@ minetest.register_node("bobblocks:pole", { inventory_image = ("bobblocks_pole_inv.png"), paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, is_ground_content = false, sounds = default.node_sound_glass_defaults(), @@ -102,7 +105,8 @@ minetest.register_node("bobblocks:pole_off", { tiles = {"bobblocks_block.png^[opacity:"..bobblocks.opacity}, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, is_ground_content = false, use_texture_alpha = true, @@ -137,7 +141,8 @@ minetest.register_node("bobblocks:wavyblock", { tiles = {"bobblocks_wavyblock.png"}, paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, is_ground_content = false, sounds = default.node_sound_glass_defaults(), @@ -158,7 +163,8 @@ minetest.register_node("bobblocks:wavyblock_off", { drawtype = "glasslike", tiles = {"bobblocks_wavyblock.png^[opacity:"..bobblocks.opacity}, paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, is_ground_content = false, use_texture_alpha = true, groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1}, @@ -180,7 +186,8 @@ minetest.register_node("bobblocks:wavypole", { inventory_image = ("bobblocks_wavypole_inv.png"), paramtype = "light", paramtype2 = "color", - palette = "unifieddyes_palette.png", + palette = "unifieddyes_palette_extended.png", + place_param2 = 240, sunlight_propagates = true, is_ground_content = false, sounds = default.node_sound_glass_defaults(), @@ -297,3 +304,26 @@ minetest.register_lbm({ meta:set_string("dye", "unifieddyes:"..newcolor) end }) + +minetest.register_lbm({ + name = "bobblocks:recolor_stuff", + label = "Convert 89-color fences to use UD extended palette", + run_at_every_load = false, + nodenames = { + "bobblocks:block", + "bobblocks:block_off", + "bobblocks:pole", + "bobblocks:pole_off", + "bobblocks:wavyblock", + "bobblocks:wavyblock_off", + "bobblocks:wavypole" + }, + 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 +})