Skip to content

Commit 9be10ab

Browse files
committed
Fixes
1 parent 954c7f7 commit 9be10ab

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

src/core/GameRunner.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,14 @@ export class GameRunner {
196196
playerID: PlayerID,
197197
x?: number,
198198
y?: number,
199-
units?: readonly PlayerBuildableUnitType[] | null,
199+
units?: PlayerBuildableUnitType[] | null,
200200
): PlayerActions {
201201
const player = this.game.player(playerID);
202202
const tile =
203203
x !== undefined && y !== undefined ? this.game.ref(x, y) : null;
204204
const actions = {
205205
canAttack: tile !== null && player.canAttack(tile),
206-
buildableUnits:
207-
units === null ? [] : player.buildableUnits(tile, units),
206+
buildableUnits: units === null ? [] : player.buildableUnits(tile, units),
208207
canSendEmojiAllPlayers: player.canSendEmoji(AllPlayers),
209208
canEmbargoAll: player.canEmbargoAll(),
210209
} as PlayerActions;

src/core/execution/PlayerExecution.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { Config } from "../configuration/Config";
2-
import { Cell, Execution, Game, isStructureType, Player, UnitType } from "../game/Game";
2+
import {
3+
Cell,
4+
Execution,
5+
Game,
6+
isStructureType,
7+
Player,
8+
UnitType,
9+
} from "../game/Game";
310
import { TileRef } from "../game/GameMap";
411
import { calculateBoundingBox, getMode, inscribed, simpleHash } from "../Util";
512

@@ -35,7 +42,7 @@ export class PlayerExecution implements Execution {
3542
tick(ticks: number) {
3643
this.player.decayRelations();
3744
for (const u of this.player.units()) {
38-
if (!isStructureType(u.type())){
45+
if (!isStructureType(u.type())) {
3946
continue;
4047
}
4148

src/core/game/Game.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ export interface Player {
656656
unitsOwned(type: UnitType): number;
657657
buildableUnits(
658658
tile: TileRef | null,
659-
units?: readonly PlayerBuildableUnitType[],
659+
units?: PlayerBuildableUnitType[],
660660
): BuildableUnit[];
661661
canBuild(type: UnitType, targetTile: TileRef): TileRef | false;
662662
buildUnit<T extends UnitType>(

src/core/game/GameView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ export class PlayerView {
406406

407407
async actions(
408408
tile?: TileRef,
409-
units?: readonly PlayerBuildableUnitType[] | null,
409+
units?: PlayerBuildableUnitType[] | null,
410410
): Promise<PlayerActions> {
411411
return this.game.worker.playerInteraction(
412412
this.id(),

src/core/worker/WorkerClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export class WorkerClient {
165165
playerID: PlayerID,
166166
x?: number,
167167
y?: number,
168-
units?: readonly PlayerBuildableUnitType[] | null,
168+
units?: PlayerBuildableUnitType[] | null,
169169
): Promise<PlayerActions> {
170170
return new Promise((resolve, reject) => {
171171
if (!this.isInitialized) {

src/core/worker/WorkerMessages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export interface PlayerActionsMessage extends BaseWorkerMessage {
6363
playerID: PlayerID;
6464
x?: number;
6565
y?: number;
66-
units?: readonly PlayerBuildableUnitType[];
66+
units?: PlayerBuildableUnitType[] | null;
6767
}
6868

6969
export interface PlayerActionsResultMessage extends BaseWorkerMessage {

0 commit comments

Comments
 (0)