Ara
Download

Search or run a command

Jump to a section or open an Ara link.

Struct · Ara

CommandContext

What a CommandAttribute command sees: the tick, the caller, a deterministic Rng, structural Commands and cues. A ref struct, so commands cannot capture it in lambdas or keep it past the call.

public ref struct CommandContext

Constructors

CommandContext

public CommandContext(CommandCall* call);

Created by generated command entry points.

Properties

Tick

public ref readonly Tick Tick { get; }

The current tick.

Caller

public Entity Caller { get; }

The calling entity, or Null for tools and agents.

Commands

public Commands Commands { get; }

Structural changes, applied only if the command succeeds.

Fields

Rng

public Rng Rng;

Deterministic random numbers for this command call.

Methods

Reject

public CommandResult Reject(string reason);

Rejects the call with a short machine-readable reason (cannot_heal).

Cue

public void Cue<T>(in T cue) where T : unmanaged, ICue<T>;

Emits a presentation cue (kept only if the command succeeds).

Finish

public int Finish(CommandResult result);

Used by generated entry points: writes a rejection reason into the call and maps the result to an ABI status.

MissingComponent

public int MissingComponent(string component);

Used by generated entry points when the target lacks a component parameter.