From 7dc08d851f9f5e3126bd50c903fb3cbe7617c941 Mon Sep 17 00:00:00 2001 From: Admin Date: Fri, 18 Sep 2026 00:05:07 +0000 Subject: [PATCH] Restore stable player hit collision path --- src/game-v4.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/game-v4.js b/src/game-v4.js index caf5acb..6a012b6 100644 --- a/src/game-v4.js +++ b/src/game-v4.js @@ -435,20 +435,11 @@ class GameScene extends Phaser.Scene { const damage = clamp(Number.isFinite(rawDamage) ? rawDamage : PIRATE_SHOT_DAMAGE, 1, 25); const { x, y } = shot; - // Do not destroy an Arcade body from inside the overlap callback. Disable - // it immediately, then clean it up and render impact FX on the next tick. - if (shot.body) shot.disableBody(true, true); - else shot.setActive(false).setVisible(false); - - this.time.delayedCall(0, () => { - if (shot?.scene) shot.destroy(); - try { - this.spawnExplosion(x, y, 0.32); - this.flashShip(this.player, 0xffcccc); - } catch (error) { - console.warn('Player impact FX failed', error); - } - }); + // Mirror the proven player-shot collision path: remove the projectile + // immediately, render impact feedback, then rate-limit hull damage only. + shot.destroy(); + this.spawnExplosion(x, y, 0.32); + this.flashShip(this.player, 0xffcccc); if (this.time.now - this.lastPlayerHitAt < PLAYER_HIT_COOLDOWN_MS) return; this.lastPlayerHitAt = this.time.now;