Restore safe player hit impact FX
This commit is contained in:
parent
a38bccca4d
commit
f489a3d8f4
@ -533,7 +533,12 @@ class GameScene extends Phaser.Scene {
|
||||
// happens from the scene update after the physics step; projectile cleanup
|
||||
// remains on the normal lifetime path to avoid collision-time lifecycle changes.
|
||||
shot.setData('playerHitQueued', true);
|
||||
this.pendingPlayerHits.push({ shot, damage });
|
||||
this.pendingPlayerHits.push({
|
||||
shot,
|
||||
damage,
|
||||
x: shot.x,
|
||||
y: shot.y,
|
||||
});
|
||||
|
||||
airshipLog('combat:player-hit-queued', {
|
||||
damage,
|
||||
@ -571,6 +576,23 @@ class GameScene extends Phaser.Scene {
|
||||
this.playerHull = result.hull;
|
||||
this.lastPlayerHitAt = result.lastHitAt;
|
||||
|
||||
if (result.appliedHits > 0) {
|
||||
const impact = hits[0];
|
||||
try {
|
||||
this.spawnExplosion(impact.x, impact.y, 0.32);
|
||||
this.flashShip(this.player, 0xffcccc);
|
||||
airshipLog('combat:player-hit-fx', {
|
||||
x: Math.round(impact.x),
|
||||
y: Math.round(impact.y),
|
||||
scale: 0.32,
|
||||
}, 'debug');
|
||||
} catch (error) {
|
||||
airshipLog('combat:player-hit-fx-error', {
|
||||
message: error?.message || String(error),
|
||||
}, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
airshipLog('combat:player-hit-processed', {
|
||||
queuedHits: hits.length,
|
||||
appliedHits: result.appliedHits,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user