summaryrefslogtreecommitdiff
path: root/unifiedbricks
diff options
context:
space:
mode:
Diffstat (limited to 'unifiedbricks')
-rw-r--r--unifiedbricks/init.lua47
1 files changed, 35 insertions, 12 deletions
diff --git a/unifiedbricks/init.lua b/unifiedbricks/init.lua
index a4c9758..e3d37d7 100644
--- a/unifiedbricks/init.lua
+++ b/unifiedbricks/init.lua
@@ -102,7 +102,8 @@ minetest.register_node("unifiedbricks:brickblock", {
mesh = "unifiedbricks_brick_block.obj",
paramtype = "light",
paramtype2 = "color",
- palette = "unifieddyes_palette.png",
+ palette = "unifieddyes_palette_extended.png",
+ place_param2 = 240,
is_ground_content = true,
groups = {cracky=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
@@ -122,7 +123,8 @@ minetest.register_node("unifiedbricks:clayblock", {
},
paramtype = "light",
paramtype2 = "color",
- palette = "unifieddyes_palette.png",
+ palette = "unifieddyes_palette_extended.png",
+ place_param2 = 240,
is_ground_content = true,
groups = {crumbly=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
sounds = default.node_sound_dirt_defaults({
@@ -147,7 +149,8 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_dark", {
mesh = "unifiedbricks_brick_block.obj",
paramtype = "light",
paramtype2 = "color",
- palette = "unifieddyes_palette.png",
+ palette = "unifieddyes_palette_extended.png",
+ place_param2 = 240,
is_ground_content = true,
groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
@@ -164,7 +167,8 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_medium", {
mesh = "unifiedbricks_brick_block.obj",
paramtype = "light",
paramtype2 = "color",
- palette = "unifieddyes_palette.png",
+ palette = "unifieddyes_palette_extended.png",
+ place_param2 = 240,
is_ground_content = true,
groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
@@ -181,7 +185,8 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_light", {
mesh = "unifiedbricks_brick_block.obj",
paramtype = "light",
paramtype2 = "color",
- palette = "unifieddyes_palette.png",
+ palette = "unifieddyes_palette_extended.png",
+ place_param2 = 240,
is_ground_content = true,
groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
@@ -292,7 +297,7 @@ minetest.register_lbm({
local color2 = string.gsub(color1, "grey", "_grey")
if color2 == "_grey" then color2 = "grey" end
- local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color2)
+ local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color2, "extended")
if string.find(type, "multicolor") then
@@ -312,16 +317,34 @@ minetest.register_lbm({
end
minetest.set_node(pos, { name = "unifiedbricks:brickblock_multicolor_"..shade, param2 = newpalette })
- local meta = minetest.get_meta(pos)
- meta:set_string("dye", "unifieddyes:"..color1)
+
elseif string.find(type, "brickblock") then
minetest.set_node(pos, { name = "unifiedbricks:brickblock", param2 = paletteidx })
- local meta = minetest.get_meta(pos)
- meta:set_string("dye", "unifieddyes:"..color1)
elseif string.find(type, "clayblock") then
minetest.set_node(pos, { name = "unifiedbricks:clayblock", param2 = paletteidx })
- local meta = minetest.get_meta(pos)
- meta:set_string("dye", "unifieddyes:"..color1)
+ end
+ local meta = minetest.get_meta(pos)
+ meta:set_string("dye", "unifieddyes:"..color1)
+ meta:set_string("palette", "ext")
+ end
+})
+
+minetest.register_lbm({
+ name = "unifiedbricks:recolor_bricks",
+ label = "Convert 89-color bricks to use UD extended palette",
+ run_at_every_load = false,
+ nodenames = {
+ "unifiedbricks:clayblock",
+ "unifiedbricks:brickblock",
+ "unifiedbricks:brickblock_multicolor_dark",
+ "unifiedbricks:brickblock_multicolor_medium",
+ "unifiedbricks:brickblock_multicolor_light",
+ },
+ 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
})