Table of Contents

====== SandDef ======

Description

`SandDef` is a byte value (ranging from 1 to 255) that defines the type of sand to be created. Each value corresponds to a specific type of sand with unique properties (e.g., color, density, behavior). A value of 255 indicates “empty” or no sand, but it is not considered null.

Usage

`SandDef` is used as an input parameter in various sand creation commands, such as:

* CreateSand * CreateSandInRoundArea * CreateSandInAreaRand * CreateSandInArea

Examples

1 ->sandDef  // Creates sand of type 1
5 ->sandDef  // Creates sand of type 5
255 ->sandDef // Creates "empty" sand (no sand)

====== CreateSand ====== CreateSand(<-x <-y <-sandDef)

Description

Creates sand at the specified coordinates (x, y) using the provided sand definition (`sandDef`).

Examples

10 20 1 ->sandDef ->y ->x 
CreateSand(<-x <-y <-sandDef)

See Also

CreateSandInRoundArea

CreateSandInAreaRand

CreateSandInArea

====== CreateSandInRoundArea ====== CreateSandInRoundArea(<-rect <-probability <-sandDef)

Description

Creates sand within a rectangular area defined by a vector (`rect`) containing the bottom-left (x,y) and top-right (x,y) corner coordinates. The `probability` value (between 0 and 1) determines the chance of sand being created at each cell within the area. Sand is created using the specified sand definition (`sandDef`).

Examples

{0 0 10 10} ->rect 
0.5 ->probability 
1 ->sandDef
CreateSandInRoundArea(<-rect <-probability <-sandDef)

See Also

CreateSand

CreateSandInAreaRand

CreateSandInArea

====== CreateSandInAreaRand ====== CreateSandInAreaRand(<-rect <-probability <-sandDef)

Description

Creates sand within a rectangular area defined by a vector (`rect`) containing the bottom-left (x,y) and top-right (x,y) corner coordinates. The `probability` value (between 0 and 1) determines the chance of sand being created at each cell within the area. The distribution of sand is randomized. Sand is created using the specified sand definition (`sandDef`).

Examples

{0 0 10 10} ->rect
0.5 ->probability
1 ->sandDef
CreateSandInAreaRand(<-rect <-probability <-sandDef)

See Also

CreateSand

CreateSandInRoundArea

CreateSandInArea

====== CreateSandInArea ====== CreateSandInArea(<-rect <-sandDef)

Description

Creates sand within a rectangular area defined by a vector (`rect`) containing the bottom-left (x,y) and top-right (x,y) corner coordinates. Sand is created at every cell within the area using the specified sand definition (`sandDef`).

Examples

{0 0 10 10} ->rect
1 ->sandDef
CreateSandInArea(<-rect <-sandDef)

See Also

CreateSand

CreateSandInRoundArea

CreateSandInAreaRand

====== SetSandColor ====== SetSandColor(<-x <-y <-colors)

Description

Sets the color and glow of the sand at the specified coordinates (x, y) using a vector (`colors`) containing two colors. The first color in the vector sets the base color of the sand, and the second color sets the glow color.

Examples

10 20 ->y ->x
{ {1 0 0 1} {0 1 0 1} } ->colors // Set sand color to red and glow to green
SetSandColor(<-x <-y <-colors)

See Also

GetSandDef

GetMapSandCount

CountSandInArea

====== GetSandDef ====== GetSandDef(<-sandName) ->sandDef

Description

Retrieves the sand definition (`sandDef`) associated with the given `sandName`.

Examples

"SandType1" ->sandName
GetSandDef(<-sandName) ->sandDef

See Also

SetSandColor

GetMapSandCount

CountSandInArea

====== GetMapSandCount ====== GetMapSandCount(<-sandDef) ->count

Description

Returns the total number of sand particles of the specified type (`sandDef`) present on the map. The input `sandDef` value is clamped between 0 and 255.

Examples

1 ->sandDef // Get the count of sand particles with SandDef 1
GetMapSandCount(<-sandDef) ->count

See Also

SetSandColor

GetSandDef

CountSandInArea

====== CountSandInArea ====== CountSandInArea(<-rect <-sandDef) ->count

Description

Counts the number of sand particles of the specified type (`sandDef`) within a rectangular area defined by a vector (`rect`) containing the bottom-left (x,y) and top-right (x,y) corner coordinates.

Examples

{0 0 10 10} ->rect
1 ->sandDef // Count sand particles with SandDef 1 within the area
CountSandInArea(<-rect <-sandDef) ->count

See Also

SetSandColor

GetSandDef

GetMapSandCount

====== GetSandInArea ====== GetSandInArea(<-rect <-isRound <-sandDefs <-inclusive) ->sandList

Description

Retrieves a list (`sandList`) of sand particles within a specified area. The area is defined by a vector (`rect`) containing the bottom-left (x,y) and top-right (x,y) corner coordinates. `isRound` (boolean) determines if the area is treated as a rounded rectangle. `sandDefs` is a list of sand definitions to include in the search. `inclusive` (boolean) determines if only the specified `sandDefs` should be included or if all other types should be included.

Examples

{0 0 10 10} ->rect
false ->isRound
{1 2 3} ->sandDefs // List of SandDefs
true ->inclusive // Include only sand particles with SandDef 1, 2, or 3
GetSandInArea(<-rect <-isRound <-sandDefs <-inclusive) ->sandList

====== DestroySandInArea ====== DestroySandInArea(<-rect <-isRound <-sandDefs <-inclusive)

Description

Destroys sand particles within a specified area. The area is defined by a vector (`rect`) containing the bottom-left (x,y) and top-right (x,y) corner coordinates. `isRound` (boolean) determines if the area is treated as a rounded rectangle. `sandDefs` is a list of sand definitions to target for destruction. `inclusive` (boolean) determines if only the specified `sandDefs` should be destroyed or if all other types should be destroyed.

Examples

{0 0 10 10} ->rect
false ->isRound
{1 2 3} ->sandDefs // List of SandDefs
true ->inclusive // Destroy only sand particles with SandDef 1, 2, or 3
DestroySandInArea(<-rect <-isRound <-sandDefs <-inclusive)

====== DestroySandFromList ====== DestroySandFromList(<-sandList)

Description

Destroys sand particles from a given list (`sandList`). This list could be obtained from commands like `GetSandInArea`.

Examples

// Assuming 'sandList' was obtained from a previous command
DestroySandFromList(<-sandList) 

====== GetSandDefData ====== GetSandDefData(<-sandDef) ->sandDefData

Description

Retrieves data associated with a specific sand definition (`sandDef`). The returned `sandDefData` may contain various properties of the sand type, such as color, density, and behavior.

Examples

1 ->sandDef // Get data for sand with SandDef 1
GetSandDefData(<-sandDef) ->sandDefData