openOMSI GitHub Discord
Plugin API reference

Docs / Plugins / Plugin API reference

Time and date

1 min readEdit this pagedocs/PLUGIN_API.md

On this page
  1. omsi.clock
  2. omsi.world.date
  3. omsi.world.pause
  4. omsi.world.paused
  5. omsi.world.play_time
  6. omsi.world.season
  7. omsi.world.set_date
  8. omsi.world.set_time
  9. omsi.world.set_time_speed
  10. omsi.world.sun_altitude
  11. omsi.world.time
  12. omsi.world.time_speed

omsi.world.* reads and sets the game's clock, date and pause; omsi.clock() is the time of day as text.

omsi.clock#

omsi.clock() → string

The game's time of day as "HH:MM:SS".

Since 0.1.10.

omsi.world.date#

omsi.world.date() → table or nil

The game's date: {year, month, day, weekday, day_of_year} (weekday 1 Monday to 7 Sunday).

Since 0.2.22.

Lua
local d = omsi.world.date()
if d then print(d.year, d.month, d.day) end

omsi.world.pause#

omsi.world.pause() → boolean

Pauses the game, as P does (not in a LAN game). The plugins stand still with it: the player resumes it.

Since 0.2.22. Permission: world_write.

omsi.world.paused#

omsi.world.paused() → boolean

Whether the game stands still (a plugin hears pause and runs no more until resume).

Since 0.2.22.

omsi.world.play_time#

omsi.world.play_time() → number or nil

Seconds played this session (game time, never wraps).

Since 0.2.22.

omsi.world.season#

omsi.world.season() → folder, snow

The season's texture folder (nil: the base textures) and whether snow lies.

Since 0.2.22.

omsi.world.set_date#

omsi.world.set_date(year, month, day) → boolean

Sets the game's date (the season's textures follow).

Parameters: year integer; month integer; day integer.

Since 0.2.22. Permission: world_write.

omsi.world.set_time#

omsi.world.set_time(time) → boolean

Sets the time of day: seconds since midnight or "HH:MM" / "HH:MM:SS", as the game menu's clock does (the timetable starts again after a jump of minutes). Not in a LAN game as a client, nor while the clock follows the computer's.

Parameters: time any.

Since 0.2.22. Permission: world_write.

Lua
omsi.world.set_time("07:30")

omsi.world.set_time_speed#

omsi.world.set_time_speed(factor) → boolean

Sets how much faster the clock runs (1 to 30; not in a LAN game).

Parameters: factor number.

Since 0.2.22. Permission: world_write.

omsi.world.sun_altitude#

omsi.world.sun_altitude() → number or nil

The sun's height over the horizon, degrees.

Since 0.2.22.

omsi.world.time#

omsi.world.time() → number or nil

The game's time of day, seconds since midnight.

Since 0.2.22.

omsi.world.time_speed#

omsi.world.time_speed() → number or nil

How much faster than real time the game's clock runs (1 to 30).

Since 0.2.22.

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

↑↓ to move↵ to open