Compiled plugins (.oop)
An .oop (openOMSI Plugin) is to a plugin what a DLL is to a program, but sandboxed: build
output, not sources. oopc build of the openOMSI Development
Tools makes one from a plugin
project, and the game loads plugins/<name>.oop like the other plugins. Two kinds:
- Lua, compiled into one obfuscated chunk (its locals renamed, its strings encoded, its modules bundled): it behaves as the sources did, through the same API, but the sources are not in the file. Compiled Lua bytecode is refused - Lua checks no bytecode, and crafted bytecode could break out of the sandbox.
WebAssembly (
wasm32-unknown-unknown), usually Rust with the plugin SDK of the Development Tools: the module calls every function of the API by its name here (openomsi.call("ui.set", ...), the SDK wraps them all) and gets the same events, timers and watches.It runs in an interpreter (wasmi) on every platform the game runs on; one call into it that runs too long stops the plugin, not the game, and it may use 256 MB of memory. A callback that the module's own call raises (its
emitreaching its own handler) runs right after that call returns.
What the game does with an .oop:
- It checks the file whole before anything of it runs: a file changed after it was built, cut short or made for a newer plugin API is refused (the log says why).
- The code stays in memory; the plugin's pictures, sounds and data files go into
plugins/.oop-cache/<name>/, where its API functions read them. - Permissions. An
.oopdeclares what it may do (ui,storage,vehicle_write,traffic_write,world_write,camera,audio,network_local,lan,process); a function that needs another one fails with an error the plugin can catch. Reading the game needs none. (A plain.luafile has every permission.) - Signatures. A signed plugin is logged with its author's key fingerprint
(
signed by 3097:e2de:e2cb:4a34); an unsigned one with a warning that its builder is not known. - A
.luaplugin of the same name wins over an.oop(the copy being worked on).
How safe the code is from copying: the file is encrypted, and the key is in the game, so it can be decrypted with effort - but what one gets then is the stripped or obfuscated build output, never the author's sources, which are not in the file.
Something wrong or missing? Fix it on GitHub or open an issue.