# BusTeleported

> Talos 0.7 · 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.

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

```ts
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

| Member | Signature | Description |
|---|---|---|
| `entity` | `entity: string` | Id of the entity that was moved. |
| `position` | `position: Vec3` | Where it landed, `[x, y, z]`: pushed out of geometry when it was put inside some. |
| `from` | `from: Vec3` | Where it was. |
| `yaw` | `yaw: number \| null` | The heading it was given, radians about +Y; null when the facing was left alone. |

## Example

The tested fixture `fixtures/app/agent.ts`.

```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
```
