openOMSI GitHub Discord

Docs / Plugins / Lua plugins

Scripts that belong to a vehicle

1 min readEdit this pagedocs/PLUGINS.md

A vehicle can carry its own scripts, written in Lua or compiled to a .oop (Lua or Rust), so a mod needs no plugin installed by the player. Name them in the vehicle's .bus or .ovh, relative to the vehicle's folder:

OMSI file
[vehicle_script]
scripts/cab.lua

[vehicle_script]
scripts/ibis.oop

The scripts start when the vehicle becomes the player's and stop when another vehicle (or none) does; they see the same omsi.* API as any plugin, the omsi.var of the bus being theirs. They are named vehicle:<file> in the log.

Because a vehicle is content from anywhere, they have only these permissions: ui, storage, vehicle_write and audio. The world, the traffic, the camera, the LAN, UDP and native programs stay with the player's own plugins; a .oop that declares more keeps these four.

OMSI 2 skips the keyword and runs the vehicle's .osc scripts as ever; a vehicle can have both.

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

↑↓ to move↵ to open