- Added `actionContextBuilder` to multiple turn action files to utilize the default action context builder. - Implemented specific context builders for actions requiring additional context, such as war configurations, world summaries, and general statistics. - Created new `actionContext.ts` and `actionContextHelpers.ts` files to define interfaces and helper functions for managing action contexts. - Enhanced context handling for nation and general actions, ensuring proper data injection for turn execution.
21 lines
840 B
TypeScript
21 lines
840 B
TypeScript
import type { GeneralActionDefinition } from '../definition.js';
|
|
import type { GeneralActionResolver } from '../engine.js';
|
|
import type { ActionContextBuilder } from './actionContext.js';
|
|
import type { TurnCommandEnv } from './commandEnv.js';
|
|
|
|
export interface TurnCommandSpecBase<TKey extends string = string> {
|
|
key: TKey;
|
|
category: string;
|
|
reqArg: boolean;
|
|
args: Record<string, unknown>;
|
|
createDefinition(env: TurnCommandEnv): GeneralActionDefinition;
|
|
}
|
|
|
|
export interface TurnCommandModule<TSpec extends TurnCommandSpecBase = TurnCommandSpecBase> {
|
|
commandSpec: TSpec;
|
|
ActionDefinition: new (...args: any[]) => GeneralActionDefinition;
|
|
ActionResolver?: new (...args: any[]) => GeneralActionResolver;
|
|
CommandResolver?: new (...args: any[]) => unknown;
|
|
actionContextBuilder?: ActionContextBuilder;
|
|
}
|