mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-16 19:10:15 +00:00
Added a server-only intent creation
This commit is contained in:
@@ -39,10 +39,10 @@ export class Executor {
|
||||
}
|
||||
|
||||
createExecs(turn: Turn): Execution[] {
|
||||
return turn.intents.map((i) => this.createExec(i));
|
||||
return turn.intents.map((i) => this.createExec(i.intent, i.isServerSide));
|
||||
}
|
||||
|
||||
createExec(intent: Intent): Execution {
|
||||
createExec(intent: Intent, isServerSide: boolean): Execution {
|
||||
const player = this.mg.playerByClientID(intent.clientID);
|
||||
if (!player) {
|
||||
console.warn(`player with clientID ${intent.clientID} not found`);
|
||||
@@ -122,7 +122,11 @@ export class Executor {
|
||||
intent.variables ?? {},
|
||||
);
|
||||
case "mark_disconnected":
|
||||
return new MarkDisconnectedExecution(player, intent.isDisconnected);
|
||||
if (isServerSide) {
|
||||
return new MarkDisconnectedExecution(player, intent.isDisconnected);
|
||||
} else {
|
||||
return new NoOpExecution();
|
||||
}
|
||||
default:
|
||||
throw new Error(`intent type ${intent} not found`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user