diff options
Diffstat (limited to 'docs/lua-modding.md')
| -rw-r--r-- | docs/lua-modding.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/lua-modding.md b/docs/lua-modding.md index 3231797ed..a3c82890e 100644 --- a/docs/lua-modding.md +++ b/docs/lua-modding.md | |||
| @@ -188,6 +188,36 @@ go on. A syntax error or a missing script is the same at load. A Rust panic in t | |||
| 188 | `"name"` (shown in logs). A folder without `"script"` (an asset mod, `docs/modding.md`) is not a Lua mod and is left | 188 | `"name"` (shown in logs). A folder without `"script"` (an asset mod, `docs/modding.md`) is not a Lua mod and is left |
| 189 | alone; a mod can have both. Load order is the folder names', sorted. | 189 | alone; a mod can have both. Load order is the folder names', sorted. |
| 190 | 190 | ||
| 191 | ## The gate's driver mod | ||
| 192 | |||
| 193 | `mods/gate_driver` takes a run from the title's menus into the world with no person, for in-game gates and A/Bs. It | ||
| 194 | ships disabled: a run enables a copy of it in a mods folder of its own (`LEONIDA_MODS`). It needs | ||
| 195 | `LEONIDA_GAME_ACTIONS=1`, for `leonida.player_position()`. | ||
| 196 | |||
| 197 | - **The menus.** It presses Enter only once frames have moved on since the last press, every 25 s, until the player's | ||
| 198 | position is known. A start that takes minutes to compile pipelines does not throw its presses away. | ||
| 199 | - **Control.** Holding W for 3 s must move the player at least 1 m and at most 30 m. More is the title placing the | ||
| 200 | player itself (a load, a cutscene), not a walk: it tries again (`GATE PROBE ... placed`). Less is a screen that | ||
| 201 | still waits: it presses once more (`GATE PROBE ... still`) and tries again. | ||
| 202 | - **Then.** `idle` (the default) stands still, for measuring. `roam` walks a fixed loop: W, with short J and L turns | ||
| 203 | (the stand-in pad's right stick turns the camera). | ||
| 204 | - **Its log lines.** Through `leonida.log`, the log is also its heartbeat: | ||
| 205 | - `GATE PRESS`, and `GATE PROBE ... placed` or `still` when holding W showed no control; | ||
| 206 | - `GATE CONTROL t=... frame=... moved=... mode=...`; | ||
| 207 | - `GATE MARK t=... frame=... <mode> from_control_m=...`, every 10 s. A cutscene can still follow control: the | ||
| 208 | title moves the player for it, kilometres away, and puts them back after, to 0.0 again in `idle`; | ||
| 209 | - `GATE SHOT`, two screenshots at 10 s and 120 s after control (diagnostics builds), in `LEONIDA_SCREENSHOTS` | ||
| 210 | when set, else beside the runtime; | ||
| 211 | - `GATE FAIL no position` or `GATE FAIL no control`, after 900 s. | ||
| 212 | |||
| 213 | Distances only: never a position. | ||
| 214 | - **Its settings.** A `gate.txt` beside the copy sets `mode = roam` and any number of `driver.lua`'s defaults | ||
| 215 | (`give_up = 600`, ...), one a line. | ||
| 216 | |||
| 217 | The logic is in `driver.lua`, which takes the calls it uses as an argument. `crates/leonida-lua` tests it on a stub | ||
| 218 | with a simulated clock. A route of your own, a saved place to start from and the run's screenshots are game data: | ||
| 219 | keep them on your machine. | ||
| 220 | |||
| 191 | ## What is not here, and why | 221 | ## What is not here, and why |
| 192 | 222 | ||
| 193 | - `leonida.teleport(x, y, z [, hold_seconds])` (true line, or nil and why) and `leonida.player_position()` (x, y, z) move | 223 | - `leonida.teleport(x, y, z [, hold_seconds])` (true line, or nil and why) and `leonida.player_position()` (x, y, z) move |