From 45036defcbfb14dd38878fbe8f810ff6fb0b81bc Mon Sep 17 00:00:00 2001 From: aqw42 Date: Thu, 29 May 2025 18:43:03 +0200 Subject: [PATCH] missing files --- resources/images/IdleIcon.svg | 1 + src/core/execution/MarkIdleExecution.ts | 43 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 resources/images/IdleIcon.svg create mode 100644 src/core/execution/MarkIdleExecution.ts diff --git a/resources/images/IdleIcon.svg b/resources/images/IdleIcon.svg new file mode 100644 index 000000000..fd07fe512 --- /dev/null +++ b/resources/images/IdleIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/core/execution/MarkIdleExecution.ts b/src/core/execution/MarkIdleExecution.ts new file mode 100644 index 000000000..ccf990f32 --- /dev/null +++ b/src/core/execution/MarkIdleExecution.ts @@ -0,0 +1,43 @@ +import { Execution, Game, Player, PlayerID } from "../game/Game"; + +export class MarkIdleExecution implements Execution { + private player: Player; + private active: boolean = true; + + constructor( + private playerID: PlayerID, + private isIdle: boolean, + ) {} + + init(mg: Game, ticks: number): void { + if (!mg.hasPlayer(this.playerID)) { + console.warn( + `MarkIdleExecution: player ${this.playerID} not found in game`, + ); + this.active = false; + return; + } + + this.player = mg.player(this.playerID); + if (!this.player) { + console.warn( + `MarkIdleExecution: failed to retrieve player ${this.playerID}`, + ); + this.active = false; + return; + } + } + + tick(ticks: number): void { + this.player.markIdle(this.isIdle); + this.active = false; + } + + isActive(): boolean { + return this.active; + } + + activeDuringSpawnPhase(): boolean { + return false; + } +}