| 1 | import { join } from "node:path"; |
| 2 | import { fillRect, makeRgba, writeRgbaPng } from "../../server/src/assets/placeholderPng.js"; |
| 3 | |
| 4 | const root = join(import.meta.dirname, "..", "assets"); |
| 5 | |
| 6 | function solid (file, color, border = [20, 20, 24, 255]) |
| 7 | { |
| 8 | const image = makeRgba(16, 16, color); |
| 9 | fillRect(image, 0, 0, 16, 1, border); |
| 10 | fillRect(image, 0, 15, 16, 1, border); |
| 11 | fillRect(image, 0, 0, 1, 16, border); |
| 12 | fillRect(image, 15, 0, 1, 16, border); |
| 13 | writeRgbaPng(file, 16, 16, image.pixels); |
| 14 | } |
| 15 | |
| 16 | function overlay (file, color) |
| 17 | { |
| 18 | const image = makeRgba(16, 16, [0, 0, 0, 0]); |
| 19 | fillRect(image, 4, 3, 8, 11, color); |
| 20 | writeRgbaPng(file, 16, 16, image.pixels); |
| 21 | } |
| 22 | |
| 23 | function torchBloom (file) |
| 24 | { |
| 25 | const image = makeRgba(16, 16, [0, 0, 0, 0]); |
| 26 | const rings = [ |
| 27 | { x: 3, y: 2, w: 10, h: 10, rgba: [180, 48, 12, 90] }, |
| 28 | { x: 4, y: 3, w: 8, h: 8, rgba: [230, 110, 24, 160] }, |
| 29 | { x: 5, y: 4, w: 6, h: 6, rgba: [255, 190, 48, 220] }, |
| 30 | { x: 6, y: 5, w: 4, h: 4, rgba: [255, 245, 200, 255] } |
| 31 | ]; |
| 32 | for (const ring of rings) |
| 33 | { fillRect(image, ring.x, ring.y, ring.w, ring.h, ring.rgba); } |
| 34 | writeRgbaPng(file, 16, 16, image.pixels); |
| 35 | } |
| 36 | |
| 37 | solid(join(root, "items", "paper", "paper.png"), [232, 224, 196, 255]); |
| 38 | solid(join(root, "items", "apple", "apple.png"), [196, 48, 48, 255]); |
| 39 | solid(join(root, "items", "stick", "stick.png"), [140, 92, 44, 255]); |
| 40 | solid(join(root, "items", "blank-cheque", "blank-cheque.png"), [168, 214, 168, 255]); |
| 41 | solid(join(root, "items", "clothing", "shirt.png"), [72, 112, 176, 255]); |
| 42 | solid(join(root, "blocks", "spawner", "spawner.png"), [168, 64, 196, 255], [80, 20, 96, 255]); |
| 43 | solid(join(root, "blocks", "bank", "bank.png"), [212, 176, 72, 255], [96, 72, 16, 255]); |
| 44 | solid(join(root, "blocks", "church-altar", "church-altar.png"), [210, 210, 220, 255], [76, 72, 88, 255]); |
| 45 | solid(join(root, "mobs", "deer", "deer.png"), [120, 78, 42, 255]); |
| 46 | solid(join(root, "mobs", "rat", "rat.png"), [96, 88, 72, 255], [40, 36, 28, 255]); |
| 47 | overlay(join(root, "items", "stick", "stick-equip.png"), [150, 98, 46, 230]); |
| 48 | overlay(join(root, "items", "clothing", "shirt-equip.png"), [72, 112, 176, 230]); |
| 49 | solid(join(root, "items", "lantern", "lantern.png"), [180, 120, 40, 255]); |
| 50 | solid(join(root, "items", "bones", "bones.png"), [218, 210, 180, 255], [92, 84, 68, 255]); |
| 51 | solid(join(root, "items", "skull", "skull.png"), [205, 198, 170, 255], [80, 72, 60, 255]); |
| 52 | overlay(join(root, "items", "lantern", "lantern-equip.png"), [200, 130, 48, 230]); |
| 53 | torchBloom(join(root, "items", "lantern", "lantern-equip-bloom.png")); |
| 54 | torchBloom(join(root, "blocks", "torch", "torch-bloom.png")); |
| 55 | |
| 56 | // Water caustic noise (64×64 RGB tiling Perlin) — regenerate via: |
| 57 | // node client/scripts/write-water-caustics-noise.mjs |
| 58 | |
| 59 | |
| 60 | { |
| 61 | const image = makeRgba(24, 8, [0, 0, 0, 0]); |
| 62 | fillRect(image, 1, 2, 22, 4, [240, 220, 160, 220]); |
| 63 | fillRect(image, 0, 3, 24, 2, [255, 245, 200, 255]); |
| 64 | writeRgbaPng(join(root, "fx", "melee-swipe", "melee-swipe.png"), 24, 8, image.pixels); |
| 65 | } |
| 66 | |
| 67 | console.log("Wrote placeholder sprites under client/assets."); |