import type { Score, SelectorClass } from "sandstone"; import type { OBJECTIVE_CRITERION } from "sandstone/arguments/generated"; import type { AdvancementTriggers } from "sandstone/arguments/resources/AdvancementTriggers"; import type { BUILTIN_VARIABLE_NAMES, POSSIBLE_SCENARIO_EVENTS } from "./constants"; export { Actions } from "./actions"; /** * Represents a spawn point location, either as explicit coordinates or as an entity selector. * When using an entity selector, it should target a single entity (e.g., a location marker). */ export type SpawnPoint = { x: number; y: number; z: number; } | SelectorClass; export type _SpecificObjectiveVariable = { type: "individual"; objective_type: OBJECTIVE_CRITERION; /** The default value for the variable. 0 if undefined. */ default?: number; /** The updater function is used to dynamically compute the value of the variable. */ updater?: (value: Score, variables: Record) => void; }; export type _DummyGlobalVariable = { type: "global"; /** Whether the value should be displayed in-game. */ hidden?: boolean; /** The default value for the variable. 0 if undefined. */ default?: number; /** The updater function is used to dynamically compute the value of the variable. */ updater?: (value: Score, variables: Record) => void; }; export type _DummyIndividualVariable = { type: "individual"; /** The default value for the variable. 0 if undefined. */ default?: number; /** The updater function is used to dynamically compute the value of the variable. */ updater?: (value: Score, variables: Record) => void; }; /** * A custom variable defined for the whole challenge. */ export type _InputVariableType = _SpecificObjectiveVariable | _DummyGlobalVariable | _DummyIndividualVariable; export declare function isSpecificObjectiveVariable(variable: _InputVariableType): variable is _SpecificObjectiveVariable; /** * The base configuration necessary to define events, end conditions, and win conditions for a challenge. */ export type _BaseConfig = { /** * Name of the datapack that will be created for this challenge. */ name: string; /** * The path where the datapack will be created. It is expected to be `kradle-studio/challenges`. */ kradle_challenge_path: string; /** * Game duration in ticks. * * If not specified (or set to 0), the game will run indefinitely until * an explicit end condition is met. * * @default undefined (no time limit) */ GAME_DURATION?: number; roles: ROLE_NAMES[]; custom_variables: Record>; /** * The world spawn point for the challenge. * Can be either explicit coordinates `{ x, y, z }` or an entity selector * (e.g., from `Actions.getLocation({ name: "spawn" })`). * When using an entity selector, `setworldspawn` will be executed at the entity's location. */ spawnPoint?: SpawnPoint; /** * Per-challenge overrides for the implicit setup the SDK applies inside * `start_challenge` and `init_participants`. Defaults are sensible for * most challenges, so this can usually be omitted entirely. * * Pass partial overrides to disable individual rules — e.g. * `{ mobSpawning: true }` for a wave-defense challenge that needs * natural mob spawns, or `{ clearInventory: false }` for a PvP * challenge that pre-stocks inventory in `start_challenge`. * * Pass `false` to disable everything — the user is responsible for * setting up time, gamerules, and per-player init themselves. * * @default { time: "day", daylightCycle: false, mobSpawning: false, naturalRegeneration: true, clearInventory: true, maxHealth: 20 } */ defaults?: ChallengeDefaults | false; }; /** * Knobs for the implicit setup the SDK runs at the top of `start_challenge` * and `init_participants`. Each field is optional and falls back to the * SDK-level default; pass `false` for a boolean field to disable that rule. */ export type ChallengeDefaults = { /** * Initial in-game time. `false` to leave time alone (server-default; * clock continues based on world save). * @default "day" */ time?: "day" | "noon" | "night" | "midnight" | false; /** * `gamerule doDaylightCycle`. * @default false (sun stays at noon → consistent visibility for the run) */ daylightCycle?: boolean; /** * `gamerule doMobSpawning`. Override to `true` for wave-defense or * boss-summon challenges that depend on natural spawns. * @default false */ mobSpawning?: boolean; /** * `gamerule naturalRegeneration`. Override to `false` for tight * combat-tuned challenges where healing-on-idle would mask agent skill. * @default true */ naturalRegeneration?: boolean; /** * Clear every participant's inventory at the top of `init_participants`. * Override to `false` for PvP challenges that pre-stock inventory * during `start_challenge`. * @default true */ clearInventory?: boolean; /** * `setAttribute generic.max_health` per participant. Pass `false` to * leave health alone (vanilla 20 HP). Pass a number to set a non-default * cap (e.g. 40 for a longer-form survival challenge). * @default 20 */ maxHealth?: number | false; }; /** Resolved defaults — every field present, no `undefined` fallthroughs. */ export type ResolvedDefaults = { time: "day" | "noon" | "night" | "midnight" | false; daylightCycle: boolean; mobSpawning: boolean; naturalRegeneration: boolean; clearInventory: boolean; maxHealth: number | false; }; export declare const DEFAULT_CHALLENGE_DEFAULTS: ResolvedDefaults; /** * Resolve a partial `ChallengeDefaults` (or `false` for "skip all setup") * against the SDK-level defaults. Returns a fully-populated config the * SDK can read without optional-chaining everywhere. */ export declare function resolveChallengeDefaults(input: ChallengeDefaults | false | undefined): ResolvedDefaults | null; export type _ScenarioEvents = Partial void>>; export type Roles = { [role in ROLES_NAMES]: role; }; export type FullVariable = { type: "individual" | "global"; score: Score; default: number | undefined; updater: ((value: Score, variables: Record) => void) | undefined; }; /** * "Full" variables are the variables the challenges passes to the user in events/other variable updaters. */ export type FullVariables = Record>; export type Variables = Record; type _InputEventCommonProperties = { /** The target score to reach to trigger the event */ target?: number | undefined; /** The mode of the event, either fire once or fire every time the score reaches the target */ mode: "fire_once" | "repeatable"; /** Actions to execute when the event is triggered */ actions: () => void; }; export type _InputScoreCustomEventType = { /** The target score to reach to trigger the event */ score: Score; } & _InputEventCommonProperties; export type _InputAdvancementCustomEventType = { /** A list of criteria that must be met to trigger the event */ criteria: AdvancementTriggers[]; } & _InputEventCommonProperties; export type _InputCustomEventType = _InputScoreCustomEventType | _InputAdvancementCustomEventType; export type CustomScoreEvent = { /** The input event that defines the conditions for the custom event */ inputEvent: _InputScoreCustomEventType; /** The score that counts how many times the event has been triggered */ counter: Score; /** The type of the event */ type: "global" | "individual"; /** A name used for debugging purposes */ debugName: string; }; //# sourceMappingURL=types.d.ts.map