-
Syncs time and weather for all players
-
Configurable weather pattern
-
Weather is queued so players can get a forecast of upcoming weather
-
Different weather for different regions
-
Adjustable timescale
-
Players can temporarily disable sync and set local time/weather
Forecast and admin UI | Region-specific weather | Adjustable timescale |
---|---|---|
-
Create a
weathersync
folder within your resources directory, for example,resources/[local]/weathersync
. -
Copy the files from this repository into the
weathersync
folder. -
Add the following to your
server.cfg
:
exec resources/[local]/weathersync/permissions.cfg
start weathersync
Command | Description |
---|---|
/forecast |
Displays a forecast of upcoming weather. |
/mytime |
Set local time (if sync is off). |
/myweather |
Set local weather (if sync is off). |
/syncdelay |
Set how often the server syncs with clients. |
/time |
Set the server time. |
/timescale |
Set the ratio of in-game seconds to real-time seconds. |
/weather |
Set the server weather. |
/weathersync |
Toggle time/weather sync on/off. |
/weatherui |
Opens the admin UI for changing the time/weather/wind. |
/wind |
Set the wind direction and base speed. |
Variable | Description | Example |
---|---|---|
Config.time |
Default time when the resource starts. | DHMSToTime(0, 6, 0, 0) (Sun 06:00:00) |
Config.timescale |
Default timescale when the resource starts | 30 (30 in-game secs per real sec) |
Config.realTimeOffset |
Offset of the real server time in seconds. | 0 |
Config.timeIsFrozen |
Whether time is frozen when the resource starts. | false |
Config.weather |
Default weather when the resource starts. | "sunny" |
Config.weatherInterval |
How often the weather changes. | DHMSToTime(0, 1, 0, 0) (1 in-game hour) |
Config.weatherIsFrozen |
Whether weather is frozen when the resource starts. | false |
Config.permanentSnow |
Whether to permanently add snow on the ground. | false |
Config.dynamicSnow |
Whether to dynamically add snow on the ground. | true |
Config.maxForecast |
Number of weather intervals to queue up. | 23 (24-hour forecast) |
Config.windDirection |
Default wind direction when the resource starts. | 0.0 (North) |
Config.windSpeed |
Default base wind speed when the resource starts. | 0.0 |
Config.windShearDirection |
Degrees by which wind direction changes at higher altitudes. | 45 |
Config.windShearSpeed |
Amount by which base wind speed increases at higher altitudes. | 2.0 |
Config.windShearInterval |
Interval in metres where wind direction/speed changes. | 50.0 |
Config.windIsFrozen |
Whether wind direction is frozen. | false |
Config.permanentSnow |
Whether to add snow on the ground permanently. | false |
Config.dynamicSnow |
Whether to add snow on the ground dynamically. | false |
Config.syncDelay |
How often in ms to sync with clients. | 5000 |
Config.weatherPattern |
A table describing the the weather pattern. | See config.lua |
Config.disableSnowOnCayoPerico |
Disables permanent and dynamic snow while on Cayo Perico. | false |
Get the current server time.
exports.weathersync:getTime()
A table with the current day, hour, minute and second:
{
day = 0,
hour = 6,
minute = 0,
second = 0
}
Set the current time.
exports.weathersync:setTime(day, hour, minute, second, transition, freeze)
Reset the time to the default configured time.
exports.weathersync:resetTime()
Set the ratio of in-game seconds to real seconds.
exports.weathersync:setTimescale(timescale)
Reset the timescale to the default configured value.
exports.weathersync:resetTimescale()
Get the current weather.
exports.weathersync:getWeather()
The name of the current weather type.
Set the current weather.
exports.weathersync:setWeather()
Reset the weather to the default configured weather type.
exports.weathersync:resetWeather()
Set the weather pattern.
exports.weathersync:setWeatherPattern(pattern)
Reset the weather pattern to the default configured pattern.
exports.weathersync:resetWeatherPattern()
Get the current wind direction and base speed.
exports.weathersync:getWind()
A table containing the wind direction and base speed:
{
direction = 180.0,
speed = 0.0
}
Set the current wind direction and base speed.
exports.weathersync:setWind(direction, speed)
Reset the wind direction and speed to the default configured values.
exports.weathersync:resetWind()
Set the current synchronization interval.
exports.weathersync:setSyncDelay(delay)
Reset the sync delay to the default configured value.
exports.weathersync:resetSyncDelay()
Get the current weather forecast.
exports.weathersync:getForecast()
A table containing the weather forecast:
{
{
day = 0,
hour = 6,
minute = 0,
second = 0,
weather = "sunny",
wind = 0.0
},
{
day = 0,
hour = 7,
minute = 0,
second = 0,
weather = "clouds",
wind = 10.0
},
...
}
Check if there is snow on the ground.
exports.weathersync:isSnowOnGround()
true if there is snow on the ground, false if there is not.
Disable weather and time sync and set a local weather type for this client.
exports.weathersync:setMyWeather(weather, transition, permanentSnow)
Disable weather and time sync and set a local time for this client.
exports.weathersync:setMyTime(hour, minute, second, transition, freeze)
Enable or disable weather and time sync for this client.
exports.weathersync:setSyncEnabled(toggle)
Toggle weather and time sync on/off for this client.
exports.weathersync:toggleSync()