> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rollingquest.kramgames.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Blocks

> How to place, move, copy, and remove blocks in the RollingQuest level editor. Understanding block templates, the 3D grid, and BlockOnly vs Side templates.

Blocks are the fundamental building units of every level. Each block is a cube placed at a specific 3D grid position (`BlockSlot`) and can have up to six sides (faces), each potentially holding an item, enemy, ball, or decoration.

## The Block Grid

The level is a 3D grid where each position is defined by integer coordinates `(X, Y, Z)`. The block selector cursor highlights the current position, and blocks can only be placed at these discrete grid points.

* The grid extends in all directions — there is no hard limit on level size
* Blocks cannot overlap — each `BlockSlot` can hold at most one block
* The origin `(0, 0, 0)` is the default starting position

## Block Templates

Each block uses a **template** that defines its visual appearance, material, and behavior. Templates come from the current theme — changing the theme changes which templates are available.

Templates are categorized as:

* **Side templates** — Standard blocks with 6 independent sides, each holding elements
* **BlockOnly templates** — Blocks without distinct sides (the entire block is treated as one unit). These cannot hold items/enemies/decorations on individual faces

## Placing Blocks

1. Press **B** to open the Blocks Pool
2. Select a block template from the grid
3. Navigate with **WASD/EQ** to position the selector
4. Press **Space** to insert the block

The block is created at the selector's position using the selected template. If a block already exists at that position, pressing **Space** will grab it instead.

### Block Properties Hold

When you copy a block template with **Shift+Tab**, the editor stores the element properties backup. The next block you insert will inherit those properties. This is useful for quickly placing blocks with identical configurations.

## Moving Blocks

1. Press **Space** on an existing block to **grab** it (all 6 faces highlight)
2. Use **WASD/EQ** to move the selector — the grabbed block moves with it
3. Press **Space** again to **ungrab** the block at the new position

When a block is moved, all attached items, enemies, and balls are repositioned to follow their respective sides. The editor also triggers the `OnEditorBlockMoved` callback on the block's template.

<Warning>
  You cannot move a block to a position that already contains another block. The movement is blocked and the selector stays in place.
</Warning>

## Removing Blocks

Press **Backspace** to remove the block at the selector position (or the currently selected block). Removing a block:

1. Triggers the `OnEditorBlockRemoved` callback on the template
2. Destroys all enemies and balls attached to its sides
3. Removes the block from the section's block network
4. Clears the block selector selection
5. Recomputes the level illumination

## Copying Block Templates

| Key           | Action                                                           |
| ------------- | ---------------------------------------------------------------- |
| **Tab**       | Copy the template name from the selected side to the Blocks Pool |
| **Shift+Tab** | Copy the template name AND element properties                    |

This lets you quickly replicate a block's configuration: select a side, press **Shift+Tab**, then press **Space** on an empty position to place a copy.

## Block Illumination

After any block insertion, removal, or movement, the editor calls `DynamicGI.UpdateEnvironment()` to recompute global illumination. This ensures lighting stays consistent as you build.

## Score Contribution

Each block template has an `EditorScore` value that contributes to the level's total score. BlockOnly templates contribute their score directly; side templates contribute per-side. The score is recalculated in real-time and displayed in the HUD.
