# WritableComponents

> Talos 0.6 · Since 0.6

The component types {@link EntityHandle.set} can write, and the fields each one takes.

## Signature

```ts
export interface WritableComponents {
  /**
   * The material of this entity's mesh — a runtime tint, not the asset. Requires a `mesh`
   * component.
   */
  material: {
    /** Multiplies the material's own colour. Default `[1, 1, 1, 1]`, which is the asset as it is. */
    baseColor?: ColorValue
    /** Extra brightness, 0 for none. A gain on the surface, not a light: see {@link EntityHandle.set}. */
    emissive?: number
  }
  light: {
    intensity?: number
    color?: ColorValue
    /**
     * Off without forgetting how bright it was: `on: false` stops the light contributing and
     * `on: true` brings it back at whatever `intensity` says. Not a scene field — the contract
     * has no way to author a light that is off — so it defaults to true.
     */
    on?: boolean
  }
  mesh: {
    /** Drawn or not. Not a scene field: an entity the scene does not want drawn simply has no mesh. */
    visible?: boolean
  }
}
```

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

## Members

| Member | Signature | Description |
|---|---|---|
| `material` | `material: {` | The material of this entity's mesh — a runtime tint, not the asset. Requires a `mesh` component. |
| `baseColor` | `baseColor?: ColorValue` | Multiplies the material's own colour. Default `[1, 1, 1, 1]`, which is the asset as it is. |
| `emissive` | `emissive?: number` | Extra brightness, 0 for none. A gain on the surface, not a light: see {@link EntityHandle.set}. |
| `light` | `light: {` |  |
| `intensity` | `intensity?: number` |  |
| `color` | `color?: ColorValue` |  |
| `on` | `on?: boolean` | Off without forgetting how bright it was: `on: false` stops the light contributing and `on: true` brings it back at whatever `intensity` says. Not a scene field — the contract has no way to author a light that is off — so it defaults to true. |
| `mesh` | `mesh: {` |  |
| `visible` | `visible?: boolean` | Drawn or not. Not a scene field: an entity the scene does not want drawn simply has no mesh. |

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