Tidewater: Oceans, Lakes, Rivers, Waterfalls, Swimming and Splashes Water Kit (fork)
README.md
WaterBody
Any kind of Tidewater water, saved with the scene. Two fields decide what it is:
kind(11 kinds): ocean, shoreline, lake, pond, pool, hotspring, river, stream, waterfall, puddles, underwaterlook(7 looks): realistic, crystal, painted, cartoon, lowpoly, pixel, toy (glossy plastic for toy-style games)
Change either and the water rebuilds in place. preset picks a named variety of that kind
(empty = its default). The rest are the shape: size (x, z metres) and depth for lakes,
ponds, pools and puddle areas; path (points "x,y,z; x,y,z; ...", in the entity's space) and
width for rivers, streams and waterfalls (a waterfall's path runs from the lip down to the
pool); tide (metres, low to high water, 0 = none) and tidePeriod (seconds, default 600) give an ocean, shoreline or lake a tide on the shared water clock; quality (auto, low, medium, high, ultra) sets how finely it is resolved; options takes any kind-specific override as JSON. Its full name is tidewater.components.WaterBody.
The entity's transform places the water. The fields replicate, every peer builds the same water from them, and the waves run on the shared water clock, so every player sees the same surface.
local e = entity.spawnSynced("Lake", { position = { 0, 2, 0 } })
e.component.add("tidewater.components.WaterBody", { kind = "lake", look = "realistic", size = { 60, 40 }, depth = 6 })
e.component.get("tidewater.components.WaterBody").look = "cartoon" -- same lake, cartoon
e.component.get("tidewater.components.WaterBody").kind = "pond" -- now a pond
e.component.get("tidewater.components.WaterBody"):heightAt(5, 3) -- this water's own surface there, nil off it (never another water)
heightAt(x, z), flowAt(x, z), normalAt(x, z) and surfaceAt(x, z) answer for this body
of water alone, even where another water lies above or below it, with the same types as the
handle's (Water.forEntity(id)): a number, { x, y, z } m/s, a unit { x, y, z } (tilted on a
wave's face) and a Water.Surface { height, flow, normal, depth?, water? }; each is nil off
the water. To ask for whatever water is on top at a spot, use Water.heightAt(x, z) from
tidewater.modules.water.
followWeather (on by default) lets an ocean follow the weather: heavy rain or strong wind from a
weather kit (or Water.setWeather) makes the sea bigger and choppier with more whitecaps over
about 12 seconds, and it calms the same way when the weather clears. Turn it off to keep the sea
exactly as its preset made it. With no weather kit nothing changes.