Use tested queued hit processor

This commit is contained in:
Admin 2026-09-18 00:40:19 +00:00
parent 4ff7edd030
commit 39c13fbeb4

View File

@ -3,7 +3,7 @@ import './style.css';
import airshipSheetUrl from './assets/airships.svg?url';
import explosionSheetUrl from './assets/explosions.svg?url';
import { airshipLog, registerDebugSnapshot } from './diagnostics.js';
import { normalizePlayerDamage, reducePlayerHitQueue } from './game-logic.js';
import { normalizePlayerDamage, processQueuedPlayerHits } from './game-logic.js';
const WORLD_SIZE = 2400;
const PLAYER_MAX_SPEED = 180;
@ -534,16 +534,12 @@ class GameScene extends Phaser.Scene {
const hits = this.pendingPlayerHits;
this.pendingPlayerHits = [];
for (const { shot } of hits) {
if (shot?.active) shot.destroy();
}
const beforeHull = this.playerHull;
const result = reducePlayerHitQueue({
const result = processQueuedPlayerHits({
hull: this.playerHull,
lastHitAt: this.lastPlayerHitAt,
now: this.time.now,
damages: hits.map(({ damage }) => damage),
hits,
cooldownMs: PLAYER_HIT_COOLDOWN_MS,
maxHull: PLAYER_MAX_HULL,
});