mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-23 06:49:37 +00:00
Fixes
This commit is contained in:
@@ -182,14 +182,14 @@ export class GameRunner {
|
||||
playerID: PlayerID,
|
||||
x?: number,
|
||||
y?: number,
|
||||
TransportShipFilter?: TransportShipFilter,
|
||||
transportShipFilter?: TransportShipFilter,
|
||||
): PlayerActions {
|
||||
const player = this.game.player(playerID);
|
||||
const tile =
|
||||
x !== undefined && y !== undefined ? this.game.ref(x, y) : null;
|
||||
const actions = {
|
||||
canAttack: tile !== null && player.canAttack(tile),
|
||||
buildableUnits: player.buildableUnits(tile, TransportShipFilter),
|
||||
buildableUnits: player.buildableUnits(tile, transportShipFilter),
|
||||
canSendEmojiAllPlayers: player.canSendEmoji(AllPlayers),
|
||||
} as PlayerActions;
|
||||
|
||||
|
||||
@@ -863,7 +863,6 @@ export interface NameViewData {
|
||||
|
||||
// Filter for buildableUnits
|
||||
export enum TransportShipFilter {
|
||||
Default = "default", // Include
|
||||
Exclude = "exclude", // Exclude
|
||||
Only = "only", // TransportShip only
|
||||
Exclude = "exclude",
|
||||
Only = "only",
|
||||
}
|
||||
|
||||
@@ -275,13 +275,13 @@ export class PlayerView {
|
||||
|
||||
async actions(
|
||||
tile?: TileRef,
|
||||
TransportShipFilter?: TransportShipFilter,
|
||||
transportShipFilter?: TransportShipFilter,
|
||||
): Promise<PlayerActions> {
|
||||
return this.game.worker.playerInteraction(
|
||||
this.id(),
|
||||
tile && this.game.x(tile),
|
||||
tile && this.game.y(tile),
|
||||
TransportShipFilter,
|
||||
transportShipFilter,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -900,7 +900,7 @@ export class PlayerImpl implements Player {
|
||||
|
||||
public buildableUnits(
|
||||
tile: TileRef | null,
|
||||
transportShipFilter: TransportShipFilter = TransportShipFilter.Default,
|
||||
transportShipFilter?: TransportShipFilter,
|
||||
): BuildableUnit[] {
|
||||
const notInSpawnPhase = !this.mg.inSpawnPhase();
|
||||
const result: BuildableUnit[] = [];
|
||||
@@ -914,7 +914,7 @@ export class PlayerImpl implements Player {
|
||||
if (
|
||||
(u === UnitType.TransportShip &&
|
||||
transportShipFilter === TransportShipFilter.Exclude) ||
|
||||
(u !== UnitType.TradeShip &&
|
||||
(u !== UnitType.TransportShip &&
|
||||
transportShipFilter === TransportShipFilter.Only)
|
||||
) {
|
||||
continue;
|
||||
|
||||
@@ -83,7 +83,7 @@ ctx.addEventListener("message", async (e: MessageEvent<MainThreadMessage>) => {
|
||||
message.playerID,
|
||||
message.x,
|
||||
message.y,
|
||||
message.TransportShipFilter,
|
||||
message.transportShipFilter,
|
||||
);
|
||||
sendMessage({
|
||||
type: "player_actions_result",
|
||||
|
||||
@@ -163,7 +163,7 @@ export class WorkerClient {
|
||||
playerID: PlayerID,
|
||||
x?: number,
|
||||
y?: number,
|
||||
TransportShipFilter?: TransportShipFilter,
|
||||
transportShipFilter?: TransportShipFilter,
|
||||
): Promise<PlayerActions> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!this.isInitialized) {
|
||||
@@ -188,7 +188,7 @@ export class WorkerClient {
|
||||
playerID: playerID,
|
||||
x: x,
|
||||
y: y,
|
||||
TransportShipFilter: TransportShipFilter,
|
||||
transportShipFilter: transportShipFilter,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export interface PlayerActionsMessage extends BaseWorkerMessage {
|
||||
playerID: PlayerID;
|
||||
x?: number;
|
||||
y?: number;
|
||||
TransportShipFilter?: TransportShipFilter;
|
||||
transportShipFilter?: TransportShipFilter;
|
||||
}
|
||||
|
||||
export interface PlayerActionsResultMessage extends BaseWorkerMessage {
|
||||
|
||||
Reference in New Issue
Block a user