upleb.uk

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

summaryrefslogtreecommitdiff
path: root/docs/lua-modding.md
AgeCommit message (Collapse)Author
3 daysMerge pull request #3051 from imShangLi/fix/d3d12-lua-require-inside-folderMoonEyes
D3D12-LUA-LINKS-STAY-IN-THE-FOLDER: require and the script refuse a link that leads out
3 daysD3D12-LUA-LINKS-STAY-IN-THE-FOLDER: the doc says the rule holds for require tooimShangLi
3 daysD3D12-LUA-MEMORY-SCAN-BOUNDS: the doc says what an empty range isimShangLi
3 daysD3D12-LUA-MEMORY-SCAN-BOUNDS: the second review's pointsimShangLi
- the doc says that a string which names a whole number is taken as that number, so the sentence is true - the test covers a negative size and a negative max too
3 daysD3D12-LUA-MEMORY-SCAN-BOUNDS: the review's pointsimShangLi
- the test for the default range stands on its own, so it shows red without the fix (on the base the mod is disabled by the typed option before it gets there) - the doc says what is really refused: a numeric string is a whole number and is taken
3 daysD3D12-LUA-MEMORY-SCAN-BOUNDS: a scan covers a bounded range and its options ↵imShangLi
are checked The range of leonida.memory.scan was checked against the process, not against the work it causes: a mod could ask for the whole user range (128 TiB) and the scan's time was refunded to the call budget, so nothing stopped it. The one thread that runs every mod then sat in the scan for hours, and the other mods, the menu callbacks and the reload path waited for it. - one scan covers at most 256 MiB (the whole image, when it is bigger) - start, size and max are whole numbers: a negative one or another kind of value is refused with the reason, not taken for something else - without a size, the range reaches the end of the image (it ended 100 bytes short when it started below the image)
5 daysmods: gate_driver presses at the menus' pace after a probe that shows no ↵TheGeogeo
move (review) A probe that showed no move pressed Enter at once, and the menus then probed again at once: Enter came every 3 to 5 s (68 times in 6 min on a cold cache), with no press_every and no check that frames had moved on. It now asks the menus for one press at their pace, and a probe waits for Enter to be up. The docs say what idle cannot tell (a held player) and what a cold cache does to CONTROL.
5 daysmods: gate_driver takes a run from the menus into the world ↵TheGeogeo
(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.
8 daysTrainer menu: game actions through the title's own cheat system ↵NotRexed
(LEONIDA_GAME_ACTIONS=1) The title has a cheat system of its own: a table of sixteen handlers without arguments, and the functions those call take plain arguments. Ten places in its code are found by short byte signatures (each once in the executable), which give the cheat dispatcher and table, the title's deferred call, the player's ped, the functions that set a ped's wanted level, the time of day and the forced weather type, and the globals they work on. The title's once-a-frame call of its cheat input function becomes a call of ours (a near stub, written before any title code runs); the menu only queues a request, and the hook hands the title's own deferred-call queue (the one its cheats go through) the work. Wanted level, clear, never wanted, hour, clock paused, sync with system, weather by name, freeze weather, the health cheat and the nine vehicle cheats are wired; the player's position and heading come from the ped itself. Moving the player, god mode and the rest still say why they are not there. Off unless LEONIDA_GAME_ACTIONS=1: built and unit-tested, not yet run in the title. LEONIDA_GAME_ACTIONS_RUN scripts commands for a test without the keyboard and logs to %TEMP%\leonida-actions. docs/mod-menu.md: how it was found, with counts; the 6,811 script command wrappers (each carries its own 64-bit hash) and what was tried to find the table that binds them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
8 daysTeleport page and leonida.teleport work through the player hook when a ↵NotRexed
position is known Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysleonida-lua: a test runs the example mod; the README rowNotRexed
What: a test copies mods/example_lua enabled into a temporary folder and drives it on the fake host: its page (toggle, number, two actions), the overlay line, F9 turning it off, the menu callbacks, the menu_open event. d3d12/README.md gets the row for the Lua mods that the last commit left out. How checked: cargo test -p leonida-lua --lib (35 passed); cargo test -p leonida-menu --lib (47 passed). AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysLua mods: an example mod, the docs, and the mod manager lists themNotRexed
What: mods/example_lua (mod.json disabled by default, main.lua: a frame-rate and time line in the lower left, a page in the F4 menu with a toggle, a number and two actions, an F9 key handler); docs/lua-modding.md (the API reference, the sandbox rules, what is not available and why, what was not tried), pointers in docs/README.md, docs/mod-menu.md, docs/modding.md and a row in d3d12/README.md. tools/leonida_mods.py reads "script": it must be a .lua path inside the folder, the list shows `Lua main.lua`, the JSON report has "script", and a Lua mod no longer warns that it has no archetype_swaps. Why: a Lua mod is mods\<name>\mod.json plus a script, so the manager that lists the asset mods should list these too, and a mod author needs the reference. How checked: python -I tests/test_leonida_mods.py (13 tests, 3 new, pass; the one failure, test_run_print_builds_gta6rt_command, fails the same on the base: no gta6rt build here). The example's script was not run in the title. AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>