import type { ClientMessageConditions, ClientMessageContext } from "../../conditions/context/clientMessage.js"; import type { ConditionErrorMessage } from "../../interaction/types.js"; import type { State } from "../../state/state.js"; import type { Command } from "../../command.js"; import type { BaseActionDefinition } from "../base.js"; import type { ActionDefinition } from "../types.js"; export type CollectionContext = Record> = { /** * Controlled by manager, marks if this instance of action * is marked as `pending` for the player * @readonly please */ pending: boolean; /** * Change to `false` to remove this action from `pending`. */ aborted: boolean; } & C; /** * @ignore */ export interface CollectionActionDefinition = Record> { name: string; setupContext: () => C; teardownContext: (context: CollectionContext) => void; /** * Should run checks against interaction in interactionAction etc */ checkPrerequisites(messageContext: ClientMessageContext, actionContext: CollectionContext): boolean; checkConditions: (test: ClientMessageConditions, messageContext: ClientMessageContext, actionContext: CollectionContext) => CollectionConditionsResult>; getCommand: (messageContext: ClientMessageContext, actionContext: CollectionContext) => Command; hasSuccessfulSubActions: (context: CollectionContext) => boolean; /** * Return `false` if this action should be marked as pending, and be the * only one for evaluation in subsequent player's events? */ hasFinished: (context: CollectionContext) => boolean; /** * Only used for debugging, for logs */ _allActionsCount?: () => number; /** * Only used for debugging, for logs */ _successfulActionsCount?: (context: CollectionContext) => number; /** * @deprecated figure out if needed... */ getSuccessfulAction?: (context: CollectionContext) => ActionDefinition; } /** * @ignore */ export type CollectionConditionsResult> = Map;