$UnitGUID0:"" $UnitGUID1:"" $UnitGUID2:"" $UnitGUID3:"" $UnitGUID4:"" GetBuildUnit ->curBuildUnit #Only do something if state has changed <-curBuildUnit <-lastBuildUnit neq if FALSE ->buildUnitSelected FALSE ->buildUnitDeselected 5 0 do "UnitGUID" I concat <-! ->val <-val StringLength gt0 <-val <-curBuildUnit eq and if TRUE ->buildUnitSelected endif <-val StringLength gt0 <-val <-lastBuildUnit eq and if TRUE ->buildUnitDeselected endif loop #If a void only unit was selected, and the last selection was not a void only unit <-buildUnitSelected <-buildUnitDeselected not and if FALSE SetAllLegalUnitCells <-LEGAL_CELLS TRUE SetLegalUnitCells TRUE UseLegalUnitCells #If a non void only unit was selected, and the last selection was a void only unit else <-buildUnitSelected not <-buildUnitDeselected and if FALSE SetAllLegalUnitCells FALSE UseLegalUnitCells endif endif endif #Save current state <-curBuildUnit ->lastBuildUnit #Initialize :once GetBuildUnit ->lastBuildUnit @RebuildVoidCellsList :RebuildVoidCellsList #Build list of void cells CreateList ->LEGAL_CELLS GetMapSize ->sizeZ ->sizeX <-sizeZ 0 do <-sizeX 0 do #If terrain is void, add coordinates to list I J GetTerrain eq0 if <-LEGAL_CELLS I J V2 AppendToList endif loop loop