Painted Metropolis
README.md
design
What a mural is meant to be: a grid of cells, each belonging to a pigment or to none.
A design is authored as rows of characters with a legend, small enough to write by hand, and scaled up to a
canvas by repeating cells. Row 1 of the text is the TOP of the mural; in the design, row index 1 is the bottom
(v grows upward, like the wall).
local Design = require("~.modules.design")
local d = Design.fromRows({
rows = { ".oo.",
"otto",
".oo." },
legend = { o = "ochre", t = "teal" }, -- any character not in the legend is empty
scale = 4, -- each character becomes 4 x 4 cells (default 1)
})
d.cols, d.rows, d.pigments = { "ochre", "teal" } -- pigments sorted by name
d.cells[(row - 1) * d.cols + col] -- pigment index (1..) or 0 for none
Design.count(d) -- { total, byPigment = { ochre = n, teal = n }, edge = n }
Design.tins(d, cellSize, tinPer) -- { ochre = 0.8, teal = 0.2 } tins to fill it once at `tinPer` m2 per tin
Design.isEdge(d, col, row) -- a design cell with a neighbour of another pigment or none
Design.size(d, cellSize) -- width, height in metres
The interface is documented in the header of init.luau; this file repeats it for the asset browser.