From 8fc956f112a37c4276dfd5f4c4f721b623f9ae74 Mon Sep 17 00:00:00 2001 From: Michael Mainguy Date: Sat, 8 Nov 2025 03:58:11 -0600 Subject: [PATCH] Step 3: Track hull damage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added real-time tracking of cumulative hull damage from collisions. **Modified: src/ship.ts** - Subscribe to shipStatus.onStatusChanged in initialize() - Filter for hull status type with negative delta (damage, not repair) - Call gameStats.recordHullDamage() with absolute value of delta - Accumulates all damage over time (e.g., 15 hits at 0.01 each = 0.15 total) The Hull Damage Taken statistic now updates in real-time on the status screen, showing cumulative damage as a percentage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/ship.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ship.ts b/src/ship.ts index 92d10bc..9c51599 100644 --- a/src/ship.ts +++ b/src/ship.ts @@ -215,6 +215,14 @@ export class Ship { this._gameStats.recordAsteroidDestroyed(); }); + // Subscribe to ship status changes to track hull damage + this._scoreboard.shipStatus.onStatusChanged.add((event) => { + if (event.statusType === "hull" && event.delta < 0) { + // Hull damage (delta is negative) + this._gameStats.recordHullDamage(Math.abs(event.delta)); + } + }); + // Initialize status screen this._statusScreen = new StatusScreen(DefaultScene.MainScene, this._gameStats); this._statusScreen.initialize(this._camera);