<?xml version="1.0" encoding="utf-8" ?>
<MapGenerators>

	<!-- It's basically just a series of steps, each of which does something different.
			Some of them refer to each opther. Specifically, some great abstract "FloatGrids", which are not part of the map,
			but which are used by later generation steps. -->

	<MapGeneratorDef>
		<defName>XericShrubland</defName>
    <biome>XericShrubland</biome>
    <gensteps>
      
      <!-- Make invisible sanctity grid -->
      <li Class="Genstep_FloatGridFadedCircle">
        <gridName>Sanctity</gridName>
        <radiusInner>12</radiusInner>
        <radiusOuter>35</radiusOuter>
      </li>
      
      
      <li Class="Genstep_RandomSelector">
        <options>
          <li>
            <weight>10</weight>
            <genstep Class="Genstep_FloatGridPerlin">
              <gridName>TerrainIntensity</gridName>
              <perlinConfig>
                <ampLow>0.4</ampLow>
                <ampMid>0.3</ampMid>
                <ampHigh>0.3</ampHigh>
              </perlinConfig>
            </genstep>
          </li>
        </options>
      </li>
      
      <!-- Add the mountain to TerrainIntensity -->
      <li Class="Genstep_FloatGridGrossFade">
        <gridName>TerrainIntensity</gridName>
        <possibleFadeSpans>
          <li>0.43</li>
          <li>0.43</li>
          <li>0.43</li>
          <li>0.15</li>
          <li>0</li>
        </possibleFadeSpans>
      </li>
      
      <!-- Create rocks from TerrainIntensity -->
      <li Class="Genstep_ThingsFromGrid">
        <gridName>TerrainIntensity</gridName>
        <thresholds>
          <li>
            <thingDef>Rock</thingDef>
            <maxGridVal>0.45</maxGridVal>
          </li>
        </thresholds>
      </li>

      <!-- Create roofs from TerrainIntensity -->
      <li Class="Genstep_RoofsFromGrid">
        <gridName>TerrainIntensity</gridName>
        <thresholds>
          <li>
            <roofDef>RoofRockThick</roofDef>
            <maxGridVal>0.40</maxGridVal>
          </li>
          <li>
            <roofDef>RoofRockThin</roofDef>
            <maxGridVal>0.43</maxGridVal>
          </li>
        </thresholds>
      </li>
      <li Class="Genstep_LooseRocks"/>

      
      <!-- Make terrain from TerrainIntensity-->
      <li Class="Genstep_RandomSelector">
        <options>
          <!-- Dry variant -->         
          <li>
            <weight>10</weight>
            <genstep Class="Genstep_TerrainFromGrid">
              <gridName>TerrainIntensity</gridName>
              <thresholds>
                <li>
                  <terrainDef>RoughStone</terrainDef>
                  <maxGridVal>0.46</maxGridVal>
                </li>
                <li>
                  <terrainDef>Gravel</terrainDef>
                  <maxGridVal>0.48</maxGridVal>
                </li>
                <li>
                  <terrainDef>Soil</terrainDef>
                  <maxGridVal>0.53</maxGridVal>
                </li>
                <li>
                  <terrainDef>Sand</terrainDef>
                  <maxGridVal>100</maxGridVal>
                </li>
              </thresholds>
            </genstep>
          </li>
          
          <!-- Lush variant -->
          <li>
            <weight>10</weight>
            <genstep Class="Genstep_TerrainFromGrid">
              <gridName>TerrainIntensity</gridName>
              <thresholds>
                <li>
                  <terrainDef>RoughStone</terrainDef>
                  <maxGridVal>0.46</maxGridVal>
                </li>
                <li>
                  <terrainDef>Gravel</terrainDef>
                  <maxGridVal>0.49</maxGridVal>
                </li>
                <li>
                  <terrainDef>Soil</terrainDef>
                  <maxGridVal>0.57</maxGridVal>
                </li>
                <li>
                  <terrainDef>Sand</terrainDef>
                  <maxGridVal>100</maxGridVal>
                </li>
              </thresholds>
            </genstep>
          </li>
      </options>
      </li>

      
      
      
      
      <!-- Make rich soil patches -->
      <li Class="Genstep_TerrainPatches">
        <terrainDef>SoilRich</terrainDef>
        <patchSizeRange>
          <min>7</min>
          <max>11</max>
        </patchSizeRange>
        <patchesPer10kCellsRange>
          <min>0.7</min>
          <max>2</max>
        </patchesPer10kCellsRange>
      </li>

      <!-- Place minerals inside the rocks -->
      <li Class="Genstep_ScatterMinerals">
        <thingDefs>
          <li>Mineral</li>
        </thingDefs>
        <chunkSize>29</chunkSize>
        <minSpacing>5</minSpacing>
        <countPer10kCellsRange>
          <min>10</min>
          <max>10</max>
        </countPer10kCellsRange>
        <warnOnFail>false</warnOnFail>
      </li>

      <!-- Steam geysers -->
      <li Class="Genstep_ScatterThings">
        <thingDefs>
          <li>SteamGeyser</li>
        </thingDefs>
        <minSpacing>35</minSpacing>
        <extraNoBuildEdgeDist>4</extraNoBuildEdgeDist>
        <countPer10kCellsRange>
          <min>0.7</min>
          <max>1.0</max>
        </countPer10kCellsRange>
        <clearSpaceSize>30</clearSpaceSize>
        <minDistToPlayerStart>15</minDistToPlayerStart>
      </li>

      <!-- Add simple stone ruins -->
      <li Class="Genstep_ScatteredRuinsSimple">
        <countPer10kCellsRange>
          <min>1</min>
          <max>4</max>
        </countPer10kCellsRange>
        <shedSizeRange>
          <min>3</min>
          <max>10</max>
        </shedSizeRange>
        <wallLengthRange>
          <min>4</min>
          <max>14</max>
        </wallLengthRange>
      </li>

      <!-- Place starting resources near players' start location -->
      <li Class="Genstep_ScatterThingGroups">
        <thingDefs>
          <li>Metal</li>
        </thingDefs>
        <spotMustBeStandable>true</spotMustBeStandable>
        <groupSizeRange>
          <min>6</min>
          <max>6</max>
        </groupSizeRange>
        <stackCountRange>
          <min>40</min>
          <max>60</max>
        </stackCountRange>
        <forcedPlaceOffsets>
          <li>(-2,0,5)</li>
        </forcedPlaceOffsets>
      </li>
      <li Class="Genstep_ScatterThingGroups">
        <thingDefs>
          <li>WoodLog</li>
        </thingDefs>
        <spotMustBeStandable>true</spotMustBeStandable>
        <groupSizeRange>
          <min>6</min>
          <max>6</max>
        </groupSizeRange>
        <stackCountRange>
          <min>40</min>
          <max>60</max>
        </stackCountRange>
        <forcedPlaceOffsets>
          <li>(-2,0,1)</li>
        </forcedPlaceOffsets>
      </li>     
      <li Class="Genstep_ScatterThingGroups">
        <thingDefs>
          <li>Silver</li>
        </thingDefs>
        <spotMustBeStandable>true</spotMustBeStandable>
        <groupSizeRange>
          <min>6</min>
          <max>6</max>
        </groupSizeRange>
        <stackCountRange>
          <min>40</min>
          <max>60</max>
        </stackCountRange>
        <forcedPlaceOffsets>
          <li>(-2,0,5)</li>
          <li>(-2,0,1)</li>
        </forcedPlaceOffsets>
      </li>
      <li Class="Genstep_ScatterThingGroups">
        <thingDefs>
          <li>Silver</li>
        </thingDefs>
        <spotMustBeStandable>true</spotMustBeStandable>
        <groupSizeRange>
          <min>3</min>
          <max>3</max>
        </groupSizeRange>
        <stackCountRange>
          <min>40</min>
          <max>60</max>
        </stackCountRange>
        <forcedPlaceOffsets>
          <li>(-7,0,7)</li>
          <li>(9,0,6)</li>
        </forcedPlaceOffsets>
      </li>




      <!-- Scatter some resources across the map -->
      <li Class="Genstep_ScatterThingGroups">
        <thingDefs>
          <li>Metal</li>
          <li>Metal</li>
          <li>Silver</li>
        </thingDefs>
        <minSpacing>15</minSpacing>
        <countPer10kCellsRange>
          <min>1.4</min>
          <max>1.4</max>
        </countPer10kCellsRange>
        <spotMustBeStandable>true</spotMustBeStandable>
        <groupSizeRange>
          <min>3</min>
          <max>6</max>
        </groupSizeRange>
        <stackCountRange>
          <min>40</min>
          <max>60</max>
        </stackCountRange>
      </li>

      <!-- Scatter some meals across the map -->
      <li Class="Genstep_ScatterThingGroups">
        <thingDefs>
          <li>MealSurvivalPack</li>
        </thingDefs>
        <minSpacing>20</minSpacing>
        <countPer10kCellsRange>
          <min>0.8</min>
          <max>0.8</max>
        </countPer10kCellsRange>
        <spotMustBeStandable>true</spotMustBeStandable>
        <groupSizeRange>
          <min>3</min>
          <max>6</max>
        </groupSizeRange>
        <stackCountRange>
          <min>1</min>
          <max>1</max>
        </stackCountRange>
      </li>


      <!-- Hardcoded, the colonists themselves and their equipment -->
      <li Class="Genstep_Colonists">
        <startingItems>
          <li>
            <thingDef>Gun_Pistol</thingDef>
          </li>
          <li>
            <thingDef>Gun_LeeEnfield</thingDef>
          </li>
          <li>
            <thingDef>Gun_Pistol</thingDef>
          </li>
        </startingItems>
      </li>


      <!-- Fill the ecosystem -->
      <li Class="Genstep_Plants"/>
      <li Class="Genstep_Animals"/>

    </gensteps>

	</MapGeneratorDef>

</MapGenerators>