#!/usr/bin/env node /** * Dual-channel arrow projectile template for client/assets/fx/projectile/arrow.png * * Channel convention (same as items/arrow/full-arrow.png): * - Dominant RED → shaft mask (lightness = R); tinted with wood tier at runtime * - Dominant BLUE → tip mask (lightness = B); tinted with metal tier at runtime * - Neutral WHITE → fletching / bindings; left unchanged * * Regenerate after hand-editing the layout: * node client/scripts/write-arrow-projectile-template.mjs * * Runtime: WorldView.spawnPhysicalProjectileFx uses DUAL_TINT_LIT_SPRITE shader when * combat-projectile carries shaftTint + tipTint from the server. */ import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; import { writeRgbaPng, makeRgba, fillRect } from "../../server/src/assets/placeholderPng.js"; const W = 24; const H = 8; const out = join(dirname(fileURLToPath(import.meta.url)), "..", "assets", "fx", "projectile", "arrow.png"); const image = makeRgba(W, H, [0, 0, 0, 0]); // Shaft — pure red channel (wood tint applied in shader) for (let x = 4; x < 16; x++) { fillRect(image, x, 3, 1, 2, [220, 0, 0, 255]); } // Tip — pure blue channel (metal tint applied in shader) fillRect(image, 16, 2, 4, 4, [0, 0, 220, 255]); fillRect(image, 20, 3, 2, 2, [0, 0, 255, 255]); // Fletching — white, untouched by dual tint fillRect(image, 0, 2, 3, 4, [245, 245, 245, 255]); fillRect(image, 1, 1, 2, 1, [255, 255, 255, 255]); fillRect(image, 1, 6, 2, 1, [255, 255, 255, 255]); writeRgbaPng(out, W, H, image.pixels); console.log(`Wrote dual-channel projectile template: ${out} (${W}×${H})`);