public override void Generate(Map map, GenStepParams parms)
        {
            RandomGenStepSelectorOption randomGenStepSelectorOption = this.options.RandomElementByWeight((RandomGenStepSelectorOption opt) => opt.weight);

            if (randomGenStepSelectorOption.genStep != null)
            {
                randomGenStepSelectorOption.genStep.Generate(map, parms);
            }
            if (randomGenStepSelectorOption.def != null)
            {
                randomGenStepSelectorOption.def.genStep.Generate(map, parms);
            }
        }
예제 #2
0
 public override void Generate(Map map, GenStepParams parms)
 {
     if (allowInWaterBiome || !map.TileInfo.WaterCovered)
     {
         int num = CalculateFinalCount(map);
         for (int i = 0; i < num; i++)
         {
             if (!TryFindScatterCell(map, out IntVec3 result))
             {
                 return;
             }
             ScatterAt(result, map);
             usedSpots.Add(result);
         }
         usedSpots.Clear();
     }
 }
예제 #3
0
 public override void Generate(Map map, GenStepParams parms)
 {
     if (this.allowInWaterBiome || !map.TileInfo.WaterCovered)
     {
         int num = this.CalculateFinalCount(map);
         for (int i = 0; i < num; i++)
         {
             IntVec3 intVec;
             if (!this.TryFindScatterCell(map, out intVec))
             {
                 return;
             }
             this.ScatterAt(intVec, map, 1);
             this.usedSpots.Add(intVec);
         }
         this.usedSpots.Clear();
     }
 }
예제 #4
0
        public override void Generate(Map map, GenStepParams parms)
        {
            int num = Mathf.RoundToInt((float)map.Area / 10000f * this.patchesPer10kCellsRange.RandomInRange);

            for (int i = 0; i < num; i++)
            {
                float   randomInRange = this.patchSizeRange.RandomInRange;
                IntVec3 a             = CellFinder.RandomCell(map);
                foreach (IntVec3 current in GenRadial.RadialPatternInRadius(randomInRange / 2f))
                {
                    IntVec3 c = a + current;
                    if (c.InBounds(map))
                    {
                        map.terrainGrid.SetTerrain(c, this.terrainDef);
                    }
                }
            }
        }
예제 #5
0
 public override void Generate(Map map, GenStepParams parms)
 {
     if (allowInWaterBiome || !map.TileInfo.WaterCovered)
     {
         int        count          = CalculateFinalCount(map);
         IntRange   stackSizeRange = (thingDef.ingestible != null && thingDef.ingestible.IsMeal && thingDef.stackLimit <= 10) ? IntRange.one : ((thingDef.stackLimit > 5) ? new IntRange(Mathf.RoundToInt((float)thingDef.stackLimit * 0.5f), thingDef.stackLimit) : new IntRange(thingDef.stackLimit, thingDef.stackLimit));
         List <int> list           = CountDividedIntoStacks(count, stackSizeRange);
         for (int i = 0; i < list.Count; i++)
         {
             if (!TryFindScatterCell(map, out IntVec3 result))
             {
                 return;
             }
             ScatterAt(result, map, list[i]);
             usedSpots.Add(result);
         }
         usedSpots.Clear();
         clusterCenter = IntVec3.Invalid;
         leftInCluster = 0;
     }
 }
        public override void Generate(Map map, GenStepParams parms)
        {
            if (!this.allowInWaterBiome && map.TileInfo.WaterCovered)
            {
                return;
            }
            int      count = base.CalculateFinalCount(map);
            IntRange one;

            if (this.thingDef.ingestible != null && this.thingDef.ingestible.IsMeal && this.thingDef.stackLimit <= 10)
            {
                one = IntRange.one;
            }
            else if (this.thingDef.stackLimit > 5)
            {
                one = new IntRange(Mathf.RoundToInt((float)this.thingDef.stackLimit * 0.5f), this.thingDef.stackLimit);
            }
            else
            {
                one = new IntRange(this.thingDef.stackLimit, this.thingDef.stackLimit);
            }
            List <int> list = GenStep_ScatterThings.CountDividedIntoStacks(count, one);

            for (int i = 0; i < list.Count; i++)
            {
                IntVec3 intVec;
                if (!this.TryFindScatterCell(map, out intVec))
                {
                    return;
                }
                this.ScatterAt(intVec, map, list[i]);
                this.usedSpots.Add(intVec);
            }
            this.usedSpots.Clear();
            this.clusterCenter = IntVec3.Invalid;
            this.leftInCluster = 0;
        }
예제 #7
0
 public abstract void Generate(Map map, GenStepParams parms);
 public GenStepWithParams(GenStepDef def, GenStepParams parms)
 {
     this.def   = def;
     this.parms = parms;
 }
 protected abstract void ScatterAt(IntVec3 loc, Map map, GenStepParams parms, int count = 1);