User Tools

Site Tools


crpl:docs:floodfillterrain

<- CRPL reference <- Terrain and Wall Commands

FloodFillTerrain

Arguments Result Notation
X, Y, min_height, max_height, avoid_occupied, full_cells_only, max_size a list. i1 i2 i3 i4 b1 b2 i5 – l1

Description

Returns a list of packed coordinates in the y*MapWidth+x format that satisfy the following conditions:

  • The set is connected. Meaning that without walking out of the group or teleporting, you can visit all of them.
  • The set is empty or contains (X,Y)
  • The set is filled only with squares at height between min_height and max_height inclusive.
  • There are no more than max_size squares in the set.
  • If avoid_occupied is set, no square is under an object, unless that object is over (X,Y).
  • If full_cells_only is set, no square is one of those triangle areas at the border of two height regions.
  • No square is one of those triangle areas if the flood fill is on the low side.

Examples

:destroyed
MapWidth ->w
#Create a digitalis growth area bomb that conforms to the terrain struck,
#but avoids diagonal walls and puts growth under structures.
CurrentCoords dup2 GetTerrain dup FALSE TRUE 20 FloodFillTerrain ->list
<-list GetListCount 0 do
  #extract the coordinates
  <-list I GetListElement ->a
  <-a <-w mod ->x
  <-a <-w div ->y
  #place the digitalis
  <-x <-y TRUE SetDigitalisGrowth
loop
crpl/docs/floodfillterrain.txt · Last modified: 2021/02/05 11:45 by Karsten75