AfterOptions
Since 0.7
Options of {@link TimeInfo.after}.
Signature
export interface AfterOptions {
/**
* Raise it as `ctx.events.emitTo(to, …)` would: only that entity's behaviours hear it. Kept as
* the entity's id, so a target gone by then is heard by nobody.
*/
to?: string | EntityHandle
}
Import: import type { AfterOptions } from "@argus/api"
Members
| Member | Signature | Description |
|---|---|---|
to | to?: string | EntityHandle | Raise it as ctx.events.emitTo(to, …) would: only that entity's behaviours hear it. Kept as the entity's id, so a target gone by then is heard by nobody. |
Example
The tested fixture fixtures/app/agent.ts.
import type { Behavior } from "@argus/api"
// Sends a nav agent to `props.target` once, then reports arrival through ctx.state so the
// test can read it without polling the crowd directly.
export default {
init(ctx) {
ctx.state.arrived = false
ctx.nav?.goTo(ctx.props.target as [number, number, number])
},
update(ctx) {
if (ctx.nav?.arrived) ctx.state.arrived = true
},
} satisfies Behavior