Document the editors and block scripting
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
985c34759d
commit
6482ef3294
3 files changed
+231
-2639
No files matched your search
@@ -53,7 +53,7 @@ But before committing a completed change, the full local checks should pass unle
|
|||||||
## Repository conventions
|
## Repository conventions
|
||||||
|
|
||||||
- The repository uses Rust with Rhai for mission scripting.
|
- The repository uses Rust with Rhai for mission scripting.
|
||||||
- Campaign editor scripts live mainly in `src/campaign_doc.rs` and `src/script.rs`.
|
- The campaign editor lives in `src/editor/`, the campaign file format in `src/campaign_doc.rs`, block scripts in `src/blocks.rs` and `src/mscript.rs`.
|
||||||
- Main runtime integration lives in `src/main.rs`.
|
- Main runtime integration lives in `src/main.rs`.
|
||||||
- Campaign mission conversion and custom mission gameplay live in `src/campaign.rs`.
|
- Campaign mission conversion and custom mission gameplay live in `src/campaign.rs`.
|
||||||
- UI/editor buttons and menus live in `src/menu.rs` and `src/ui.rs`.
|
- UI/editor buttons and menus live in `src/menu.rs` and `src/ui.rs`.
|
||||||
@@ -68,23 +68,15 @@ But before committing a completed change, the full local checks should pass unle
|
|||||||
|
|
||||||
## Campaign scripting conventions
|
## Campaign scripting conventions
|
||||||
|
|
||||||
- Mission script language: Rhai.
|
- Mission scripts are **blocks** (`src/blocks.rs`), edited in the in-game block editor (`src/editor/blocks_ui.rs`); players never see code.
|
||||||
|
- Blocks are translated into Rhai internally and run by `src/mscript.rs` inside the fixed simulation step (deterministic, co-op safe).
|
||||||
- The Rust Rhai dependency must keep `no_time` enabled in `Cargo.toml` so the WASM output stays loadable by the macroquad JS bundle.
|
- The Rust Rhai dependency must keep `no_time` enabled in `Cargo.toml` so the WASM output stays loadable by the macroquad JS bundle.
|
||||||
- Current implemented runtime hook: `on_start(m)`.
|
- Rhai reserves `spawn`; the internal API uses `spawn_unit`.
|
||||||
- Current implemented script actions:
|
- Per mission: special scripts (start, victory check, defeat check, clock) and triggers (`TriggerKind` in `src/campaign_doc.rs`).
|
||||||
- `m.log(text)`
|
- New block kinds need: the `Block`/`Val` variant, `template`/`kind_name`, palette entry, checking, Rhai translation, the API function in `mscript.rs`, the editor fields in `blocks_ui.rs`, `blk.*` texts in every language file, and a test.
|
||||||
- `m.objective(text)`
|
- Side numbers: -1 any, 0 player, 1 heroes, 2 Mossgrim, 3 Lady Nightwell, 4 rival 3.
|
||||||
- `m.spawn_at(side, kind, x, y, count, level)`
|
- Unknown creature names, zones, triggers and unset variables are reported by `blocks::check`.
|
||||||
- `m.spawn_count_in_zone(zone, kind, count, side, level)`
|
- Reference: `docs/CAMPAIGN_EDITOR.md` and `docs/MISSION_SCRIPTING.md`.
|
||||||
- `m.spawn_wave(count)`
|
|
||||||
- Rhai reserves `spawn`, so mission scripts use `spawn_at` for direct spawns.
|
|
||||||
- Side names currently accepted in script helper calls:
|
|
||||||
- `"PLAYER"` or side `0`
|
|
||||||
- `"HEROES"` or side `1`
|
|
||||||
- `"MOSSGRIM"` or side `2`
|
|
||||||
- `"NIGHTWELL"` or side `3`
|
|
||||||
- `"RIVAL3"` or side `4`
|
|
||||||
- Unknown creature names and unknown zone names should be rejected during script validation.
|
|
||||||
|
|
||||||
## Deployment policy
|
## Deployment policy
|
||||||
|
|
||||||
|
|||||||
+115
-966
File diff suppressed because it is too large.
Load diff
+107
-1656
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user