Skip to main content

Weather

The replicated weather state, behind Ocean:CreateWeather, Ocean:SetWeather and the zone methods. It is state, not a controller: your own scripts decide what the weather is. The whole state is one JSON attribute on the module, so late joiners get it for free.

"Default" always exists and is simply the module's attribute values.

Types​

Zone​

interface Zone {
X: number
Z: number
Radius: number
Blend: number--

studs of rim over which it cross-fades

Current: string
Previous: string?
Start: number
Duration: number
}

Properties​

State​

Weather.State: {
Weathers: {[string]: {[string]: any}},
Global: Blendable,
Zones: {[string]: Zone}
}

The current state.

DEFAULT​

Weather.DEFAULT: string

"Default".

Functions​

Decode​

Weather.Decode() → ()

Pulls the replicated state in if it changed. Every read and write below does this first.

Exists​

Weather.Exists(name: string) → boolean

Names​

Weather.Names() → {string}

Every weather name, "Default" first, the rest sorted.

Resolve​

Weather.Resolve(name: string) → {[string]: any}

Every weather setting for the named weather: its override where it has one, else the module value.

Alpha​

Weather.Alpha(
blend: Blendable,
now: number--

workspace:GetServerTimeNow()

) → number

Types

​

interface Blendable {
Current: string--

the weather being shown (or faded toward)

Previous: string?--

the weather being faded from

Start: number--

server time the fade began

Duration: number--

seconds

}

Progress of a cross-fade, 0 to 1, smoothed.

Create​

This item only works when running on the server. Server
Weather.Create(
name: string,
overrides: {[string]: any}
) → ()

Set​

This item only works when running on the server. Server
Weather.Set(
name: string,
transition: number?
) → ()

CreateZone​

This item only works when running on the server. Server
Weather.CreateZone(
name: string,
zone: {
Position: Vector3,
Radius: number,
Blend: number?,
Weather: string
}
) → ()

SetZone​

This item only works when running on the server. Server
Weather.SetZone(
name: string,
weatherName: string,
transition: number?
) → ()

RemoveZone​

This item only works when running on the server. Server
Weather.RemoveZone(name: string) → ()

ClearZones​

This item only works when running on the server. Server
Weather.ClearZones() → ()

Removes every scripted zone.

Show raw api
{
    "functions": [
        {
            "name": "Decode",
            "desc": "Pulls the replicated state in if it changed. Every read and write below does this first.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 88,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "Exists",
            "desc": "",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 105,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "Names",
            "desc": "Every weather name, `\"Default\"` first, the rest sorted.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ string }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 115,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "Resolve",
            "desc": "Every weather setting for the named weather: its override where it has one, else the module value.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [string]: any }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 132,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "Alpha",
            "desc": "Progress of a cross-fade, 0 to 1, smoothed.",
            "params": [
                {
                    "name": "blend",
                    "desc": "",
                    "lua_type": "Blendable"
                },
                {
                    "name": "now",
                    "desc": "`workspace:GetServerTimeNow()`",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 160,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "Create",
            "desc": "See [Ocean:CreateWeather].",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "overrides",
                    "desc": "",
                    "lua_type": "{ [string]: any }"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 185,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "Set",
            "desc": "See [Ocean:SetWeather].",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "transition",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 214,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "CreateZone",
            "desc": "See [Ocean:CreateZone].",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "zone",
                    "desc": "",
                    "lua_type": "{ Position: Vector3, Radius: number, Blend: number?, Weather: string }"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 227,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "SetZone",
            "desc": "See [Ocean:SetZoneWeather].",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "weatherName",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "transition",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 250,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "RemoveZone",
            "desc": "See [Ocean:RemoveZone].",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 263,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "ClearZones",
            "desc": "Removes every scripted zone.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 274,
                "path": "packages/src/Ocean/Weather.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "State",
            "desc": "The current state.",
            "lua_type": "{ Weathers: { [string]: { [string]: any } }, Global: Blendable, Zones: { [string]: Zone } }",
            "source": {
                "line": 55,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "DEFAULT",
            "desc": "`\"Default\"`.",
            "lua_type": "string",
            "source": {
                "line": 60,
                "path": "packages/src/Ocean/Weather.luau"
            }
        }
    ],
    "types": [
        {
            "name": "Blendable",
            "desc": "",
            "fields": [
                {
                    "name": "Current",
                    "lua_type": "string",
                    "desc": "the weather being shown (or faded toward)"
                },
                {
                    "name": "Previous",
                    "lua_type": "string?",
                    "desc": "the weather being faded from"
                },
                {
                    "name": "Start",
                    "lua_type": "number",
                    "desc": "server time the fade began"
                },
                {
                    "name": "Duration",
                    "lua_type": "number",
                    "desc": "seconds"
                }
            ],
            "source": {
                "line": 38,
                "path": "packages/src/Ocean/Weather.luau"
            }
        },
        {
            "name": "Zone",
            "desc": "",
            "fields": [
                {
                    "name": "X",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "Z",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "Radius",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "Blend",
                    "lua_type": "number",
                    "desc": "studs of rim over which it cross-fades"
                },
                {
                    "name": "Current",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "Previous",
                    "lua_type": "string?",
                    "desc": ""
                },
                {
                    "name": "Start",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "Duration",
                    "lua_type": "number",
                    "desc": ""
                }
            ],
            "source": {
                "line": 50,
                "path": "packages/src/Ocean/Weather.luau"
            }
        }
    ],
    "name": "Weather",
    "desc": "The replicated weather state, behind [Ocean:CreateWeather], [Ocean:SetWeather] and the zone\nmethods. It is state, not a controller: your own scripts decide what the weather is. The whole state\nis one JSON attribute on the module, so late joiners get it for free.\n\n`\"Default\"` always exists and is simply the module's attribute values.",
    "source": {
        "line": 30,
        "path": "packages/src/Ocean/Weather.luau"
    }
}