Docs / Plugins / Plugin API reference
LAN games
omsi.lan.* reads the LAN session and sends short texts to the same plugin on the other players' games.
omsi.lan.active#
omsi.lan.active() → boolean
Whether this game is in a LAN session.
Since 0.2.22.
omsi.lan.chat#
omsi.lan.chat(text) → true, or false and the reason
Says a line in the session's chat, as the player would (every player sees it; at most one a second).
Parameters: text string.
Since 0.2.22. Permission: lan.
omsi.lan.me#
omsi.lan.me() → id, name, host
This player in the session: its id (the host is 1), its name, whether it hosts.
Since 0.2.22.
omsi.lan.players#
omsi.lan.players() → list of tables
The other players of the session: {id, name, host, bus, line, tour, x, y, z, heading, speed, on_foot, passengers}.
Since 0.2.22.
for _, p in ipairs(omsi.lan.players()) do print(p.name, p.line) endomsi.lan.send#
omsi.lan.send(to, text) → true, or false and the reason
Sends a short text (at most 120 characters, no |) to the same plugin on another player's game (to its id; 0: every other player); it hears lan_message(from, text). A player sends at most about ten a second; a game without the plugin ignores them.
Parameters: to integer; text string.
Since 0.2.22. Permission: lan.
omsi.lan.send(0, "hello") -- this plugin on every other player's gameomsi.lan.session#
omsi.lan.session() → table or nil
The host's name and world as it announced them on joining: {host, map, date, time, weather, season} (date is YYYY-MM-DD from that announcement; time is the live session clock in seconds since midnight, the same on the host and every client). Nothing outside a LAN session; the host alone supplies the session details, and plugins can only read them.
Since 0.2.22. Permission: lan.
Something wrong or missing? Fix it on GitHub or open an issue.