Talos docs

BusTeleported

Since 0.6

Payload of the engine-published "teleported" event: a tool moved an entity outright with POST /entity/{id}/teleport — a bench putting the player on a mark, an editor.

Plain text

The move is the one {@link EntityHandle.teleport} makes (a controller's velocity cleared, no interpolation across), and nothing else about the world was rewound: a behaviour that keeps its own velocity, jump or state machine resets it here. Raised at the top of the tick after the move, before the controllers step and before behaviours' update; by is null. It reaches {@link Behavior.onEvent} as well as on/once, and GET /events?filter=teleported lists it. A behaviour's own ctx.entity.teleport raises nothing: it already knows. ts ctx.events.on("teleported", (ev) => { if (ev.data.entity === ctx.entity.id) ctx.state.velocity = [0, 0, 0] })

Signature

export interface BusTeleported {
  /** Id of the entity that was moved. */
  entity: string
  /** Where it landed, `[x, y, z]`: pushed out of geometry when it was put inside some. */
  position: Vec3
  /** Where it was. */
  from: Vec3
  /** The heading it was given, radians about +Y; null when the facing was left alone. */
  yaw: number | null
}

Import: import type { BusTeleported } from "@argus/api"

Members

MemberSignatureDescription
entityentity: stringId of the entity that was moved.
positionposition: Vec3Where it landed, [x, y, z]: pushed out of geometry when it was put inside some.
fromfrom: Vec3Where it was.
yawyaw: number | nullThe heading it was given, radians about +Y; null when the facing was left alone.

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