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