SOURCE / PINNED RELEASE
Made of little things.
GRAV / RIFT
- Release
- 288aa261ce07…
- Author-recorded commit
- c549b5a4e17e…
- License
- LICENSE
- Author’s source reference
- nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-8a7361981e8
Archive hash verified: e52a01aff70810b3…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
import type { Body } from './physics.js';
export type ReleaseMode = 0 | 1 | 2;
export const RELEASE_NAMES=['VOLLEY','STREAM','CLUSTERS'];
/** Selects physical cargo at a cadence; never clones, deletes or limits payload. */
export class Launcher {
mode: ReleaseMode=0;
private cooldown=0;
private fireWas=false;
setMode(mode: ReleaseMode): void { this.mode=mode;this.cooldown=0; }
clear(): void { this.cooldown=0;this.fireWas=false; }
tick(dt: number,fire: boolean,payload: Body[]): Body[] {
this.cooldown=Math.max(0,this.cooldown-dt);
const trigger=fire&&(this.mode!==0||!this.fireWas);this.fireWas=fire;
if(!payload.length)return [];
if(!trigger||this.cooldown>0)return [];
const count=this.mode===0?payload.length:this.mode===1?1:5;
const shot=payload.slice(0,count);this.cooldown=this.mode===1?.075:this.mode===2?.38:0;
return shot;
}
}
