Exports
Server exports drive weather and time from your own scripts. Client exports let housing and interior scripts pause the sync.
Server exports
exports['gravitas_weatherhub']:setWeather('RAIN')
exports['gravitas_weatherhub']:setTime(22, 0)
exports['gravitas_weatherhub']:setBlackout(true)
exports['gravitas_weatherhub']:setTimeFreeze(true)
exports['gravitas_weatherhub']:setSnow(true)
exports['gravitas_weatherhub']:setScheduleActive(true)| Export | Returns |
|---|---|
getWeatherState / setWeather(type) | Current weather / true if the type is valid |
getTime / setTime(hour, minute) | {hour, minute} / true |
getBlackoutState / setBlackout(bool) | Blackout on or off |
getTimeFreezeState / setTimeFreeze(bool) | Time frozen or not |
getFreezeWeather / setFreezeWeather(bool) | Weather frozen or not |
getSnowState / setSnow(bool) | Snow on the ground |
getScheduleState / setScheduleActive(bool) | Schedule state |
getTemperature, getFeelsLike, getHumidity, getWindData | Forecast data |
getCurrentForecast, getWeatherForecast, getSeasonalEntries | Forecast and season data |
Client exports
exports['gravitas_weatherhub']:PauseSync('EXTRASUNNY') -- entering an interior
exports['gravitas_weatherhub']:ResumeSync() -- leaving it| Export | Effect |
|---|---|
PauseSync(weather?) | Stops weather sync, optionally showing a fixed weather |
ResumeSync() | Re-applies the server state |
IsSyncPaused() | true while paused |
GetCurrentWeather, GetCurrentTime, GetSeason | Read the current state |
qb-weathersync compatibility
Scripts that call the old resource keep working:
exports['qb-weathersync']:getWeatherState()
exports['qb-weathersync']:setWeather('RAIN')
exports['qb-weathersync']:setTime(12, 0)The events qb-weathersync:server:setWeather and setTime are also handled.
They are permission-checked and rate-limited, and accept the classic casing
('Extrasunny') and an hour-only time ('14').
Other scripts cache the qb-weathersync export. After restarting
WeatherHub, restart the scripts that call it.