EditorTerrain

Package: Libraries.Interface.Controls.Scenes.Items · Inherits from: Libraries.Interface.Item3D, Libraries.Interface.Item, Libraries.Game.Graphics.Worlds.TerrainItem, Libraries.Language.Object

The EditorTerrain class is a terrain in the Scene Editor. It is saved in the scene like any item, and loaded with the scene. In the editor it only draws, so it has no collision. A terrain's heights are world positions, so it stays at the origin: the editor's move, turn and scale keys leave it where it is. It isn't an EditorItem, since those are the editor's own helpers, such as highlights and the cursor, which are never saved. Like a model in the editor, it is a scene item with a little more for the editor.

Variables

  • integer STAMP_TOOL: The scene editor's own tools, after the in-game editor's nine.
  • integer FOLIAGE_TOOL: Paints foliage, the assets of the terrain's foliage list.
  • integer RIVER_TOOL: Draws a river along a path of points.
  • integer PAINT_WATER_TOOL: Draws a river along a path of points.
  • integer FILL_WATER_TOOL: the brush.
  • integer ERODE_TOOL
  • integer LAST_TOOL: A new river's width and depth, set in the Water section.
  • integer AUTO_PAINT_TOOL: Paints foliage, the assets of the terrain's foliage list.

Actions

ClearRamp()

Clears the ramp, so its start and end are set again.

CopyAllRegions(Libraries.Game.Graphics.Worlds.TerrainStroke stroke)

Keeps a copy of every region in a stroke, before an operation that changes the whole terrain's painting, such as removing a layer, so it can be undone.

Parameters

DescribeArea()

Describes the ground under the whole brush: its lowest and highest heights, their average, and how much of it each layer covers. There is no slope.

Returns

text: The description

DescribeBrush()

Describes the brush for a screen reader: the tool, where it is, and the ground's height there.

Returns

text: The description

DescribeBrushHeight()

Says the ground's height under the brush in a few words, such as /* Says the ground's height under the brush in a few words, such as "Height 3.2", for each arrow key move.

Returns

text: The description

DescribeBrushRegion()

Returns the region location under the brush, as "x, z".

Returns

text: The location

DescribeCursor()

Describes the terrain cursor for a screen reader, with or without a tool, for the focus, a key's release and the report key: where it is, the ground's height there, the brush's size, and the tool if one is chosen, such as "Terrain cursor at 12, 30, height 7.4. Size 5. Raise tool." There is no slope: under a big brush there is no one slope.

Returns

text: The description

DescribeFoliageUnderBrush()

Describes the foliage under the brush: how many copies of each asset, and how much of each asset's coverage is painted at the brush's middle, from 0 to 1, such as "12 Pine, coverage 0.8, 3 Rock, coverage 0.2", or "no foliage".

Returns

text: The description

DescribeHeightChange(number before)

Says how the ground's height changed with an arrow key step, such as "Up 1.4, height 5.6", "Down 2.3, height 5.1" or "Level, height 7.4".

Parameters

  • before number: The ground's height where the step began

Returns

text: The description

DescribeRamp()

Describes the ramp, such as "from 10, 5 at height 2 to 30, 5 at height 8", or what is still missing.

Returns

text: The description

DescribeSize()

Returns the terrain's size, such as "128 by 128 units, 4 regions".

Returns

text: The size

GetBrush()

Returns the terrain's brush, with its size, strength and falloff.

Returns

Libraries.Game.Graphics.Worlds.TerrainBrush: The brush

GetBrushX()

Returns where the brush's middle is along x.

Returns

number: The brush's x

GetBrushZ()

Returns where the brush's middle is along z.

Returns

number: The brush's z

GetCollisionMode()

Returns how the terrain collides in games, as saved in the scene.

Returns

integer: The collision mode

GetDrawRadius()

Returns the terrain's draw radius in games, for streaming.

Returns

number: The draw radius

GetFoliageAsset()

Returns the foliage asset the Foliage tool paints, by its number in the terrain's foliage list.

Returns

integer: The asset's number, from 0

GetFoliageAssetCount()

Returns how many foliage assets the terrain's foliage list has.

Returns

integer: The count, 0 for no list

GetFoliageBrushMode()

Returns what the Foliage tool's brush does: 0 paints the chosen asset, 1 removes the chosen asset, and 2 removes every asset, the same numbers as FoliageStroke's ADD_COPIES, REMOVE_ASSET and REMOVE_ALL.

Returns

integer: The mode, from 0 to 2

GetFoliageDensityScale()

Returns how many times the Foliage tool multiplies its asset's density: the brush's strength, where the usual strength is 1.

Returns

number: The multiplier

GetLayerCount()

Returns how many ground layers the terrain's material has, from 0 to 4.

Returns

integer: The number of layers

GetLayerLabel(integer layer)

Returns a layer's name for speaking, from the terrain's materials, such as "Rocks", or "layer 3" if it has no material.

Parameters

  • layer integer: The layer, from 0

Returns

text: The name

GetMainLayer(integer code)

Returns the layer with the most weight in packed splat weights, from 0 to 3.

Parameters

  • code integer: The packed weights

Returns

integer: The layer

GetMaximumX()

Returns the largest x the terrain's regions cover, in world units.

Returns

number: The largest x, or 0 for a terrain with no regions

GetMaximumZ()

Returns the largest z the terrain's regions cover, in world units.

Returns

number: The largest z, or 0 for a terrain with no regions

GetMinimumX()

Returns the smallest x the terrain's regions cover, in world units.

Returns

number: The smallest x, or 0 for a terrain with no regions

GetMinimumZ()

Returns the smallest z the terrain's regions cover, in world units.

Returns

number: The smallest z, or 0 for a terrain with no regions

GetRampStartHeight()

Returns the ramp's height at its start.

Returns

number: The start's height

GetRampStartX()

Returns the ramp's start along x.

Returns

number: The start's x

GetRampStartZ()

Returns the ramp's start along z.

Returns

number: The start's z

GetRiverDepth()

Returns how deep a new river is in its middle.

Returns

number: The depth

GetRiverWidth()

Returns how wide a new river is.

Returns

number: The width

GetSampleEdge(boolean alongX, boolean smallest)

Returns the smallest sample along x or z that any region has, or the largest.

Parameters

  • alongX boolean: True for x, false for z
  • smallest boolean: True for the smallest, false for the largest

Returns

integer: The sample, or 0 for a terrain with no regions

GetSavedToolNumber()

Returns the tool that was chosen when the user last left this terrain, or 0.

Returns

integer: The tool's number, from 0 to 16

GetSceneEditor()

Returns the SceneEditor this terrain is a part of.

Returns

Libraries.Interface.Controls.Scenes.SceneEditor: The SceneEditor this terrain is in

GetStampHeight()

Returns the height of the Stamp tool's shape, in world units.

Returns

number: The height

GetStampMode()

Returns how the Stamp tool meets the ground, or -1 for the shape's usual way.

Returns

integer: The mode

GetStampShape()

Returns the Stamp tool's shape.

Returns

integer: The shape

GetStampTurn()

Returns how far the Stamp tool's shape is turned, in degrees.

Returns

number: The turn

GetToolName(integer tool)

Returns a tool's name, by its number.

Parameters

  • tool integer

Returns

text: Its name, such as "Raise", or "No tool" for 0

GetToolNumber()

Returns the chosen tool's number, from 1 to 16, or 0 for none.

Returns

integer: The tool's number

GetWaterDepth()

Returns how far above the ground under the brush the Fill water and Paint water tools put the water's level.

Returns

number: The depth, in world units

GetWaterFillMode()

Returns how Fill water fills.

Returns

integer: TerrainLake's FILL_TO_LEVEL (0) or FILL_POURED (1)

HasCollision()

Returns whether the terrain collides in games, as saved in the scene.

Returns

boolean: True for collision in games

HasRamp()

Returns true once both ends of the ramp are set.

Returns

boolean: True if the ramp is set

HasRampStart()

Returns true once the ramp's start is set.

Returns

boolean: True if the start is set

HasTool()

Returns true if a tool is chosen, so the brush is in use.

Returns

boolean: True if a tool is chosen

HasUnsavedChanges()

Returns whether any of the terrain's own files (its heights and painting, its foliage list, or its material) have changes that the next save of the scene would write.

Returns

boolean: True if the terrain has unsaved changes

IsBrushInGrid()

Returns true if the brush's middle is inside the grid of places a region can be, from -16 to 15 regions along each side.

Returns

boolean: True if a region can be at the brush

IsBrushOnGround()

Returns true if the brush is over the terrain's ground.

Returns

boolean: True if the brush is on the ground

IsBrushPlaced()

Returns true once the brush, which is also the terrain cursor, has been put somewhere on this terrain.

Returns

boolean: True if the brush has a place

IsChanged()

Returns whether the terrain's own files have changes that the next save of the scene must write.

Returns

boolean: True if the terrain has changed since it was saved

IsFoliageListChanged()

Returns whether the terrain's foliage list file has changes that the next save of the scene must write.

Returns

boolean: True if the list has changed since it was saved

IsMaterialChanged()

Returns whether the terrain's material files have changes that the next save of the scene must write.

Returns

boolean: True if the material has changed since it was saved

IsRiverEndingInWater()

Returns true if a river being drawn finishes when a point is put in water, the sea or a lake.

Returns

boolean: True if it finishes in water

IsStreaming()

Returns whether the terrain streams in games.

Returns

boolean: True for streaming in games

RegionsMatchModels()

Returns true if the terrain has a region model for each of its regions. After regions are added or removed, it doesn't, until RebuildRegionModels.

Returns

boolean: True if the models match the regions

SaveIfChanged()

Saves the terrain's own files, if they have changed, and marks it unchanged. The scene editor calls it when the scene is saved.

SetBrushOffGround()

Marks the brush as off the ground, such as when the pointer is over the sky.

SetBrushPosition(number x, number z)

Puts the brush's middle at a place on the ground. If no region is there, the brush is off the ground, and isn't drawn.

Parameters

  • x number: The place along x
  • z number: The place along z

SetChanged(boolean changed)

Sets whether the terrain's own files have changes that the next save of the scene must write. Tools that change the terrain set it.

Parameters

  • changed boolean: True if the terrain has changed

SetCollision(boolean enabled)

Sets whether the terrain collides in games. It is saved in the scene. In the editor, the terrain only draws, whatever this is.

Parameters

  • enabled boolean: True for collision in games

SetCollisionMode(integer mode)

Sets how the terrain collides in games: WorldTerrain's COLLISION_FULL (2), COLLISION_DYNAMIC (1) or COLLISION_DISABLED (0). It is saved in the scene. In the editor, the terrain only draws.

Parameters

  • mode integer: The collision mode

SetFoliageAsset(integer asset)

Sets the foliage asset the Foliage tool paints.

Parameters

  • asset integer: The asset's number in the foliage list, from 0

SetFoliageBrushMode(integer mode)

Sets what the Foliage tool's brush does: 0 paints the chosen asset, 1 removes the chosen asset, and 2 removes every asset.

Parameters

  • mode integer: The mode, from 0 to 2

SetFoliageListChanged(boolean changed)

Sets whether the terrain's foliage list file has changes that the next save of the scene must write.

Parameters

  • changed boolean: True if the list has changed

SetMaterialChanged(boolean changed)

Sets whether the terrain's material files have changes that the next save of the scene must write.

Parameters

  • changed boolean: True if the material has changed

SetNextRampPoint()

Sets the ramp's next end at the brush, for its key: the start if none is set or both are, which begins a new ramp; otherwise the end.

Returns

text: What was set, for speaking

SetRampPoint(boolean isEnd)

Sets one end of the ramp at the brush, with the ground's height there. Once both ends are set, the ramp tool shapes the ground under the brush toward a straight slope between them.

Parameters

  • isEnd boolean: True for the ramp's end, false for its start

Returns

text: What was set, for speaking

SetRiverDepth(number depth)

Sets how deep a new river is in its middle.

Parameters

  • depth number: The depth

SetRiverEndingInWater(boolean value)

Sets whether a river being drawn finishes when a point is put in water.

Parameters

  • value boolean: True to finish in water

SetRiverWidth(number width)

Sets how wide a new river is.

Parameters

  • width number: The width

SetSavedToolNumber(integer tool)

Remembers the tool that was chosen when the user left this terrain, so the scene editor can choose it again when they return.

Parameters

  • tool integer: The tool's number, from 0 to 16

SetSceneEditor(Libraries.Interface.Controls.Scenes.SceneEditor editor)

Sets the SceneEditor this terrain is a part of.

Parameters

SetStampHeight(number height)

Sets the height of the Stamp tool's shape, in world units.

Parameters

  • height number: The height

SetStampMode(integer mode)

Sets how the Stamp tool meets the ground: -1 for the shape's usual way, or TerrainGenerator's STAMP_ADD, STAMP_SUBTRACT or STAMP_RAISE.

Parameters

  • mode integer: The mode

SetStampShape(integer shape)

Sets the Stamp tool's shape: TerrainGenerator's STAMP_HILL, STAMP_MOUNTAIN, STAMP_MESA, STAMP_CRATER or STAMP_RIDGE.

Parameters

  • shape integer: The shape

SetStampTurn(number turn)

Sets how far the Stamp tool's shape is turned, in degrees.

Parameters

  • turn number: The turn

SetStreaming(boolean stream, number radius)

Sets whether the terrain streams in games, and its draw radius there. It is saved in the scene. The editor always loads every region.

Parameters

  • stream boolean: True to stream in games
  • radius number: The draw radius in games, more than 0

SetToolNumber(integer tool)

Chooses a tool, numbered as in the in-game terrain editor: 1 raise, 2 lower, 3 smooth, 4 flatten, 5 ramp, 6 paint, 7 blend paint, 8 add region, 9 remove region; then, in the scene editor only, 10 stamp, 11 erode and 12 auto paint, which are strokes, 13 foliage, 14 fill water, 15 paint water and 16 river; or 0 for none. The first time a tool is chosen, the brush starts at the terrain's middle.

Parameters

  • tool integer

SetWaterDepth(number depth)

Sets how far above the ground under the brush the water tools put the water's level.

Parameters

  • depth number: The depth, in world units, more than 0

SetWaterFillMode(integer mode)

Sets how Fill water fills: up to its level, wherever the hollow's rim is, or as poured water, which stops at the rim.

Parameters

  • mode integer: TerrainLake's FILL_TO_LEVEL (0) or FILL_POURED (1)

Update(number secondsSinceUpdate)

Does nothing: the scene editor keeps its terrains up to date itself, around its own camera.

Parameters

  • secondsSinceUpdate number

Inherited Actions

50 actions from Libraries.Game.Graphics.Worlds.TerrainItem
62 actions from Libraries.Interface.Item
213 actions from Libraries.Interface.Item3D
3 actions from Libraries.Language.Object