Painted Metropolis
README.md
painter
A painter's hands: the tool and pigment in use, and what one tick of painting does.
It joins a supply, the tool table and a canvas (paint thrown at things is modules/arms). It knows nothing about input, cameras or characters: the host
says where on the canvas the tool points and how far away the painter stands.
local Painter = require("~.modules.painter")
local p = Painter.new(cfg, supply, { tools = { "spray" } }) -- the tools owned (names in cfg.tools)
p:own("roller") p:selectTool("roller") p:cycleTool(1)
p:selectPigment("ochre") p:cyclePigment(1) -- among pigments the supply holds
local r = p:paint(canvas, dt, { u = 1.2, v = 0.9, distance = 1.4, stand = 0, stencil = nil })
-- call every tick while the trigger is held
-- r = { ok = true, used = tins, added = cells, touched = cells, loudness = n }
-- | { ok = false, reason = "no tool" | "no pigment" | "empty" | "too far" | "out of reach" | "signed" }
-- `stand` is how high the painter's feet are above the canvas's foot (a ladder, a van roof).
-- `stencil = "teal"` with a tool whose config says masked = true paints only the teal region.
p:loudness() -- the selected tool's loudness (0 with no tool), for whatever is watching
p.tool, p.pigment
The interface is documented in the header of init.luau; this file repeats it for the asset browser.