upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/lua-modding.md
diff options
context:
space:
mode:
authorTheGeogeo <57634077+TheGeogeo@users.noreply.github.com>2026-11-30 21:02:29 +0100
committerTheGeogeo <57634077+TheGeogeo@users.noreply.github.com>2026-11-30 21:02:29 +0100
commit923dc267410e8bab17bd69fc383a0f39fb74b103 (patch)
treec204b73e0e6acb059120e435f9cb706ebbe91736 /docs/lua-modding.md
parent0f86bd594ff6f929d27447af3cb16bcb39006d98 (diff)
mods: gate_driver takes a run from the menus into the world (D3D12-GATE-DRIVER-MOD)
A Lua mod for in-game gates and A/Bs: it presses Enter through the title's menus only once frames have moved on since the last press, shows control by holding W (the player must walk 1 to 30 m in 3 s; more is the title placing the player, which it waits out without a press), then stands still (idle) or walks a fixed loop (roam). It logs GATE PRESS/PROBE/CONTROL/MARK/SHOT/FAIL lines with distances only, never a position. It ships disabled; a run enables a copy with LEONIDA_MODS and needs LEONIDA_GAME_ACTIONS=1 for the player's position. The logic is in driver.lua and takes the calls it uses as an argument, so leonida-lua's tests run it on a stub with a simulated clock: menus, control, roam, no position, no control, a jump.
Diffstat (limited to 'docs/lua-modding.md')
-rw-r--r--docs/lua-modding.md30
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
189alone; a mod can have both. Load order is the folder names', sorted. 189alone; 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
194ships 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
217The logic is in `driver.lua`, which takes the calls it uses as an argument. `crates/leonida-lua` tests it on a stub
218with a simulated clock. A route of your own, a saved place to start from and the run's screenshots are game data:
219keep 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