|
| 1 | +# Community Lua Scripts |
| 2 | + |
| 3 | +This directory holds **community-contributed Lua scripts** for every game OpenForge supports. The OpenForge desktop app fetches each game's `index.json` from this directory and lets users install scripts with one click. |
| 4 | + |
| 5 | +No separate repo, no separate auth — drop a `.lua` file in the right subdirectory, add an entry to the index, open a PR. |
| 6 | + |
| 7 | +## Layout |
| 8 | + |
| 9 | +``` |
| 10 | +community-lua-scripts/ |
| 11 | +├── README.md (this file) |
| 12 | +└── <game-id>/ (matches the manifest.toml `id` of the game) |
| 13 | + ├── index.json (machine-readable script listing) |
| 14 | + ├── <slug>.lua (script bodies) |
| 15 | + └── … |
| 16 | +``` |
| 17 | + |
| 18 | +Currently shipped games: |
| 19 | + |
| 20 | +- `batman-lod/` — LEGO Batman: Legacy of the Dark Knight |
| 21 | + |
| 22 | +## `index.json` schema |
| 23 | + |
| 24 | +Each game's `index.json` is a single object with a `scripts` array. Slugs must be kebab-case (`[a-z0-9-]+`) and unique inside the game. |
| 25 | + |
| 26 | +```json |
| 27 | +{ |
| 28 | + "scripts": [ |
| 29 | + { |
| 30 | + "slug": "rapid-fire-batarang", |
| 31 | + "name": "Rapid-fire Batarang", |
| 32 | + "description": "Loops the throw animation so batarangs leave faster than the cooldown allows.", |
| 33 | + "author": "@your-github-handle", |
| 34 | + "url": "https://raw.githubusercontent.com/satyajiit/openforge-aio/main/community-lua-scripts/batman-lod/rapid-fire-batarang.lua" |
| 35 | + } |
| 36 | + ] |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +Fields: |
| 41 | + |
| 42 | +| Field | Required | Notes | |
| 43 | +|---------------|----------|-------------------------------------------------------------------------------------------------------------| |
| 44 | +| `slug` | yes | Filename stem of the `.lua` body (without extension). Must match `^[a-z0-9-]+$`. | |
| 45 | +| `name` | yes | Display name shown in the sidebar. | |
| 46 | +| `description` | no | One-sentence summary, shown under the name. | |
| 47 | +| `author` | no | Your GitHub handle (e.g. `@octocat`) or display name. | |
| 48 | +| `url` | no | Raw URL to the `.lua` body. Defaults to `community-lua-scripts/<game>/<slug>.lua` in this repo — usually fine to omit. | |
| 49 | + |
| 50 | +## Adding a script |
| 51 | + |
| 52 | +1. Fork `satyajiit/openforge-aio` and check out a branch. |
| 53 | +2. Drop your script at `community-lua-scripts/<game-id>/<slug>.lua`. |
| 54 | +3. Add a corresponding entry to `community-lua-scripts/<game-id>/index.json` (create the file if it doesn't exist yet — schema above). |
| 55 | +4. Open a PR. CI will validate the JSON shape; we'll review the script body for safety + behaviour. |
| 56 | + |
| 57 | +## Rules |
| 58 | + |
| 59 | +- **Single-player offline only.** Same as the rest of OpenForge. Scripts that touch online state will be declined. |
| 60 | +- **No outbound network calls.** Scripts run inside the trainer's per-game DLL with reflection + memory access; they should not need HTTP / sockets and the runtime doesn't expose them. |
| 61 | +- **MIT-licensed original work.** Don't paste extracted CT logic from closed-source trainers. Recreating an idea from scratch is fine. |
| 62 | +- **Stable APIs only.** The Lua bindings (UE5 reflection, key helpers, output) are still firming up — pin to documented helpers, not internal back-doors. |
| 63 | +- **Author credit goes in the `author` field.** No header banners or watermarks inside the script body, please. |
| 64 | + |
| 65 | +## Local testing |
| 66 | + |
| 67 | +Before opening a PR, point your local OpenForge build at your fork to verify: |
| 68 | + |
| 69 | +1. Push your branch to your fork. |
| 70 | +2. Edit `crates/app/src-tauri/src/lua/community.rs` constants `INDEX_URL_TEMPLATE` + `default_script_url` to point at `https://raw.githubusercontent.com/<your-fork>/openforge-aio/<branch>/community-lua-scripts/…` temporarily. |
| 71 | +3. `pnpm tauri:dev:fast`, open the game, switch to the Lua tab → Community. |
| 72 | +4. Revert the constants before opening the PR. |
| 73 | + |
| 74 | +(A cleaner per-build override mechanism is on the roadmap; for now this manual swap is the workflow.) |
0 commit comments