|
All checks were successful
Build / build (push) Successful in 1m26s
Implemented a comprehensive ship status management system with event-driven gauge updates and integrated fuel consumption for both linear and angular thrust. **New File: src/shipStatus.ts** - ShipStatus class with Observable pattern for status change events - Manages fuel, hull, and ammo values with automatic clamping (0-1 range) - Configurable max values for each resource type - Public getters: fuel, hull, ammo, getValues() - Setter methods: setFuel(), setHull(), setAmmo() with automatic event firing - Convenience methods: addFuel(), consumeFuel(), damageHull(), repairHull(), addAmmo(), consumeAmmo() - Status check methods: isFuelEmpty(), isDestroyed(), isAmmoEmpty() - Utility methods: reset(), setMaxValues(), dispose() - ShipStatusChangeEvent interface with statusType, oldValue, newValue, delta fields **Modified: src/scoreboard.ts** - Integrated ShipStatus instance as private _shipStatus - Constructor subscribes to ShipStatus.onStatusChanged observable - Added public shipStatus getter to expose status manager - Created createGaugesDisplay() method with 3 bar gauges (FUEL, HULL, AMMO) - Created createGaugeBar() helper for individual gauge construction - Added getBarColor() with smooth RGB gradient: green (1.0) -> yellow (0.5) -> red (0.0) - Renamed public methods to private: updateFuelBar(), updateHullBar(), updateAmmoBar() - Observable subscription automatically updates gauge visuals when status changes - Added dispose() method for cleanup of ShipStatus and observables - Updated initialize() to retrieve and setup screen/gauges meshes from GLB - Set initial test values to full (1.0) for all gauges **Modified: src/shipPhysics.ts** - Added ShipStatus import and private _shipStatus property - Added setShipStatus() method to connect status manager - Modified applyForces() to check fuel availability before applying linear force - Linear thrust fuel consumption: linearMagnitude (0-1) * 0.005 per frame - Added fuel check and consumption for angular thrust (rotation) - Angular thrust fuel consumption: normalized angularMagnitude (0-1) * 0.005 per frame - Forces only applied when fuel > 0 **Modified: src/ship.ts** - Connected ShipPhysics to Scoreboard's ShipStatus via setShipStatus() - Called immediately after physics initialization (line 148) This creates a fully integrated system where: 1. Ship movement (linear and angular) consumes fuel proportional to thrust 2. Fuel depletion prevents further thrust application 3. Gauge displays automatically update via observable events with color coding 4. Other systems can monitor/modify ship status through the same interface 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .github/workflows | ||
| docs | ||
| public | ||
| scripts | ||
| server | ||
| src | ||
| themes/default | ||
| .gitignore | ||
| CLAUDE.md | ||
| CONTROLLER_THRUST.md | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| styles.css | ||
| tsconfig.json | ||
| vite.config.ts | ||