Time & Weather API
Exports for the world's clock and weather, and for per-player layers. New to them? Read Time & Weather.
Reading
The server time, exact at the moment you call it.
number hour, number minuteThe server weather, in upper case.
stringThe time scale multiplier.
numberWhether the world's clock is frozen.
booleanWhether the city is blacked out.
booleanSetting
Each change reaches every client at once and is saved.
Sets the time and fires whip_core:time:changed { hour, minute }. Out-of-range values wrap, each on its own (25:61 is 01:01).
| Param | Type | Description |
|---|---|---|
| hour | number | 0–23 |
| minute | number? | 0–59, default 0 |
true, or false, reason for a value that isn't a numberSets the weather and fires whip_core:weather:changed { weather }.
| Param | Type | Description |
|---|---|---|
| weather | string | One of Config.WeatherTypes, any case |
true, or false, reason ('Invalid weather type', or not a string)Freezes or unfreezes the clock for everyone, and fires whip_core:time:freezeChanged { frozen }.
| Param | Type | Description |
|---|---|---|
| frozen | boolean | true freezes |
trueTurns every artificial light off or back on.
| Param | Type | Description |
|---|---|---|
| blackout | boolean | true = blackout |
trueSets how fast the clock runs: 1.0 is normal (48 min real = 24 h game), 2.0 twice as fast.
| Param | Type | Description |
|---|---|---|
| scale | number | 0.0–10.0, clamped |
true, or false, reason for a scale that isn't a numberLayers
A layer is yours: another resource can't replace or clear it, and it comes off when your resource stops. Numbers must be numbers and weather one of Config.WeatherTypes.
Pushes a layer onto one player.
| Param | Type | Description |
|---|---|---|
| source | number | Player server id |
| name | string | At most 64 characters. The player sees it as 'server:' .. name, apart from client layers |
| opts | table|nil | { priority?, hour?, minute?, weather?, frozen?, blackout? }, nothing else; nil clears |
true, or false, reasonRemoves one of your layers from one player.
true, or false, reasonThe layers the server pushed to this player, not the ones the client set itself (such as its zone's): the client's GetWeatherLayers has the whole picture.
{ [name] = opts }Adds or replaces a layer on this client; nil opts removes it.
| Param | Type | Description |
|---|---|---|
| name | string | Unique per source, e.g. 'zone:swamp' |
| opts | table|nil | { priority?, hour?, minute?, weather?, frozen?, blackout? } |
true, or false, why ('Invalid weather type', 'layer "x" belongs to …')Removes one of your layers; the others stay.
true, or false, why (none, or another resource's)Every active layer in priority order, and which owns each field: for debugging a stack.
{ layers = { {name, priority} }, owners = { weather = 'zone:swamp', hour = 'server', ... } }Client#
What this player sees, layers included.
The time as the local player sees it.
number hour, number minuteThe weather as the local player sees it.
stringWhether the clock is frozen for this player, by the server or by a layer.
booleanWhether any layer is active for this player; GetWeatherLayers says which.
boolean