Show raw api
{
"functions": [
{
"name": "Init",
"desc": "Starts the ocean on this side: reads the settings, compiles the weather, starts obstacle and zone\ntracking, water events and (on a client) the renderer. Safe to call more than once. The installed\n`OceanServer` and `OceanClient` scripts already do this.",
"params": [],
"returns": [],
"function_type": "static",
"source": {
"line": 150,
"path": "src/Ocean/init.luau"
}
},
{
"name": "CreateWeather",
"desc": "Defines (or redefines) a named weather: a table of setting overrides, keyed by setting name. Only\nsettings marked as weather settings count (waves, colours, foam, spray, the underwater tint);\nanything else in the table is ignored, so an entry of [Presets.Ocean] can be passed straight in.\n\n```lua\nOcean:CreateWeather(\"Storm\", Ocean.Presets.Ocean[\"Pirate Seas\"])\nOcean:CreateWeather(\"Glassy\", { WaveHeight = 0.2, FoamOpacity = 0 })\n```",
"params": [
{
"name": "name",
"desc": "any name except \"Default\"",
"lua_type": "string"
},
{
"name": "overrides",
"desc": "setting name to value",
"lua_type": "{ [string]: any }"
}
],
"returns": [],
"function_type": "method",
"realm": [
"Server"
],
"source": {
"line": 182,
"path": "src/Ocean/init.luau"
}
},
{
"name": "SetWeather",
"desc": "Cross-fades the whole sea to a weather created with [Ocean:CreateWeather], or back to `\"Default\"`\n(the module's own attribute values). The fade is a function of server time, so every client and the\nserver physics stay in step.",
"params": [
{
"name": "name",
"desc": "",
"lua_type": "string"
},
{
"name": "transition",
"desc": "seconds to fade over (default 0)",
"lua_type": "number?"
}
],
"returns": [],
"function_type": "method",
"realm": [
"Server"
],
"source": {
"line": 195,
"path": "src/Ocean/init.luau"
}
},
{
"name": "GetWeather",
"desc": "The name of the weather the whole sea is in (or fading toward).",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "string"
}
],
"function_type": "method",
"source": {
"line": 204,
"path": "src/Ocean/init.luau"
}
},
{
"name": "CreateZone",
"desc": "Creates a scripted weather zone: a disc of ocean with its own weather, blended into the surrounding\nsea across `Blend` studs at its rim. For zones built in Studio, tag a part `OceanZone` instead\n(see [Zones]).",
"params": [
{
"name": "name",
"desc": "",
"lua_type": "string"
},
{
"name": "zone",
"desc": "`Blend` defaults to 35% of the radius",
"lua_type": "{ Position: Vector3, Radius: number, Blend: number?, Weather: string }"
}
],
"returns": [],
"function_type": "method",
"realm": [
"Server"
],
"source": {
"line": 217,
"path": "src/Ocean/init.luau"
}
},
{
"name": "SetZoneWeather",
"desc": "Cross-fades one scripted zone to another weather.",
"params": [
{
"name": "name",
"desc": "the zone",
"lua_type": "string"
},
{
"name": "weatherName",
"desc": "",
"lua_type": "string"
},
{
"name": "transition",
"desc": "seconds (default 0)",
"lua_type": "number?"
}
],
"returns": [],
"function_type": "method",
"realm": [
"Server"
],
"source": {
"line": 229,
"path": "src/Ocean/init.luau"
}
},
{
"name": "RemoveZone",
"desc": "Removes a scripted zone; the global weather takes over there.",
"params": [
{
"name": "name",
"desc": "",
"lua_type": "string"
}
],
"returns": [],
"function_type": "method",
"realm": [
"Server"
],
"source": {
"line": 239,
"path": "src/Ocean/init.luau"
}
},
{
"name": "GetHeight",
"desc": "World Y of the surface directly above or below the point, right now. Works on both sides and\naccounts for weather, zones, obstacles and `FlatSea`.",
"params": [
{
"name": "position",
"desc": "",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "",
"lua_type": "number"
}
],
"function_type": "method",
"source": {
"line": 250,
"path": "src/Ocean/init.luau"
}
},
{
"name": "GetWaterHeight",
"desc": "Alias of [Ocean:GetHeight].",
"params": [
{
"name": "position",
"desc": "",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "",
"lua_type": "number"
}
],
"function_type": "method",
"source": {
"line": 265,
"path": "src/Ocean/init.luau"
}
},
{
"name": "GetDepth",
"desc": "How far below the surface the point is. Negative means above the water. Ignores dry regions.",
"params": [
{
"name": "position",
"desc": "",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "",
"lua_type": "number"
}
],
"function_type": "method",
"source": {
"line": 276,
"path": "src/Ocean/init.luau"
}
},
{
"name": "IsUnderWater",
"desc": "True when the point is below the surface and not inside a dry region.",
"params": [
{
"name": "position",
"desc": "",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "method",
"source": {
"line": 286,
"path": "src/Ocean/init.luau"
}
},
{
"name": "IsAboveWater",
"desc": "The opposite of [Ocean:IsUnderWater].",
"params": [
{
"name": "position",
"desc": "",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "method",
"source": {
"line": 296,
"path": "src/Ocean/init.luau"
}
},
{
"name": "IsDry",
"desc": "True inside an `OceanDry` region (a submarine interior, an underwater room).",
"params": [
{
"name": "position",
"desc": "",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "method",
"source": {
"line": 307,
"path": "src/Ocean/init.luau"
}
},
{
"name": "GetSurfaceNormal",
"desc": "The surface normal at the point, sampled from the height field. Use it to align boats, decals or spray.",
"params": [
{
"name": "position",
"desc": "",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "",
"lua_type": "Vector3"
}
],
"function_type": "method",
"source": {
"line": 318,
"path": "src/Ocean/init.luau"
}
},
{
"name": "GetWaterState",
"desc": "The current water state of a tracked instance (tagged `OceanFloat` or `OceanTrack`, or a player\ncharacter), or nil if it is not tracked.",
"params": [
{
"name": "instance",
"desc": "",
"lua_type": "Instance"
}
],
"returns": [
{
"desc": "",
"lua_type": "Tracker.State?"
}
],
"function_type": "method",
"source": {
"line": 333,
"path": "src/Ocean/init.luau"
}
},
{
"name": "IsInWater",
"desc": "True when any part of a tracked instance is in the water.",
"params": [
{
"name": "instance",
"desc": "",
"lua_type": "Instance"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "method",
"source": {
"line": 343,
"path": "src/Ocean/init.luau"
}
},
{
"name": "GetInstancesInWater",
"desc": "Every tracked instance that is currently in the water.",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "{ Instance }"
}
],
"function_type": "method",
"source": {
"line": 353,
"path": "src/Ocean/init.luau"
}
},
{
"name": "AddFloat",
"desc": "Tags a part to float (the plugin's Buoyancy addon does the physics). Plain CollectionService tags\nunderneath, so `part:AddTag(\"OceanFloat\")` does the same.",
"params": [
{
"name": "part",
"desc": "",
"lua_type": "BasePart"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 364,
"path": "src/Ocean/init.luau"
}
},
{
"name": "RemoveFloat",
"desc": "Removes the float tag.",
"params": [
{
"name": "part",
"desc": "",
"lua_type": "BasePart"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 373,
"path": "src/Ocean/init.luau"
}
},
{
"name": "AddObstacle",
"desc": "Tags a part or model as an obstacle: the sea calms against it. The `OceanShore` and\n`OceanCalmness` attributes on the instance tune the effect.",
"params": [
{
"name": "instance",
"desc": "",
"lua_type": "Instance"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 383,
"path": "src/Ocean/init.luau"
}
},
{
"name": "RemoveObstacle",
"desc": "Removes the obstacle tag.",
"params": [
{
"name": "instance",
"desc": "",
"lua_type": "Instance"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 392,
"path": "src/Ocean/init.luau"
}
},
{
"name": "AddDryRegion",
"desc": "Tags a part or model as a dry region: no water inside its box.",
"params": [
{
"name": "instance",
"desc": "",
"lua_type": "Instance"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 401,
"path": "src/Ocean/init.luau"
}
},
{
"name": "RemoveDryRegion",
"desc": "Removes the dry-region tag.",
"params": [
{
"name": "instance",
"desc": "",
"lua_type": "Instance"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 410,
"path": "src/Ocean/init.luau"
}
},
{
"name": "Track",
"desc": "Gets water events and [Ocean:GetWaterState] for an instance without floating it.",
"params": [
{
"name": "instance",
"desc": "",
"lua_type": "Instance"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 420,
"path": "src/Ocean/init.luau"
}
},
{
"name": "Untrack",
"desc": "Stops tracking an instance.",
"params": [
{
"name": "instance",
"desc": "",
"lua_type": "Instance"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 429,
"path": "src/Ocean/init.luau"
}
},
{
"name": "GetZoneAt",
"desc": "The name of the `OceanZone` whose box contains the point, or nil.",
"params": [
{
"name": "position",
"desc": "",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "",
"lua_type": "string?"
}
],
"function_type": "method",
"source": {
"line": 440,
"path": "src/Ocean/init.luau"
}
},
{
"name": "GetZones",
"desc": "The names of every `OceanZone` in the place.",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "{ string }"
}
],
"function_type": "method",
"source": {
"line": 450,
"path": "src/Ocean/init.luau"
}
},
{
"name": "GetWeatherAt",
"desc": "The name of the weather with the most influence at a point, zones included.",
"params": [
{
"name": "position",
"desc": "",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "",
"lua_type": "string"
}
],
"function_type": "method",
"source": {
"line": 464,
"path": "src/Ocean/init.luau"
}
},
{
"name": "Preview",
"desc": "Used by the Studio plugin to render the sea in Edit mode.",
"params": [
{
"name": "host",
"desc": "",
"lua_type": "Instance"
},
{
"name": "into",
"desc": "",
"lua_type": "Instance"
}
],
"returns": [],
"function_type": "static",
"private": true,
"source": {
"line": 483,
"path": "src/Ocean/init.luau"
}
},
{
"name": "StopPreview",
"desc": "Stops an Edit-mode preview.",
"params": [],
"returns": [],
"function_type": "static",
"private": true,
"source": {
"line": 496,
"path": "src/Ocean/init.luau"
}
}
],
"properties": [
{
"name": "Settings",
"desc": "The settings spec and accessors.",
"lua_type": "Settings",
"source": {
"line": 64,
"path": "src/Ocean/init.luau"
}
},
{
"name": "Waves",
"desc": "The wave function: heights, displacement, obstacles.",
"lua_type": "Waves",
"source": {
"line": 69,
"path": "src/Ocean/init.luau"
}
},
{
"name": "Weather",
"desc": "The replicated weather state.",
"lua_type": "Weather",
"source": {
"line": 74,
"path": "src/Ocean/init.luau"
}
},
{
"name": "Presets",
"desc": "Ready-made physics, looks and whole oceans.",
"lua_type": "Presets",
"source": {
"line": 79,
"path": "src/Ocean/init.luau"
}
},
{
"name": "Regions",
"desc": "Dry regions (`OceanDry`).",
"lua_type": "Regions",
"source": {
"line": 84,
"path": "src/Ocean/init.luau"
}
},
{
"name": "Tracker",
"desc": "Per-instance water state.",
"lua_type": "Tracker",
"source": {
"line": 89,
"path": "src/Ocean/init.luau"
}
},
{
"name": "Zones",
"desc": "Tagged `OceanZone` areas.",
"lua_type": "Zones",
"source": {
"line": 94,
"path": "src/Ocean/init.luau"
}
},
{
"name": "Tags",
"desc": "The current tag names (they follow the `FloatTag`, `ObstacleTag`, `DryTag` and `TrackTag` settings).",
"lua_type": "{ Float: string, Obstacle: string, Dry: string, Track: string }",
"source": {
"line": 99,
"path": "src/Ocean/init.luau"
}
},
{
"name": "EnteredWater",
"desc": "Fires when a tracked instance or character goes from dry to touching the water.",
"lua_type": "RBXScriptSignal<Instance>",
"source": {
"line": 104,
"path": "src/Ocean/init.luau"
}
},
{
"name": "ExitedWater",
"desc": "Fires when a tracked instance or character leaves the water entirely.",
"lua_type": "RBXScriptSignal<Instance>",
"source": {
"line": 109,
"path": "src/Ocean/init.luau"
}
},
{
"name": "WentUnderWater",
"desc": "Fires when a tracked instance or character becomes fully submerged.",
"lua_type": "RBXScriptSignal<Instance>",
"source": {
"line": 114,
"path": "src/Ocean/init.luau"
}
},
{
"name": "WentAboveWater",
"desc": "Fires when a fully submerged instance or character surfaces again.",
"lua_type": "RBXScriptSignal<Instance>",
"source": {
"line": 119,
"path": "src/Ocean/init.luau"
}
}
],
"types": [],
"name": "Ocean",
"desc": "The module itself: `require(game.ReplicatedStorage.Ocean)`. Everything you need day to day is here:\nweather, zones, water queries, water events and tag helpers. The other classes are the pieces it is\nbuilt from; reach for them only when you need something lower level.\n\n```lua\nlocal Ocean = require(game.ReplicatedStorage.Ocean)\n\n-- server: define a weather and cross-fade the whole sea into it over 20 seconds\nOcean:CreateWeather(\"Rough\", Ocean.Presets.Ocean[\"Pirate Seas\"])\nOcean:SetWeather(\"Rough\", 20)\n\n-- anywhere: where is the surface right now?\nlocal y = Ocean:GetHeight(boat.Position)\n```\n\nSettings are attributes on the module (see [Settings]); the server owns them and they replicate.\nThe bootstrap scripts the plugin installs call [Ocean.Init] once on the server and once on every\nclient, so you never have to.",
"source": {
"line": 59,
"path": "src/Ocean/init.luau"
}
}