Skip to content
0bArcPublic

About

Lua modding kit for RimWorld. C++ Lua runtime plus thin C# host. Requires Harmony. Load before Lua mods that depend on it

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

RimKit

RimWorld Luau Harmony C++ License

Write RimWorld mods in Luau. RimKit loads your scripts, gives them a documented API to the game, and lets them patch game methods when the API does not cover something.

stratware.rimkit by Stratware.win

-- Floating damage numbers above people. Red for colonists, orange for everyone else.
game.events.on_pawn_damaged(function(pawn, e)
  game.effects.text(pawn, tostring(math.floor(e.dealt)), pawn.is_colonist and "red" or "orange")
end, { humanlike = true, min_dealt = 1 })

-- Colonists never lose accuracy with distance.
game.hooks.postfix("Verse.ShotReport", "HitFactorFromShooter", function(ctx)
  ctx:set_result(1)
end)

How it works

Your Luau mod runs in a C++ core (the Luau VM, a sandbox and the game.* bindings). The core talks to a C# host, which calls RimWorld through Harmony. The pictures are in architecture and how RimKit loads your mod.

Install and make a mod

rimkit build                                   # build the core and the host
.\bin\rimkit.exe mod ship .                    # install RimKit into RimWorld's Mods folder
.\bin\rimkit.exe mod ship .\src\examples\damage

rimkit mod create MyMod
rimkit mod test MyMod
rimkit mod ship MyMod

Load order is Harmony, then RimKit, then your mod. Close RimWorld before shipping if mod\Native\rimlua_core.dll is locked. The first mod, step by step: quickstart.

What is in it

Kits game.pawns, game.things, game.maps and about a hundred more, typed and documented
Events 116 named events with typed payloads, filters, and one on_<event> function each
Hooks Prefix, postfix, finalizer and call replacement on any game method
Reflection Read or call anything in Verse, RimWorld and UnityEngine. Off by default and audited
Libraries rimkit.signal and rimkit.promise
Tooling rimkit CLI, mock-host tests with mod gen-tests, tests in the real game (mod test --in-game), hot reload, mod conform for the RimKit Standard, a VS Code extension with types

What changed and how each change was checked is in CHANGES.md. What is not possible yet is in what is missing. See contributing for the official ways to report bugs, request capabilities, improve docs, add examples and submit code.

Docs

Home, quickstart, API reference, security. To read them as a site: cd infrastructure/docs-site, then npm install and npm run serve.

Editor

The extension in src/editor adds completions, Luau types for the whole API and for every event payload, and commands to ship and test. It needs the Luau Language Server (JohnnyMorganz.luau-lsp).

cd src/editor
npx --yes @vscode/vsce package --no-dependencies
code --install-extension .\rimkit-<version>.vsix

Layout

mod/             the RimWorld package (About, Assemblies, Auth, Defs, Lua, Native)
src/api/         kit tables and the API data the tools read
src/host/        C# host
src/native/      C++ core and the rimkit CLI
src/editor/      VS Code and Cursor extension
src/examples/    example mods
src/templates/   mod template
infrastructure/  docs, docs site, tools
tests/           native tests, host tests, in-game smoke mod

License

RimKit is source available under the RimKit License: you may use it to make and sell mods, and read, build and audit it, but not modify or redistribute it, apart from changes you prepare to send back to us. The example mods, templates and documentation samples are free to copy. Third-party parts keep their own licenses, see THIRD_PARTY_NOTICES.md.

About

Lua modding kit for RimWorld. C++ Lua runtime plus thin C# host. Requires Harmony. Load before Lua mods that depend on it

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages