Beispiel #1
0
 public override void Generate(Map map, GenStepParams parms)
 {
     if (this.allowInWaterBiome || !map.TileInfo.WaterCovered)
     {
         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;
     }
 }
Beispiel #2
0
 public override void GenerateIntoMap(Map map)
 {
     if (Find.GameInitData != null)
     {
         GenStep_ScatterThings genStep_ScatterThings = new GenStep_ScatterThings();
         genStep_ScatterThings.nearPlayerStart     = this.NearPlayerStart;
         genStep_ScatterThings.thingDef            = base.thingDef;
         genStep_ScatterThings.stuff               = base.stuff;
         genStep_ScatterThings.count               = base.count;
         genStep_ScatterThings.spotMustBeStandable = true;
         genStep_ScatterThings.minSpacing          = 5f;
         genStep_ScatterThings.clusterSize         = ((base.thingDef.category == ThingCategory.Building) ? 1 : 4);
         genStep_ScatterThings.Generate(map);
     }
 }
Beispiel #3
0
 public override void GenerateIntoMap(Map map)
 {
     if (Find.GameInitData != null)
     {
         GenStep_ScatterThings genStep_ScatterThings = new GenStep_ScatterThings();
         genStep_ScatterThings.nearPlayerStart      = NearPlayerStart;
         genStep_ScatterThings.allowFoggedPositions = !NearPlayerStart;
         genStep_ScatterThings.thingDef             = thingDef;
         genStep_ScatterThings.stuff = stuff;
         genStep_ScatterThings.count = count;
         genStep_ScatterThings.spotMustBeStandable = true;
         genStep_ScatterThings.minSpacing          = 5f;
         genStep_ScatterThings.clusterSize         = ((thingDef.category == ThingCategory.Building) ? 1 : 4);
         genStep_ScatterThings.Generate(map, default(GenStepParams));
     }
 }
Beispiel #4
0
        internal static bool Prefix(Map map, GenStepParams parms, ref GenStep_ScatterThings __instance)
        {
            if (__instance.thingDef == ThingDefOf.SteamGeyser)
            {
                if (map.Biome.HasModExtension <BiomesMap>())
                {
                    if (map.Biome.GetModExtension <BiomesMap>().hasScatterables&& __instance.allowInWaterBiome == false)
                    {
                        bool       seaSpawns = __instance.allowInWaterBiome;
                        FloatRange range     = __instance.countPer10kCellsRange;
                        __instance.allowInWaterBiome          = true;
                        __instance.countPer10kCellsRange.min /= 2;
                        __instance.countPer10kCellsRange.max /= 2;
                        __instance.Generate(map, parms);
                        __instance.allowInWaterBiome     = seaSpawns;
                        __instance.countPer10kCellsRange = range;
                        return(false);
                    }
                }
            }

            return(true);
        }