Docs / Plugins / Writing plugins
Distributing a plugin
You can share a plugin in two ways:
- Any file: send the
.lua, the plugin folder, or the.oop. Players drop it into theirpluginsfolder. - The plugin catalog: the launcher's Plugins → Browse tab lists the plugins of openOMSI-org/openOMSI-Plugins. Players install and update them with one click.
Adding a plugin to the catalog#
The catalog takes open-source folder plugins (a main.lua and its files). A maintainer reads the code before it is merged.
- Fork the repository and make a folder
plugins/<id>/. The id is 2 to 40 characters ofa-z,0-9and-, not starting with-. It becomes the folder name in the game:plugins/<id>/main.lua. - Put the plugin in it:
main.luaand whatever itrequires or reads. Allowed file types:.lua,.json,.txt,.md,.csv,.png,.jpg,.ogg,.wav,.ttf,.otf. At most 2 MB per file, 10 MB in all, 200 files. No programs, libraries or archives. - Add
plugins/<id>/plugin.json(see below). - Run
python3 tools/build_catalog.pyand commitcatalog.jsonwith the plugin. Check the Lua withluac -p plugins/<id>/*.lua(Lua 5.4). - Open a pull request. The checks must pass.
An update is a pull request that changes the files and raises version. The launcher offers it to everyone who installed the plugin. Their settings and saved data (plugins/<id>/data/) stay.
plugin.json#
{
"id": "my-plugin",
"name": "My plugin",
"author": "Your name",
"version": "1.0.0",
"description": "One line: what it does for the player.",
"license": "MIT",
"tags": ["driving"],
"homepage": "https://github.com/you/my-plugin",
"min_game": "0.3.55"
}| Field | Required | Meaning |
|---|---|---|
id |
yes | the folder name, as above |
name |
yes | display name, at most 60 characters |
author |
yes | at most 60 characters |
version |
yes | MAJOR.MINOR.PATCH |
description |
yes | one line, at most 300 characters |
license |
yes | SPDX id of an open-source licence, at most 40 characters |
tags |
no | a list of words |
homepage |
no | a web address |
min_game |
no | the oldest openOMSI it needs |
What the catalog does not take#
- Code that is hidden (obfuscated, minified, encoded) or downloads code to run.
- Anything that sends the player's data somewhere without saying so in its description.
- Content of OMSI 2 or of other people's mods (textures, sounds, scripts) without their permission.
Plugins that only work with paid add-ons are fine; say so in the description.
How the launcher installs from the catalog#
- It installs a plugin as
plugins/<id>/only when every file's size and SHA-256 matchcatalog.json. - It refuses to overwrite a
plugins/<id>/folder that did not come from the catalog. - It offers an update when
versiongoes up, and keepsplugins/<id>/data/on an update. - It reads
catalog.jsoneach time Browse opens: a plugin added to the catalog shows up at once, without a new openOMSI version. - Remove deletes the plugin's files, settings and saved data.
- A plugin taken out of the catalog stays in the game of those who installed it (with its saved data); Browse marks it No longer in the catalog and offers Remove.
- An entry that breaks a rule is left out of the list. A catalog newer than the launcher asks you to update openOMSI.
Something wrong or missing? Fix it on GitHub or open an issue.