Skip to Content
Cobalt

cobalt_weather

Server-authoritative weather and time.

ExportSideWhat it does
SetSyncClientStops applying the synced weather and clock locally, or resumes it.
SetWeatherServerChanges the weather; false when the type is unknown.
SetTimeServerSets the game clock; false when out of range.
FreezeTimeServerFreezes or unfreezes the clock.
FreezeWeatherServerFreezes or unfreezes the weather cycle.
SetBlackoutServerTurns the blackout on or off.
GetWeatherServerReturns the current weather state.
GetTimeServerReturns the current game time.
GetWeatherTypesServerReturns the configured weather types.

SetSync

Client

Stops applying the synced weather and clock locally, or resumes it.

exports.cobalt_weather:SetSync(enabled)
ParameterTypeOptionalDescription
enabledbooleanNo
Example
exports.cobalt_weather:SetSync(true)

SetWeather

Server

Changes the weather; false when the type is unknown.

exports.cobalt_weather:SetWeather(name, transitionSeconds)
ParameterTypeOptionalDescription
nameWeatherType | stringNocase-insensitive
transitionSecondsnumberYes
ReturnsDescription
boolean
Example
local ok = exports.cobalt_weather:SetWeather('RAIN', 15.0)

SetTime

Server

Sets the game clock; false when out of range.

exports.cobalt_weather:SetTime(hour, minute)
ParameterTypeOptionalDescription
hourintegerNo0 to 23
minuteintegerNo0 to 59
ReturnsDescription
boolean
Example
local ok = exports.cobalt_weather:SetTime(14, 30)

FreezeTime

Server

Freezes or unfreezes the clock.

exports.cobalt_weather:FreezeTime(frozen)
ParameterTypeOptionalDescription
frozenbooleanNo
Example
exports.cobalt_weather:FreezeTime(true)

FreezeWeather

Server

Freezes or unfreezes the weather cycle.

exports.cobalt_weather:FreezeWeather(frozen)
ParameterTypeOptionalDescription
frozenbooleanNo
Example
exports.cobalt_weather:FreezeWeather(true)

SetBlackout

Server

Turns the blackout on or off.

exports.cobalt_weather:SetBlackout(enabled)
ParameterTypeOptionalDescription
enabledbooleanNo
Example
exports.cobalt_weather:SetBlackout(true)

GetWeather

Server

Returns the current weather state.

exports.cobalt_weather:GetWeather()
ReturnsDescription
WeatherReport
Example
local report = exports.cobalt_weather:GetWeather()

GetTime

Server

Returns the current game time.

exports.cobalt_weather:GetTime()
ReturnsDescription
WeatherTime
Example
local time = exports.cobalt_weather:GetTime()

GetWeatherTypes

Server

Returns the configured weather types.

exports.cobalt_weather:GetWeatherTypes()
ReturnsDescription
WeatherType[]
Example
local types = exports.cobalt_weather:GetWeatherTypes()

On this page