openOMSI GitHub Discord
Writing plugins

Docs / Plugins / Writing plugins

Distributing a plugin

2 min readEdit this pagedocs/PLUGINS.md

On this page
  1. Adding a plugin to the catalog
  2. plugin.json
  3. What the catalog does not take
  4. How the launcher installs from the catalog

You can share a plugin in two ways:

  • Any file: send the .lua, the plugin folder, or the .oop. Players drop it into their plugins folder.
  • 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.

  1. Fork the repository and make a folder plugins/<id>/. The id is 2 to 40 characters of a-z, 0-9 and -, not starting with -. It becomes the folder name in the game: plugins/<id>/main.lua.
  2. Put the plugin in it: main.lua and whatever it requires 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.
  3. Add plugins/<id>/plugin.json (see below).
  4. Run python3 tools/build_catalog.py and commit catalog.json with the plugin. Check the Lua with luac -p plugins/<id>/*.lua (Lua 5.4).
  5. 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#

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 match catalog.json.
  • It refuses to overwrite a plugins/<id>/ folder that did not come from the catalog.
  • It offers an update when version goes up, and keeps plugins/<id>/data/ on an update.
  • It reads catalog.json each 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.

↑↓ to move↵ to open