diff --git a/img/black-concrete-ghost.png b/img/black-concrete-ghost.png new file mode 100644 index 00000000..ecdceb31 Binary files /dev/null and b/img/black-concrete-ghost.png differ diff --git a/img/blue-concrete-ghost.png b/img/blue-concrete-ghost.png new file mode 100644 index 00000000..f7c4cef3 Binary files /dev/null and b/img/blue-concrete-ghost.png differ diff --git a/img/brown-concrete-ghost.png b/img/brown-concrete-ghost.png new file mode 100644 index 00000000..4a84aac2 Binary files /dev/null and b/img/brown-concrete-ghost.png differ diff --git a/img/cyan-concrete-ghost.png b/img/cyan-concrete-ghost.png new file mode 100644 index 00000000..75da3ebe Binary files /dev/null and b/img/cyan-concrete-ghost.png differ diff --git a/img/glass.png b/img/glass.png index 8fe27104..83d6b5e5 100644 Binary files a/img/glass.png and b/img/glass.png differ diff --git a/img/gray-concrete-ghost.png b/img/gray-concrete-ghost.png new file mode 100644 index 00000000..0ae85821 Binary files /dev/null and b/img/gray-concrete-ghost.png differ diff --git a/img/green-concrete-ghost.png b/img/green-concrete-ghost.png new file mode 100644 index 00000000..5fb47d0d Binary files /dev/null and b/img/green-concrete-ghost.png differ diff --git a/img/light-blue-concrete-ghost.png b/img/light-blue-concrete-ghost.png new file mode 100644 index 00000000..e1f56c04 Binary files /dev/null and b/img/light-blue-concrete-ghost.png differ diff --git a/img/light-gray-concrete-ghost.png b/img/light-gray-concrete-ghost.png new file mode 100644 index 00000000..708af46b Binary files /dev/null and b/img/light-gray-concrete-ghost.png differ diff --git a/img/lime-concrete-ghost.png b/img/lime-concrete-ghost.png new file mode 100644 index 00000000..4d1a56da Binary files /dev/null and b/img/lime-concrete-ghost.png differ diff --git a/img/magenta-concrete-ghost.png b/img/magenta-concrete-ghost.png new file mode 100644 index 00000000..bee4761e Binary files /dev/null and b/img/magenta-concrete-ghost.png differ diff --git a/img/obs-N.png b/img/obs-N.png new file mode 100644 index 00000000..962b6995 Binary files /dev/null and b/img/obs-N.png differ diff --git a/img/orange-concrete-ghost.png b/img/orange-concrete-ghost.png new file mode 100644 index 00000000..1da23b2c Binary files /dev/null and b/img/orange-concrete-ghost.png differ diff --git a/img/pink-concrete-ghost.png b/img/pink-concrete-ghost.png new file mode 100644 index 00000000..398eed90 Binary files /dev/null and b/img/pink-concrete-ghost.png differ diff --git a/img/purple-concrete-ghost.png b/img/purple-concrete-ghost.png new file mode 100644 index 00000000..389abe89 Binary files /dev/null and b/img/purple-concrete-ghost.png differ diff --git a/img/red-concrete-ghost.png b/img/red-concrete-ghost.png new file mode 100644 index 00000000..ac75fcfe Binary files /dev/null and b/img/red-concrete-ghost.png differ diff --git a/img/soul-sand.png b/img/soul-sand.png index 25ed250c..dfe52db9 100644 Binary files a/img/soul-sand.png and b/img/soul-sand.png differ diff --git a/img/white-concrete-ghost.png b/img/white-concrete-ghost.png new file mode 100644 index 00000000..62774f61 Binary files /dev/null and b/img/white-concrete-ghost.png differ diff --git a/img/yellow-concrete-ghost.png b/img/yellow-concrete-ghost.png new file mode 100644 index 00000000..f661a0ef Binary files /dev/null and b/img/yellow-concrete-ghost.png differ diff --git a/test.typ b/test.typ index 883dec94..8415a254 100644 --- a/test.typ +++ b/test.typ @@ -1,62 +1,217 @@ #let schematic-extent = state("schematic-extent") -#let tile(path, x, y, z, dx: 0, dy: 0) = { +#let color = ( + white: , + light-gray: , + gray: , + black: , + brown: , + red: , + orange: , + yellow: , + lime: , + green: , + cyan: , + light-blue: , + blue: , + purple: , + magenta: , + pink: , +) + +#let facing = () + +#let power = ( + on: , + off: , +) + +#let sub = +#let lock = + +#let tile(path, x, y, z) = { context schematic-extent.update(it => (it.at(0) + x, it.at(1) + y, it.at(2) + z, it.at(3) + 1)) - place( - horizon + center, - image(path, width: 2em), - dx: 0.8952em * (x + y), - dy: -0.444em * (x - y) - 1.09em * z, - ) + context { + let extent-val = schematic-extent.at( + query(selector().after(here())).first().location(), + ) + let center-val = ( + extent-val.at(0) / extent-val.at(3), + extent-val.at(1) / extent-val.at(3), + extent-val.at(2) / extent-val.at(3), + ) + let cx = x - center-val.at(0) + let cy = y - center-val.at(1) + let cz = z - center-val.at(2) + + place( + horizon + center, + image(path, width: 2em), + dx: 0.8952em * (-cx + cy), + dy: -0.444em * (-cx - cy) - 1.09em * cz, + ) + } } #let schematic(blocks) = { context schematic-extent.update(it => (0, 0, 0, 0)) blocks + [#metadata(none) ] } +#let tileset(..tiles) = { + show: schematic + for (i, it) in tiles.pos().enumerate() { + tile("img/slab-top.png", i, 0, -1) + tile(it, i, 0, 0) + } +} + +#let dust(..args) = { + let facing = args.filter(it => type(it) == str).pos().join() + facing = upper(facing).codepoints().sorted(key: it => "NESWUD".position(it)).join() + + let powered = args.filter(it => (on, off).contains(it)).at(0, default: off) + + return ( + "img/dust", + if powered == on { "-on" } else { "-off" }, + if facing != "" { "-" + facing }, + ".png", + ).join() +} + +// #let dust(powered: false, facing: none) = ( +// "img/dust", +// if powered { "-on" } else { "-off" }, +// "-" + upper(facing).codepoints().sorted(key: it => "NESW".position(it)).join(), +// ".png", +// ).join() + + +#let cmp(powered: false, subtract: false, facing: "s") = { + return ( + "img/cmp", + if powered { "-on" } else { "-off" }, + if subtract { "-sub" }, + "-" + upper(facing), + ".png", + ).join() +} + +#let rep(delay, powered: false, locked: false, facing: "s") = { + return ( + "img/rep", + "-" + str(delay), + if powered { "-on" } else { "-off" }, + if locked { "-lock" }, + "-" + upper(facing), + ".png", + ).join() +} + +#let slab(kind: "top") = { + return ( + "img/slab", + "-" + kind, + ".png", + ).join() +} + +#let solid(color: "white", ghost: false) = { + return ( + "img/", + color + "-concrete", + if ghost { "-ghost" }, + ".png", + ).join() +} + +#let glass() = "img/glass.png" +#let soulsand() = "img/soul-sand.png" + +#let trapdoor(facing: "d") = { + return ( + "img/trapdoor", + "-" + upper(facing), + ".png", + ).join() +} +// , +// , +// , +// , +// , +// , +// , +// , + #block(stroke: gray, width: 100%, height: 3in, { set text(size: 40pt) - schematic({ - tile("img/white-concrete.png", 0, -2, -1) - // tile("img/gray-concrete.png", 0, 0, -1) - tile("img/white-concrete.png", 1, 0, 0) - tile("img/white-concrete.png", 0, -1, 0) - tile("img/white-concrete.png", 0, 0, -1) - tile("img/cmp-off-S.png", 0, 0, 0) - }) + tileset( + dust("ns"), + cmp(), + rep(2, powered: true), + solid(), + trapdoor(), + ) - // tile("img/white-concrete.png", 0, -3, 0) - // tile("img/gray-concrete.png", 0, -3, -1) - // - // tile("img/white-concrete.png", 3, 0, -1) - // tile("img/white-concrete.png", 2, 0, -1) - // tile("img/white-concrete.png", 1, 0, -1) - // tile("img/white-concrete.png", 0, 0, -1) - // tile("img/white-concrete.png", -1, 0, -1) - // tile("img/white-concrete.png", -2, 0, -1) - // tile("img/white-concrete.png", -3, 0, -1) - // - // tile("img/cmp-off.png", 3, 0, 0) - // tile("img/cmp-off.png", 2, 0, 0) - // tile("img/cmp-off.png", 1, 0, 0) - // tile("img/cmp-off.png", 0, 0, 0) - // tile("img/cmp-off.png", -1, 0, 0) - // tile("img/cmp-off.png", -2, 0, 0) - // tile("img/cmp-off.png", -3, 0, 0) + // tileset( + // "img/cmp-off-S.png", + // "img/rep-4-off-S.png", + // "img/white-concrete.png", + // "img/rep-1-off-S.png", + // "img/rep-2-off-S.png", + // "img/cmp-off-S.png", + // ) }) #block(stroke: gray, width: 100%, height: 3in, { set text(size: 40pt) + show: schematic tile("img/white-concrete.png", 0, -2, -1) - tile("img/white-concrete.png", 0, -1, -1) - tile("img/white-concrete.png", 1, 0, 0) tile("img/white-concrete.png", 0, -1, 0) - tile("img/light-gray-concrete.png", 0, 0, -1) - tile("img/dust-off.png", 0, 0, 0) + tile("img/white-concrete.png", 0, 0, -1) + + tile("img/cmp-off-S.png", 0, 0, 0) + + tile("img/white-concrete-ghost.png", 1, 0, 0) + + // tile("img/glass.png", 1, 0, 0) + + // tile("img/white-concrete.png", 0, -3, 0) + // tile("img/gray-concrete.png", 0, -3, -1) + // + // tile("img/white-concrete.png", 3, 0, -1) + // tile("img/white-concrete.png", 2, 0, -1) + // tile("img/white-concrete.png", 1, 0, -1) + // tile("img/white-concrete.png", 0, 0, -1) + // tile("img/white-concrete.png", -1, 0, -1) + // tile("img/white-concrete.png", -2, 0, -1) + // tile("img/white-concrete.png", -3, 0, -1) + // + // tile("img/cmp-off.png", 3, 0, 0) + // tile("img/cmp-off.png", 2, 0, 0) + // tile("img/cmp-off.png", 1, 0, 0) + // tile("img/cmp-off.png", 0, 0, 0) + // tile("img/cmp-off.png", -1, 0, 0) + // tile("img/cmp-off.png", -2, 0, 0) + // tile("img/cmp-off.png", -3, 0, 0) +}) + +#block(stroke: gray, width: 100%, height: 3in, { + set text(size: 40pt) + show: schematic + + // tile("img/white-concrete.png", 0, -2, -1) + // tile("img/white-concrete.png", 0, -1, -1) + // tile("img/white-concrete.png", 1, 0, 0) + // tile("img/white-concrete.png", 0, -1, 0) + // tile("img/light-gray-concrete.png", 0, 0, -1) + tile("img/light-gray-concrete.png", 0, 0, -1) // tile("img/white-concrete.png", 0, -3, 0) // tile("img/gray-concrete.png", 0, -3, -1)