WaterState
Package: Libraries.Interface.Controls.Scenes · Inherits from: Libraries.Language.Object
A WaterState is a copy of everything about a terrain's water at one moment: whether it has a sea and the sea's level, its lakes in order with their places, sizes, levels and names, its rivers in order with their points and the ground they carved, and the water's look. The scene editor keeps one from before and one from after each water change, so the change can be undone and redone.
Example Code
use Libraries.Interface.Controls.Scenes.WaterState
use Libraries.Game.Graphics.Worlds.TerrainItem
TerrainItem ground
ground:Load("Scenes/Terrains/Terrain1/terrain.json")
WaterState before
before:Copy(ground)
ground:SetSeaLevel(2)
before:Apply(ground)
Actions
Apply(Libraries.Game.Graphics.Worlds.TerrainItem terrain)
Gives a terrain's water this state: the sea, the lakes and the look. The lakes are taken out and put back in this state's order, each made as it was kept: name, level, shape and cells; their sheets are made again on the terrain's next update.
Parameters
terrainLibraries.Game.Graphics.Worlds.TerrainItem: The terrain
Copy(Libraries.Game.Graphics.Worlds.TerrainItem terrain)
Copies a terrain's water as it is now.
Parameters
terrainLibraries.Game.Graphics.Worlds.TerrainItem: The terrain
GetLakeCopies()
Returns the kept copies of the lakes, in order.
Returns
Libraries.Containers.Array<Libraries.Game.Graphics.Worlds.TerrainLake>: The copies
GetLakes()
Returns the lakes, in order.
Returns
Libraries.Containers.Array<Libraries.Game.Graphics.Worlds.TerrainLake>: The lakes
GetLook()
Returns the look's numbers.
Returns
Libraries.Containers.Array<number>: The numbers
GetRiverCopies()
Returns the kept copies of the rivers, in order.
Returns
Libraries.Containers.Array<Libraries.Game.Graphics.Worlds.TerrainRiver>: The copies
GetRivers()
Returns the rivers, in order.
Returns
Libraries.Containers.Array<Libraries.Game.Graphics.Worlds.TerrainRiver>: The rivers
GetSeaLevel()
Returns the sea's level.
Returns
number: The level
HasSea()
Returns true if the state has a sea.
Returns
boolean: True for a sea
IsSameAs(Libraries.Interface.Controls.Scenes.WaterState other)
Returns true if this state is the same as another, so a change that changed nothing isn't put in the undo list.
Parameters
otherLibraries.Interface.Controls.Scenes.WaterState: The other state
Returns
boolean: True if they are the same
TakeOutLake(Libraries.Game.Graphics.Worlds.TerrainItem terrain, Libraries.Game.Graphics.Worlds.TerrainLake lake)
Takes a lake out of a terrain's water, with its sheet, which the water's own RemoveLake leaves in the terrain.
Parameters
terrainLibraries.Game.Graphics.Worlds.TerrainItem: The terrainlakeLibraries.Game.Graphics.Worlds.TerrainLake: The lake