1
0
Fork 0

Human-readable banner layer descriptions

objects
Wuzzy 2017-07-28 23:12:40 +02:00
parent 51f28a4317
commit 709ac59b31
2 changed files with 72 additions and 26 deletions

View File

@ -12,23 +12,24 @@ end
mcl_banners = {} mcl_banners = {}
mcl_banners.colors = { mcl_banners.colors = {
-- ID, description, wool, unified dyes color group, overlay color, dye -- Format:
["unicolor_white"] = {"white", "White Banner", "mcl_wool:white", "#FFFFFF", "mcl_dye:white" }, -- [ID] = { banner description, wool, unified dyes color group, overlay color, dye, color name for emblazonings }
["unicolor_darkgrey"] = {"grey", "Grey Banner", "mcl_wool:grey", "#303030", "mcl_dye:dark_grey" }, ["unicolor_white"] = {"white", "White Banner", "mcl_wool:white", "#FFFFFF", "mcl_dye:white", "White" },
["unicolor_grey"] = {"silver", "Light Grey Banner", "mcl_wool:silver", "#5B5B5B", "mcl_dye:grey" }, ["unicolor_darkgrey"] = {"grey", "Grey Banner", "mcl_wool:grey", "#303030", "mcl_dye:dark_grey", "Grey" },
["unicolor_black"] = {"black", "Black Banner", "mcl_wool:black", "#000000", "mcl_dye:black" }, ["unicolor_grey"] = {"silver", "Light Grey Banner", "mcl_wool:silver", "#5B5B5B", "mcl_dye:grey", "Light Grey" },
["unicolor_red"] = {"red", "Red Banner", "mcl_wool:red", "#BC0000", "mcl_dye:red" }, ["unicolor_black"] = {"black", "Black Banner", "mcl_wool:black", "#000000", "mcl_dye:black", "Black" },
["unicolor_yellow"] = {"yellow", "Yellow Banner", "mcl_wool:yellow", "#BCA800", "mcl_dye:yellow" }, ["unicolor_red"] = {"red", "Red Banner", "mcl_wool:red", "#BC0000", "mcl_dye:red", "Red" },
["unicolor_dark_green"] = {"green", "Green Banner", "mcl_wool:green", "#006000", "mcl_dye:dark_green" }, ["unicolor_yellow"] = {"yellow", "Yellow Banner", "mcl_wool:yellow", "#BCA800", "mcl_dye:yellow", "Yellow" },
["unicolor_cyan"] = {"cyan", "Cyan Banner", "mcl_wool:cyan", "#00ACAC", "mcl_dye:cyan" }, ["unicolor_dark_green"] = {"green", "Green Banner", "mcl_wool:green", "#006000", "mcl_dye:dark_green", "Green" },
["unicolor_blue"] = {"blue", "Blue Banner", "mcl_wool:blue", "#0000AC", "mcl_dye:blue" }, ["unicolor_cyan"] = {"cyan", "Cyan Banner", "mcl_wool:cyan", "#00ACAC", "mcl_dye:cyan", "Cyan" },
["unicolor_red_violet"] = {"magenta", "Magenta Banner", "mcl_wool:magenta", "#AC007C", "mcl_dye:magenta" }, ["unicolor_blue"] = {"blue", "Blue Banner", "mcl_wool:blue", "#0000AC", "mcl_dye:blue", "Blue" },
["unicolor_orange"] = {"orange", "Orange Banner", "mcl_wool:orange", "#BC6900", "mcl_dye:orange" }, ["unicolor_red_violet"] = {"magenta", "Magenta Banner", "mcl_wool:magenta", "#AC007C", "mcl_dye:magenta", "Magenta"},
["unicolor_violet"] = {"purple", "Purple Banner", "mcl_wool:purple", "#6400AC", "mcl_dye:violet" }, ["unicolor_orange"] = {"orange", "Orange Banner", "mcl_wool:orange", "#BC6900", "mcl_dye:orange", "Orange" },
["unicolor_brown"] = {"brown", "Brown Banner", "mcl_wool:brown", "#402100", "mcl_dye:brown" }, ["unicolor_violet"] = {"purple", "Purple Banner", "mcl_wool:purple", "#6400AC", "mcl_dye:violet", "Violet" },
["unicolor_pink"] = {"pink", "Pink Banner", "mcl_wool:pink", "#DE557C", "mcl_dye:pink" }, ["unicolor_brown"] = {"brown", "Brown Banner", "mcl_wool:brown", "#402100", "mcl_dye:brown", "Brown" },
["unicolor_lime"] = {"lime", "Lime Banner", "mcl_wool:lime", "#30AC00", "mcl_dye:green" }, ["unicolor_pink"] = {"pink", "Pink Banner", "mcl_wool:pink", "#DE557C", "mcl_dye:pink", "Pink" },
["unicolor_light_blue"] = {"light_blue", "Light Blue Banner", "mcl_wool:light_blue", "#4040CF", "mcl_dye:lightblue" }, ["unicolor_lime"] = {"lime", "Lime Banner", "mcl_wool:lime", "#30AC00", "mcl_dye:green", "Lime" },
["unicolor_light_blue"] = {"light_blue", "Light Blue Banner", "mcl_wool:light_blue", "#4040CF", "mcl_dye:lightblue", "Light Blue" },
} }
-- Add pattern/emblazoning crafting recipes -- Add pattern/emblazoning crafting recipes

View File

@ -4,190 +4,228 @@ local d = "group:dye" -- dye
local e = "" -- empty slot (one of them must contain the banner) local e = "" -- empty slot (one of them must contain the banner)
local patterns = { local patterns = {
["border"] = { ["border"] = {
name = "%s Bordure",
{ d, d, d }, { d, d, d },
{ d, e, d }, { d, e, d },
{ d, d, d }, { d, d, d },
}, },
["bricks"] = { ["bricks"] = {
name = "%s Bricks",
type = "shapeless", type = "shapeless",
{ e, "mcl_core:brick_block", d }, { e, "mcl_core:brick_block", d },
}, },
["circle"] = { ["circle"] = {
name = "%s Circle",
{ e, e, e }, { e, e, e },
{ e, d, e }, { e, d, e },
{ e, e, e }, { e, e, e },
}, },
["creeper"] = { ["creeper"] = {
name = "%s Creeper Charge",
type = "shapeless", type = "shapeless",
{ e, "mcl_heads:creeper", d }, { e, "mcl_heads:creeper", d },
}, },
["cross"] = { ["cross"] = {
name = "%s Saltire",
{ d, e, d }, { d, e, d },
{ e, d, e }, { e, d, e },
{ d, e, d }, { d, e, d },
}, },
["curly_border"] = { ["curly_border"] = {
name = "%s Intented Bordure",
type = "shapeless", type = "shapeless",
{ e, "mcl_core:vine", d }, { e, "mcl_core:vine", d },
}, },
["diagonal_left"] = { ["diagonal_left"] = {
name = "%s Inverted Per Bend",
{ e, e, e }, { e, e, e },
{ d, e, e }, { d, e, e },
{ d, d, e }, { d, d, e },
}, },
["diagonal_right"] = { ["diagonal_right"] = {
name = "%s Inverted Per Bend Sinister",
{ e, e, e }, { e, e, e },
{ e, e, d }, { e, e, d },
{ e, d, d }, { e, d, d },
}, },
["diagonal_up_left"] = { ["diagonal_up_left"] = {
name = "%s Per Bend",
{ e, d, d }, { e, d, d },
{ e, e, d }, { e, e, d },
{ e, e, e }, { e, e, e },
}, },
["diagonal_up_right"] = { ["diagonal_up_right"] = {
name = "%s Per Bend Sinister",
{ d, d, e }, { d, d, e },
{ d, e, e }, { d, e, e },
{ e, e, e }, { e, e, e },
}, },
["flower"] = { ["flower"] = {
name = "%s Flower Charge",
type = "shapeless", type = "shapeless",
{ e, "mcl_flowers:oxeye_daisy", d }, { e, "mcl_flowers:oxeye_daisy", d },
}, },
["gradient"] = { ["gradient"] = {
name = "%s Gradient",
{ d, e, d }, { d, e, d },
{ e, d, e }, { e, d, e },
{ e, d, e }, { e, d, e },
}, },
["gradient_up"] = { ["gradient_up"] = {
name = "%s Base Gradient",
{ e, d, e }, { e, d, e },
{ e, d, e }, { e, d, e },
{ d, e, d }, { d, e, d },
}, },
["half_horizontal_bottom"] = { ["half_horizontal_bottom"] = {
name = "%s Inverted Per Fess",
{ e, e, e }, { e, e, e },
{ d, d, d }, { d, d, d },
{ d, d, d }, { d, d, d },
}, },
["half_horizontal"] = { ["half_horizontal"] = {
name = "%s Per Fess",
{ d, d, d }, { d, d, d },
{ d, d, d }, { d, d, d },
{ e, e, e }, { e, e, e },
}, },
["half_vertical"] = { ["half_vertical"] = {
name = "%s Per Pale",
{ d, d, e }, { d, d, e },
{ d, d, e }, { d, d, e },
{ d, d, e }, { d, d, e },
}, },
["half_vertical_right"] = { ["half_vertical_right"] = {
name = "%s Inverted Per Pale",
{ e, d, d }, { e, d, d },
{ e, d, d }, { e, d, d },
{ e, d, d }, { e, d, d },
}, },
["thing"] = { ["thing"] = {
name = "%s Thing",
type = "shapeless", type = "shapeless",
-- TODO: Replace with enchanted golden apple -- TODO: Replace with enchanted golden apple
{ e, "mcl_core:apple_gold", d }, { e, "mcl_core:apple_gold", d },
}, },
["rhombus"] = { ["rhombus"] = {
name = "%s Lozenge",
{ e, d, e }, { e, d, e },
{ d, e, d }, { d, e, d },
{ e, d, e }, { e, d, e },
}, },
["skull"] = { ["skull"] = {
name = "%s Skull Charge",
type = "shapeless", type = "shapeless",
{ e, "mcl_heads:wither_skeleton", d }, { e, "mcl_heads:wither_skeleton", d },
}, },
["small_stripes"] = { ["small_stripes"] = {
name = "%s Paly",
{ d, e, d }, { d, e, d },
{ d, e, d }, { d, e, d },
{ e, e, e }, { e, e, e },
}, },
["square_bottom_left"] = { ["square_bottom_left"] = {
name = "%s Base Dexter Canton",
{ e, e, e }, { e, e, e },
{ e, e, e }, { e, e, e },
{ d, e, e }, { d, e, e },
}, },
["square_bottom_right"] = { ["square_bottom_right"] = {
name = "%s Base Sinister Canton",
{ e, e, e }, { e, e, e },
{ e, e, e }, { e, e, e },
{ e, e, d }, { e, e, d },
}, },
["square_top_left"] = { ["square_top_left"] = {
name = "%s Chief Dexter Canton",
{ d, e, e }, { d, e, e },
{ e, e, e }, { e, e, e },
{ e, e, e }, { e, e, e },
}, },
["square_top_right"] = { ["square_top_right"] = {
name = "%s Chief Sinister Canton",
{ e, e, d }, { e, e, d },
{ e, e, e }, { e, e, e },
{ e, e, e }, { e, e, e },
}, },
["straight_cross"] = { ["straight_cross"] = {
name = "%s Cross",
{ e, d, e }, { e, d, e },
{ d, d, d }, { d, d, d },
{ e, d, e }, { e, d, e },
}, },
["stripe_bottom"] = { ["stripe_bottom"] = {
name = "%s Base",
{ e, e, e }, { e, e, e },
{ e, e, e }, { e, e, e },
{ d, d, d }, { d, d, d },
}, },
["stripe_center"] = { ["stripe_center"] = {
name = "%s Fess",
{ e, e, e }, { e, e, e },
{ d, d, d }, { d, d, d },
{ e, e, e }, { e, e, e },
}, },
["stripe_downleft"] = { ["stripe_downleft"] = {
name = "%s Bend Sinister",
{ e, e, d }, { e, e, d },
{ e, d, e }, { e, d, e },
{ d, e, e }, { d, e, e },
}, },
["stripe_downright"] = { ["stripe_downright"] = {
name = "%s Bend",
{ d, e, e }, { d, e, e },
{ e, d, e }, { e, d, e },
{ e, e, d }, { e, e, d },
}, },
["stripe_left"] = { ["stripe_left"] = {
name = "%s Pale Dexter",
{ d, e, e }, { d, e, e },
{ d, e, e }, { d, e, e },
{ d, e, e }, { d, e, e },
}, },
["stripe_middle"] = { ["stripe_middle"] = {
name = "%s Pale",
{ e, d, e }, { e, d, e },
{ e, d, e }, { e, d, e },
{ e, d, e }, { e, d, e },
}, },
["stripe_right"] = { ["stripe_right"] = {
name = "%s Pale Sinister",
{ e, e, d }, { e, e, d },
{ e, e, d }, { e, e, d },
{ e, e, d }, { e, e, d },
}, },
["stripe_top"] = { ["stripe_top"] = {
name = "%s Chief",
{ d, d, d }, { d, d, d },
{ e, e, e }, { e, e, e },
{ e, e, e }, { e, e, e },
}, },
["triangle_bottom"] = { ["triangle_bottom"] = {
name = "%s Chevron",
{ e, e, e }, { e, e, e },
{ e, d, e }, { e, d, e },
{ d, e, d }, { d, e, d },
}, },
["triangle_top"] = {
name = "%s Inverted Chevron",
{ d, e, d },
{ e, d, e },
{ e, e, e },
},
["triangles_bottom"] = { ["triangles_bottom"] = {
name = "%s Base Indented",
{ e, e, e }, { e, e, e },
{ d, e, d }, { d, e, d },
{ e, d, e }, { e, d, e },
}, },
["triangles_top"] = { ["triangles_top"] = {
name = "%s Chief Indented",
{ e, d, e }, { e, d, e },
{ d, e, d }, { d, e, d },
{ e, e, e }, { e, e, e },
}, },
["triangle_top"] = {
{ d, e, d },
{ e, d, e },
{ e, e, e },
},
} }
-- Number of maximum lines in the descriptions for the banner layers. -- Number of maximum lines in the descriptions for the banner layers.
@ -200,22 +238,29 @@ local make_advanced_banner_description = function(description, layers)
-- No layers, revert to default -- No layers, revert to default
return "" return ""
else else
local d = description
local layerstrings = {} local layerstrings = {}
for l=1, #layers do for l=1, #layers do
-- Prevent excess length description
if l > max_layer_lines then if l > max_layer_lines then
break break
end end
table.insert(layerstrings, string.format("%s %s", layers[l].color, layers[l].pattern)) -- Layer text line.
local color = mcl_banners.colors[layers[l].color][6]
local pattern_name = patterns[layers[l].pattern].name
-- The pattern name is a format string (e.g. “%s Base”)
table.insert(layerstrings, string.format(pattern_name, color))
end end
-- Warn about missing information
if #layers == max_layer_lines + 1 then if #layers == max_layer_lines + 1 then
table.insert(layerstrings, "And one addional layer") table.insert(layerstrings, "And one addional layer")
elseif #layers > max_layer_lines + 1 then elseif #layers > max_layer_lines + 1 then
table.insert(layerstrings, string.format("And %d addional layers", #layers - max_layer_lines)) table.insert(layerstrings, string.format("And %d addional layers", #layers - max_layer_lines))
end end
-- Final string concatenations: Just a list of strings
local append = table.concat(layerstrings, "\n") local append = table.concat(layerstrings, "\n")
d = d .. "\n" .. core.colorize("#8F8F8F", append) description = description .. "\n" .. core.colorize("#8F8F8F", append)
return d return description
end end
end end