Index

SetFieldRect

SetFieldRect(<-cellX <-cellZ <-fieldRect <-rectWidth <-strength <-direction <-affected <-deploy)

Description

Sets the field cells as defined by the fieldRect.

Fields are reset on map load, so any fields must be recreated in the :awake method.

This method is, in essence, a more performant way to call SetFieldCell over a larger area. Despite the name, this method adds field cells rather than sets them, meaning the effect of existing fields will not be erased. To cancel the effect of calling SetFieldRect on an area, you should call SetFieldRect with the same properties in the same position, but opposite strength to the call used to create it. This will cancel out the effect.

Note: The values are read from the bottom left corner, doing a row at a time. So if you're doing the double for loop like the example, the inner loop has to be x, and the outer loop has to be z.

Examples

:Awake
   CreateList ->field
   V2(1 0) ->v
   do (21 0)
      do(101 0)
         AppendToList(<-field <-v)
      loop
   loop
   SetFieldRect(119 86 <-field 101 1000000 0 0 true)

Index