mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-15 20:35:45 +00:00
Revert "Added a server-only intent creation"
This reverts commit 3502c81187.
This commit is contained in:
+1
-6
@@ -323,12 +323,7 @@ const IntentSchema = z.union([
|
||||
|
||||
export const TurnSchema = z.object({
|
||||
turnNumber: z.number(),
|
||||
intents: z.array(
|
||||
z.object({
|
||||
intent: IntentSchema,
|
||||
isServerSide: z.boolean(),
|
||||
}),
|
||||
),
|
||||
intents: z.array(IntentSchema),
|
||||
// The hash of the game state at the end of the turn.
|
||||
hash: z.number().nullable().optional(),
|
||||
});
|
||||
|
||||
@@ -39,10 +39,10 @@ export class Executor {
|
||||
}
|
||||
|
||||
createExecs(turn: Turn): Execution[] {
|
||||
return turn.intents.map((i) => this.createExec(i.intent, i.isServerSide));
|
||||
return turn.intents.map((i) => this.createExec(i));
|
||||
}
|
||||
|
||||
createExec(intent: Intent, isServerSide: boolean): Execution {
|
||||
createExec(intent: Intent): Execution {
|
||||
const player = this.mg.playerByClientID(intent.clientID);
|
||||
if (!player) {
|
||||
console.warn(`player with clientID ${intent.clientID} not found`);
|
||||
@@ -122,11 +122,7 @@ export class Executor {
|
||||
intent.variables ?? {},
|
||||
);
|
||||
case "mark_disconnected":
|
||||
if (isServerSide) {
|
||||
return new MarkDisconnectedExecution(player, intent.isDisconnected);
|
||||
} else {
|
||||
return new NoOpExecution();
|
||||
}
|
||||
return new MarkDisconnectedExecution(player, intent.isDisconnected);
|
||||
default:
|
||||
throw new Error(`intent type ${intent} not found`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user