Use tested queued hit processor
This commit is contained in:
parent
4ff7edd030
commit
39c13fbeb4
@ -3,7 +3,7 @@ import './style.css';
|
|||||||
import airshipSheetUrl from './assets/airships.svg?url';
|
import airshipSheetUrl from './assets/airships.svg?url';
|
||||||
import explosionSheetUrl from './assets/explosions.svg?url';
|
import explosionSheetUrl from './assets/explosions.svg?url';
|
||||||
import { airshipLog, registerDebugSnapshot } from './diagnostics.js';
|
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 WORLD_SIZE = 2400;
|
||||||
const PLAYER_MAX_SPEED = 180;
|
const PLAYER_MAX_SPEED = 180;
|
||||||
@ -534,16 +534,12 @@ class GameScene extends Phaser.Scene {
|
|||||||
const hits = this.pendingPlayerHits;
|
const hits = this.pendingPlayerHits;
|
||||||
this.pendingPlayerHits = [];
|
this.pendingPlayerHits = [];
|
||||||
|
|
||||||
for (const { shot } of hits) {
|
|
||||||
if (shot?.active) shot.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
const beforeHull = this.playerHull;
|
const beforeHull = this.playerHull;
|
||||||
const result = reducePlayerHitQueue({
|
const result = processQueuedPlayerHits({
|
||||||
hull: this.playerHull,
|
hull: this.playerHull,
|
||||||
lastHitAt: this.lastPlayerHitAt,
|
lastHitAt: this.lastPlayerHitAt,
|
||||||
now: this.time.now,
|
now: this.time.now,
|
||||||
damages: hits.map(({ damage }) => damage),
|
hits,
|
||||||
cooldownMs: PLAYER_HIT_COOLDOWN_MS,
|
cooldownMs: PLAYER_HIT_COOLDOWN_MS,
|
||||||
maxHull: PLAYER_MAX_HULL,
|
maxHull: PLAYER_MAX_HULL,
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user