wip ghost blocks and tile wrappers
BIN
img/black-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
img/blue-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
img/brown-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
img/cyan-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
img/glass.png
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 1.7 KiB |
BIN
img/gray-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
img/green-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
img/light-blue-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
img/light-gray-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
img/lime-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
img/magenta-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
img/obs-N.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
img/orange-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
img/pink-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
img/purple-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
img/red-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 4.7 KiB |
BIN
img/white-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
img/yellow-concrete-ghost.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
229
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: <white>,
|
||||
light-gray: <light-gray>,
|
||||
gray: <gray>,
|
||||
black: <black>,
|
||||
brown: <brown>,
|
||||
red: <red>,
|
||||
orange: <orange>,
|
||||
yellow: <yellow>,
|
||||
lime: <lime>,
|
||||
green: <green>,
|
||||
cyan: <cyan>,
|
||||
light-blue: <light-blue>,
|
||||
blue: <blue>,
|
||||
purple: <purple>,
|
||||
magenta: <magenta>,
|
||||
pink: <pink>,
|
||||
)
|
||||
|
||||
#let facing = ()
|
||||
|
||||
#let power = (
|
||||
on: <on>,
|
||||
off: <off>,
|
||||
)
|
||||
|
||||
#let sub = <sub>
|
||||
#let lock = <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(<schematic-end>).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) <schematic-end>]
|
||||
}
|
||||
|
||||
#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()
|
||||
}
|
||||
// <cmp>,
|
||||
// <rep>,
|
||||
// <glass>,
|
||||
// <slab>,
|
||||
// <solid>,
|
||||
// <trapdoor>,
|
||||
// <soul-sand>,
|
||||
// <piston>,
|
||||
|
||||
#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)
|
||||
|
||||