openOMSI GitHub Discord
Writing plugins

Docs / Plugins / Writing plugins

Installing and managing plugins

2 min readEdit this pagedocs/PLUGINS.md

On this page
  1. Turn plugins on
  2. Where plugins go
  3. The launcher's Plugins page
  4. Files the launcher and game share

Turn plugins on#

On a fresh install, plugins are off.

  1. Open the launcher's Settings → General.
  2. Under Interface & online, switch off Disable plugins.

The setting applies from the next game. With it on, no Lua plugins and no OMSI 2 plugins run, including vehicle scripts. The vehicles' normal .osc scripts always run.

Where plugins go#

Plugins live in the plugins folder of the game, and of every other content root.

Path What it is Its data folder
plugins/<name>.lua a one-file plugin plugins/<name>.data/
plugins/<name>/main.lua a plugin with several files plugins/<name>/data/
plugins/<name>.oop a compiled plugin plugins/<name>.data/
plugins/**/<name>.opl an OMSI 2 plugin and its DLL -

In a folder plugin, require("util") loads plugins/<name>/util.lua (or util/init.lua). Its pictures, sounds and data files sit next to the code. Other .lua files in a folder are not started on their own, so modules stay modules.

When a .lua plugin and an .oop have the same name, the .lua wins. That lets an author work on the source while the compiled copy is installed.

The launcher's Plugins page#

The launcher's Plugins page has two tabs.

  • Installed lists every plugin in the plugins folders: Lua, .oop and .opl. Switch each one on or off without moving its files, open its Settings, or press Plugins folder to open the folder.
  • Browse lists the plugins of the plugin catalog. Install, Update and remove them from there.

A plugin switched off is left out of the next game. Its files and settings stay.

Files the launcher and game share#

File Contents
~/.openomsi/plugins-off.txt the plugins switched off, one per line, in lower case
~/.openomsi/plugins-status.json what the last game did with each plugin
<data folder>/settings.schema.json the settings a plugin declared
<data folder>/settings.json the values the player chose

In plugins-off.txt each plugin is named by its path under plugins: foo.lua, a folder plugin as foo/ (for foo/main.lua), foo.oop, or an .opl path such as pablo/mbas.opl. So foo.lua and foo/main.lua are two different plugins. A bare name like foo, written by an older launcher, still switches off every Lua or .oop plugin of that name.

plugins-status.json lists every plugin by the same names with its state: loaded, off, or failed with the load error (for example a syntax error). A plugin the game switched off during play for its errors also has switched_off with the error.

On Windows ~ is %USERPROFILE%.

Something wrong or missing? Fix it on GitHub or open an issue.

↑↓ to move↵ to open