Skip to main content

Regions

Dry regions: tag a BasePart or Model OceanDry and there is no water inside its box. The surface sinks under it, the underwater tint stays off for a camera inside, characters do not swim there and water events treat it as air. Submarine interiors, underwater rooms, diving bells.

A float inside a dry region gets no lift unless the region belongs to it (same model or welded assembly), so a submarine's hull floats while cargo inside it does not.

Types​

Box​

interface Box {
CFrame: CFrame
Half: Vector3--

half size

X: number
Z: number
Reach: number--

bounding radius in XZ

Bottom: number--

world Y

Top: number--

world Y

Instance: Instance--

the tagged part or model

Model: Model?--

the model it belongs to, if any

Owner: BasePart?--

the assembly it is welded into, if any

}

Functions​

Refresh​

Regions.Refresh() → ()

Re-reads every OceanDry instance. Runs twice a second on its own.

List​

Regions.List() → {Box}

Every dry box.

Near​

Regions.Near(
x: number,
z: number,
radius: number
) → {Box}

Dry boxes whose footprint touches the circle (x, z, radius).

IsDry​

Regions.IsDry(point: Vector3) → boolean

True inside any dry box. Ocean:IsDry calls this.

IsDryFor​

Regions.IsDryFor(
point: Vector3,
instance: Instance
) → boolean

Like Regions.IsDry, but a box that belongs to instance (its own model or welded assembly) does not count.

CoversXZ​

Regions.CoversXZ(
box: Box,
x: number,
z: number,
margin: number?
) → boolean

True when (x, z) is within the box's footprint, grown by margin studs.

PushOut​

Regions.PushOut(
box: Box,
x: number,
z: number
) → (
number,--

x

number,--

z

boolean--

was inside

)

The nearest point on the box's footprint edge to (x, z), and whether the point was inside.

Show raw api
{
    "functions": [
        {
            "name": "Refresh",
            "desc": "Re-reads every `OceanDry` instance. Runs twice a second on its own.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 62,
                "path": "src/Ocean/Regions.luau"
            }
        },
        {
            "name": "List",
            "desc": "Every dry box.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ Box }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 104,
                "path": "src/Ocean/Regions.luau"
            }
        },
        {
            "name": "Near",
            "desc": "Dry boxes whose footprint touches the circle `(x, z, radius)`.",
            "params": [
                {
                    "name": "x",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "z",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "radius",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ Box }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 117,
                "path": "src/Ocean/Regions.luau"
            }
        },
        {
            "name": "IsDry",
            "desc": "True inside any dry box. [Ocean:IsDry] calls this.",
            "params": [
                {
                    "name": "point",
                    "desc": "",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 141,
                "path": "src/Ocean/Regions.luau"
            }
        },
        {
            "name": "IsDryFor",
            "desc": "Like [Regions.IsDry], but a box that belongs to `instance` (its own model or welded assembly) does not count.",
            "params": [
                {
                    "name": "point",
                    "desc": "",
                    "lua_type": "Vector3"
                },
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 170,
                "path": "src/Ocean/Regions.luau"
            }
        },
        {
            "name": "CoversXZ",
            "desc": "True when `(x, z)` is within the box's footprint, grown by `margin` studs.",
            "params": [
                {
                    "name": "box",
                    "desc": "",
                    "lua_type": "Box"
                },
                {
                    "name": "x",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "z",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "margin",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 189,
                "path": "src/Ocean/Regions.luau"
            }
        },
        {
            "name": "PushOut",
            "desc": "The nearest point on the box's footprint edge to `(x, z)`, and whether the point was inside.",
            "params": [
                {
                    "name": "box",
                    "desc": "",
                    "lua_type": "Box"
                },
                {
                    "name": "x",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "z",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "x",
                    "lua_type": "number"
                },
                {
                    "desc": "z",
                    "lua_type": "number"
                },
                {
                    "desc": "was inside",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 206,
                "path": "src/Ocean/Regions.luau"
            }
        },
        {
            "name": "Init",
            "desc": "",
            "params": [],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 226,
                "path": "src/Ocean/Regions.luau"
            }
        },
        {
            "name": "Stop",
            "desc": "",
            "params": [],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 244,
                "path": "src/Ocean/Regions.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "Box",
            "desc": "",
            "fields": [
                {
                    "name": "CFrame",
                    "lua_type": "CFrame",
                    "desc": ""
                },
                {
                    "name": "Half",
                    "lua_type": "Vector3",
                    "desc": "half size"
                },
                {
                    "name": "X",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "Z",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "Reach",
                    "lua_type": "number",
                    "desc": "bounding radius in XZ"
                },
                {
                    "name": "Bottom",
                    "lua_type": "number",
                    "desc": "world Y"
                },
                {
                    "name": "Top",
                    "lua_type": "number",
                    "desc": "world Y"
                },
                {
                    "name": "Instance",
                    "lua_type": "Instance",
                    "desc": "the tagged part or model"
                },
                {
                    "name": "Model",
                    "lua_type": "Model?",
                    "desc": "the model it belongs to, if any"
                },
                {
                    "name": "Owner",
                    "lua_type": "BasePart?",
                    "desc": "the assembly it is welded into, if any"
                }
            ],
            "source": {
                "line": 39,
                "path": "src/Ocean/Regions.luau"
            }
        }
    ],
    "name": "Regions",
    "desc": "Dry regions: tag a BasePart or Model `OceanDry` and there is no water inside its box. The surface\nsinks under it, the underwater tint stays off for a camera inside, characters do not swim there and\nwater events treat it as air. Submarine interiors, underwater rooms, diving bells.\n\nA float inside a dry region gets no lift unless the region belongs to it (same model or welded\nassembly), so a submarine's hull floats while cargo inside it does not.",
    "source": {
        "line": 25,
        "path": "src/Ocean/Regions.luau"
    }
}