Revert "Added a server-only intent creation"

This reverts commit 3502c81187.
This commit is contained in:
aqw42
2025-06-05 18:26:10 +02:00
parent 3502c81187
commit 2e29024f84
4 changed files with 17 additions and 39 deletions
+1 -6
View File
@@ -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(),
});
+3 -7
View File
@@ -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`);
}