convert "multicolor" brick blocks to param2 coloring

Revised recipes somewhat:  craft with a default brick block and three dyes:

bricks + dark grey + dark grey + grey = dark multicolor
bricks + white + medium grey + dark grey = medium multicolor
bricks + white + white + grey = light multicolor

Craft, place, then punch with a color dye to set the "real" color.
This commit is contained in:
Vanessa Ezekowitz 2017-02-06 06:41:04 -05:00
parent ea4135c253
commit 0dc26526b5
43 changed files with 112 additions and 87 deletions

199
init.lua

@ -137,6 +137,89 @@ minetest.override_item("default:clay", {
groups = {crumbly = 3, ud_param2_colorable = 1} groups = {crumbly = 3, ud_param2_colorable = 1}
}) })
minetest.register_node("unifiedbricks:brickblock_multicolor_dark", {
description = "Brick block (dark multicolor)",
tiles = {
"unifiedbricks_brickblock_multicolor_dark.png",
{ name = "unifiedbricks_mortar.png", color = 0xffffffff },
},
drawtype = "mesh",
mesh = "unifiedbricks_brick_block.obj",
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette.png",
is_ground_content = true,
groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
after_dig_node = unifieddyes.after_dig_node,
})
minetest.register_node("unifiedbricks:brickblock_multicolor_medium", {
description = "Brick block (medium multicolor)",
tiles = {
"unifiedbricks_brickblock_multicolor_medium.png",
{ name = "unifiedbricks_mortar.png", color = 0xffffffff },
},
drawtype = "mesh",
mesh = "unifiedbricks_brick_block.obj",
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette.png",
is_ground_content = true,
groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
after_dig_node = unifieddyes.after_dig_node,
})
minetest.register_node("unifiedbricks:brickblock_multicolor_light", {
description = "Brick block (light multicolor)",
tiles = {
"unifiedbricks_brickblock_multicolor_light.png",
{ name = "unifiedbricks_mortar.png", color = 0xffffffff },
},
drawtype = "mesh",
mesh = "unifiedbricks_brick_block.obj",
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette.png",
is_ground_content = true,
groups = {cracky=3, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
after_dig_node = unifieddyes.after_dig_node,
})
minetest.register_craft( {
type = "shapeless",
output = "unifiedbricks:brickblock_multicolor_dark",
recipe = {
"default:brick",
"unifieddyes:grey",
"unifieddyes:dark_grey",
"unifieddyes:dark_grey"
},
})
minetest.register_craft( {
type = "shapeless",
output = "unifiedbricks:brickblock_multicolor_medium",
recipe = {
"default:brick",
"unifieddyes:white",
"unifieddyes:grey",
"unifieddyes:dark_grey"
},
})
minetest.register_craft( {
type = "shapeless",
output = "unifiedbricks:brickblock_multicolor_light",
recipe = {
"default:brick",
"unifieddyes:white",
"unifieddyes:white",
"unifieddyes:grey"
},
})
-- static nodes -- static nodes
@ -145,40 +228,15 @@ unifiedbricks.register_old_static_block = function(name, formalname, blocktype)
table.insert(unifiedbricks.old_static_list_formals, formalname) table.insert(unifiedbricks.old_static_list_formals, formalname)
end end
unifiedbricks.register_multicolor = function(name, formalname, drop_one, drop_two, drop_three) for _, color in ipairs(HUES) do
minetest.register_node("unifiedbricks:" .. TYPES[5] .. name, { table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_dark_"..color)
description = formalname .. FORMALTYPES[5], table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_medium_"..color)
tiles = {"unifiedbricks_" .. TYPES[5] .. name .. ".png"}, table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_light_"..color)
is_ground_content = true,
groups = {cracky=3},
drop = {
max_items = 4,
items = {
items = {
{ "default:brick",
"unifieddyes:"..drop_one,
"unifieddyes:"..drop_two,
"unifieddyes:"..drop_three,
rarity = 1 }
}
}
},
sounds = default.node_sound_stone_defaults(),
})
end end
unifiedbricks.register_multicolor_craft = function(name, dye_one, dye_two, dye_three) table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_darkgrey")
minetest.register_craft( { table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_grey")
type = "shapeless", table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_lightgrey")
output = "unifiedbricks:multicolor_" .. name,
recipe = {
"default:brick",
"unifieddyes:"..dye_one,
"unifieddyes:"..dye_two,
"unifieddyes:"..dye_three
},
})
end
--REGISTERS ALL STATIC NODES EXCEPT MULTICOLOR BRICK BLOCKS --REGISTERS ALL STATIC NODES EXCEPT MULTICOLOR BRICK BLOCKS
for i = 1,17 do for i = 1,17 do
@ -217,59 +275,6 @@ for i = 1,17 do
end end
end end
--REGISTERS ALL MULTICOLOR EVERYTHING
for i = 1,13 do
if i == 13 then
name = HUES[14]
formalname = FORMALHUES[14]
brick_one = HUES[14]
brick_two = HUES[15]
brick_three = HUES[16]
unifiedbricks.register_multicolor(name, formalname, brick_one, brick_two, brick_three)
unifiedbricks.register_multicolor_craft(name, brick_one, brick_two, brick_three)
name = HUES[15]
formalname = FORMALHUES[15]
brick_one = HUES[15]
brick_two = HUES[14]
brick_three = HUES[16]
unifiedbricks.register_multicolor(name, formalname, brick_one, brick_two, brick_three)
unifiedbricks.register_multicolor_craft(name, brick_one, brick_two, brick_three)
name = HUES[16]
formalname = FORMALHUES[16]
brick_one = HUES[16]
brick_two = HUES[14]
brick_three = HUES[15]
unifiedbricks.register_multicolor(name, formalname, brick_one, brick_two, brick_three)
unifiedbricks.register_multicolor_craft(name, brick_one, brick_two, brick_three)
else
name = DARKNESS[1] .. HUES[i]
formalname = FORMALDARKNESS[1] .. FORMALHUES[i]
brick_one = DARKNESS[1] .. HUES[i]
brick_two = DARKNESS[2] .. HUES[i]
brick_three = DARKNESS[2] .. HUES[i] .. SATURATION[1]
unifiedbricks.register_multicolor(name, formalname, brick_one, brick_two, brick_three)
unifiedbricks.register_multicolor_craft(name, brick_one, brick_two, brick_three)
name = DARKNESS[2] .. HUES[i]
formalname = FORMALDARKNESS[2] .. FORMALHUES[i]
brick_one = DARKNESS[2] .. HUES[i]
brick_two = DARKNESS[1] .. HUES[i]
brick_three = DARKNESS[3] .. HUES[i] .. SATURATION[1]
unifiedbricks.register_multicolor(name, formalname, brick_one, brick_two, brick_three)
unifiedbricks.register_multicolor_craft(name, brick_one, brick_two, brick_three)
name = DARKNESS[4] .. HUES[i]
formalname = FORMALDARKNESS[4] .. FORMALHUES[i]
brick_one = DARKNESS[3] .. HUES[i]
brick_two = DARKNESS[4] .. HUES[i]
brick_three = DARKNESS[2] .. HUES[i] .. SATURATION[1]
unifiedbricks.register_multicolor(name, formalname, brick_one, brick_two, brick_three)
unifiedbricks.register_multicolor_craft(name, brick_one, brick_two, brick_three)
end
end
-- convert in-map static nodes to use param2 coloring -- convert in-map static nodes to use param2 coloring
minetest.register_lbm({ minetest.register_lbm({
@ -287,9 +292,29 @@ minetest.register_lbm({
local color2 = string.gsub(color1, "grey", "_grey") local color2 = string.gsub(color1, "grey", "_grey")
if color2 == "_grey" then color2 = "grey" end if color2 == "_grey" then color2 = "grey" end
local paletteidx = unifieddyes.getpaletteidx("unifieddyes:"..color2) local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color2)
if string.find(type, "brickblock") then if string.find(type, "multicolor") then
local newpalette = (hue*8)+1
local shade
if string.find(name, "dark") then
shade = "dark"
elseif string.find(name, "medium")
or name == "unifiedbricks:multicolor_grey" then
shade = "medium"
else
shade = "light"
end
if string.find(name, "grey") then
newpalette = 2
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 }) minetest.set_node(pos, { name = "unifiedbricks:brickblock", param2 = paletteidx })
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("dye", "unifieddyes:"..color1) meta:set_string("dye", "unifieddyes:"..color1)

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B