Restore stable player hit collision path
This commit is contained in:
parent
36823472ed
commit
7dc08d851f
@ -435,20 +435,11 @@ class GameScene extends Phaser.Scene {
|
|||||||
const damage = clamp(Number.isFinite(rawDamage) ? rawDamage : PIRATE_SHOT_DAMAGE, 1, 25);
|
const damage = clamp(Number.isFinite(rawDamage) ? rawDamage : PIRATE_SHOT_DAMAGE, 1, 25);
|
||||||
const { x, y } = shot;
|
const { x, y } = shot;
|
||||||
|
|
||||||
// Do not destroy an Arcade body from inside the overlap callback. Disable
|
// Mirror the proven player-shot collision path: remove the projectile
|
||||||
// it immediately, then clean it up and render impact FX on the next tick.
|
// immediately, render impact feedback, then rate-limit hull damage only.
|
||||||
if (shot.body) shot.disableBody(true, true);
|
shot.destroy();
|
||||||
else shot.setActive(false).setVisible(false);
|
this.spawnExplosion(x, y, 0.32);
|
||||||
|
this.flashShip(this.player, 0xffcccc);
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this.time.now - this.lastPlayerHitAt < PLAYER_HIT_COOLDOWN_MS) return;
|
if (this.time.now - this.lastPlayerHitAt < PLAYER_HIT_COOLDOWN_MS) return;
|
||||||
this.lastPlayerHitAt = this.time.now;
|
this.lastPlayerHitAt = this.time.now;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user