import { join } from "node:path"; import { fillRect, makeRgba, writeRgbaPng } from "../../server/src/assets/placeholderPng.js"; const root = join(import.meta.dirname, "..", "assets"); function solid (file, color, border = [20, 20, 24, 255]) { const image = makeRgba(16, 16, color); fillRect(image, 0, 0, 16, 1, border); fillRect(image, 0, 15, 16, 1, border); fillRect(image, 0, 0, 1, 16, border); fillRect(image, 15, 0, 1, 16, border); writeRgbaPng(file, 16, 16, image.pixels); } function overlay (file, color) { const image = makeRgba(16, 16, [0, 0, 0, 0]); fillRect(image, 4, 3, 8, 11, color); writeRgbaPng(file, 16, 16, image.pixels); } function torchBloom (file) { const image = makeRgba(16, 16, [0, 0, 0, 0]); const rings = [ { x: 3, y: 2, w: 10, h: 10, rgba: [180, 48, 12, 90] }, { x: 4, y: 3, w: 8, h: 8, rgba: [230, 110, 24, 160] }, { x: 5, y: 4, w: 6, h: 6, rgba: [255, 190, 48, 220] }, { x: 6, y: 5, w: 4, h: 4, rgba: [255, 245, 200, 255] } ]; for (const ring of rings) { fillRect(image, ring.x, ring.y, ring.w, ring.h, ring.rgba); } writeRgbaPng(file, 16, 16, image.pixels); } solid(join(root, "items", "paper", "paper.png"), [232, 224, 196, 255]); solid(join(root, "items", "apple", "apple.png"), [196, 48, 48, 255]); solid(join(root, "items", "stick", "stick.png"), [140, 92, 44, 255]); solid(join(root, "items", "blank-cheque", "blank-cheque.png"), [168, 214, 168, 255]); solid(join(root, "items", "clothing", "shirt.png"), [72, 112, 176, 255]); solid(join(root, "blocks", "spawner", "spawner.png"), [168, 64, 196, 255], [80, 20, 96, 255]); solid(join(root, "blocks", "bank", "bank.png"), [212, 176, 72, 255], [96, 72, 16, 255]); solid(join(root, "blocks", "church-altar", "church-altar.png"), [210, 210, 220, 255], [76, 72, 88, 255]); solid(join(root, "mobs", "deer", "deer.png"), [120, 78, 42, 255]); solid(join(root, "mobs", "rat", "rat.png"), [96, 88, 72, 255], [40, 36, 28, 255]); overlay(join(root, "items", "stick", "stick-equip.png"), [150, 98, 46, 230]); overlay(join(root, "items", "clothing", "shirt-equip.png"), [72, 112, 176, 230]); solid(join(root, "items", "lantern", "lantern.png"), [180, 120, 40, 255]); solid(join(root, "items", "bones", "bones.png"), [218, 210, 180, 255], [92, 84, 68, 255]); solid(join(root, "items", "skull", "skull.png"), [205, 198, 170, 255], [80, 72, 60, 255]); overlay(join(root, "items", "lantern", "lantern-equip.png"), [200, 130, 48, 230]); torchBloom(join(root, "items", "lantern", "lantern-equip-bloom.png")); torchBloom(join(root, "blocks", "torch", "torch-bloom.png")); function writeWaterSheet (file, base, wave, foam) { const frames = 4; const width = 16 * frames; const height = 16; const image = makeRgba(width, height, base); for (let f = 0; f < frames; f++) { const ox = f * 16; for (let y = 0; y < 16; y++) { const t = y / 15; fillRect(image, ox, y, 16, 1, [ Math.round(base[0] * (1 - t * 0.15)), Math.round(base[1] * (1 - t * 0.08)), Math.round(base[2] * (1 + t * 0.05)), 255 ]); } for (let i = 0; i < 3; i++) { const y = 3 + ((i * 4 + f) % 10); const x0 = ox + ((f * 3 + i * 5) % 12); fillRect(image, x0, y, 5, 1, wave); fillRect(image, x0 + 1, y - 1, 3, 1, foam); } } writeRgbaPng(file, width, height, image.pixels); } writeWaterSheet(join(root, "grounds", "water", "water.png"), [48, 118, 168, 255], [90, 170, 210, 255], [170, 220, 240, 220]); writeWaterSheet(join(root, "grounds", "deep-water", "deep-water.png"), [28, 72, 118, 255], [55, 120, 170, 255], [110, 170, 210, 200]); { const image = makeRgba(24, 8, [0, 0, 0, 0]); fillRect(image, 1, 2, 22, 4, [240, 220, 160, 220]); fillRect(image, 0, 3, 24, 2, [255, 245, 200, 255]); writeRgbaPng(join(root, "fx", "melee-swipe", "melee-swipe.png"), 24, 8, image.pixels); } console.log("Wrote placeholder sprites under client/assets.");