Preview placement rules
What this teaches
This scene separates “can I place here?” from “place it now.” GridActionRunner previews the built-in placement action without mutation, and Cell Metadata marks cells that the placement policy rejects.
Open and run
Menu path: Tools > Lost Lily > Grid Toolkit > Samples > Open > Tutorials > Place Structures and Rules.
Enter Play Mode. Move the pointer to preview, press R to rotate, left-click to place, and use Reset to rebuild the authored board.
Try it
- Hover an open footprint and confirm the preview is valid.
- Press R and watch the footprint orientation change.
- Compare an edge placement, a cell labelled BLOCKED, and an occupied cell.
- Return to an open footprint and click to commit it.
- Keep hovering and place a second valid structure.
Checkpoint
Invalid targets report a reason and leave the board unchanged. A valid click adds one structure and updates the HUD count. Reset removes runtime placements and restores the original blocked cells.
How it works
| Scene part | Public system | Responsibility |
|---|---|---|
| Placement controller | GridActionRunner |
Previews, then applies the same action. |
| Blocked-cell data | IGridCellBlockerReadModel | Exposes policy data without sample-specific coupling. |
| Board view | GridBoardView | Resolves the target cell and publishes preview intents. |
| Metadata renderer | Cell Metadata visualization | Makes blocked cells visible. |
Try another variation
In a duplicated scene, change which cells are blocked or change the structure footprint, then repeat the edge and occupied checks.
Troubleshooting
| Symptom | Fix |
|---|---|
| Every footprint is rejected. | Read the first HUD diagnostic; check board bounds, occupancy, and blocked cells separately. |
| A rotated preview does not fit. | Press R again or move far enough from the edge. |
Related
- Actions, transactions, and events
- Structures, footprints, layers, and occupancy
- GridActionRunner
- IGridCellBlockerReadModel
- GridBoardView
Next sample
Continue with Move a structure.