cobalt_weather
Server-authoritative weather and time.
| Export | Side | What it does |
|---|---|---|
SetSync | Client | Stops applying the synced weather and clock locally, or resumes it. |
SetWeather | Server | Changes the weather; false when the type is unknown. |
SetTime | Server | Sets the game clock; false when out of range. |
FreezeTime | Server | Freezes or unfreezes the clock. |
FreezeWeather | Server | Freezes or unfreezes the weather cycle. |
SetBlackout | Server | Turns the blackout on or off. |
GetWeather | Server | Returns the current weather state. |
GetTime | Server | Returns the current game time. |
GetWeatherTypes | Server | Returns the configured weather types. |
SetSync
ClientStops applying the synced weather and clock locally, or resumes it.
exports.cobalt_weather:SetSync(enabled)| Parameter | Type | Optional | Description |
|---|---|---|---|
enabled | boolean | No |
exports.cobalt_weather:SetSync(true)SetWeather
ServerChanges the weather; false when the type is unknown.
exports.cobalt_weather:SetWeather(name, transitionSeconds)| Parameter | Type | Optional | Description |
|---|---|---|---|
name | WeatherType | string | No | case-insensitive |
transitionSeconds | number | Yes |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_weather:SetWeather('RAIN', 15.0)SetTime
ServerSets the game clock; false when out of range.
exports.cobalt_weather:SetTime(hour, minute)| Parameter | Type | Optional | Description |
|---|---|---|---|
hour | integer | No | 0 to 23 |
minute | integer | No | 0 to 59 |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_weather:SetTime(14, 30)FreezeTime
ServerFreezes or unfreezes the clock.
exports.cobalt_weather:FreezeTime(frozen)| Parameter | Type | Optional | Description |
|---|---|---|---|
frozen | boolean | No |
exports.cobalt_weather:FreezeTime(true)FreezeWeather
ServerFreezes or unfreezes the weather cycle.
exports.cobalt_weather:FreezeWeather(frozen)| Parameter | Type | Optional | Description |
|---|---|---|---|
frozen | boolean | No |
exports.cobalt_weather:FreezeWeather(true)SetBlackout
ServerTurns the blackout on or off.
exports.cobalt_weather:SetBlackout(enabled)| Parameter | Type | Optional | Description |
|---|---|---|---|
enabled | boolean | No |
exports.cobalt_weather:SetBlackout(true)GetWeather
ServerReturns the current weather state.
exports.cobalt_weather:GetWeather()| Returns | Description |
|---|---|
WeatherReport |
local report = exports.cobalt_weather:GetWeather()GetTime
ServerReturns the current game time.
exports.cobalt_weather:GetTime()| Returns | Description |
|---|---|
WeatherTime |
local time = exports.cobalt_weather:GetTime()GetWeatherTypes
ServerReturns the configured weather types.
exports.cobalt_weather:GetWeatherTypes()| Returns | Description |
|---|---|
WeatherType[] |
local types = exports.cobalt_weather:GetWeatherTypes()