コード例 #1
0
 public static void DropThingsNear(IntVec3 dropCenter, IEnumerable <Thing> things, int openDelay = 30, bool canInstaDropDuringInit = true, bool leaveSlag = false)
 {
     foreach (Thing current in things)
     {
         List <Thing> list = new List <Thing>();
         list.Add(current);
         RazorRainUtility.tempList.Add(list);
     }
     RazorRainUtility.DropThingGroupsNear(dropCenter, RazorRainUtility.tempList, openDelay, canInstaDropDuringInit, leaveSlag);
     RazorRainUtility.tempList.Clear();
 }
コード例 #2
0
 public static void DropThingGroupsNear(IntVec3 dropCenter, List <List <Thing> > thingsGroups, int openDelay = 30, bool canInstaDropDuringInit = true, bool leaveSlag = false, bool canRoofPunch = true)
 {
     foreach (List <Thing> current in thingsGroups)
     {
         IntVec3 intVec;
         if (!DropCellFinder.TryFindDropSpotNear(dropCenter, out intVec, true, canRoofPunch))
         {
             Log.Warning(string.Concat(new object[]
             {
                 "DropThingsNear failed to find a place to drop ",
                 current.FirstOrDefault <Thing>(),
                 " near ",
                 dropCenter,
                 ". Dropping on random square instead."
             }));
             intVec = CellFinderLoose.RandomCellWith((IntVec3 c) => GenGrid.Standable(c) && !Find.RoofGrid.Roofed(c) && !Find.FogGrid.IsFogged(c), 1000);
         }
         foreach (Thing current2 in current)
         {
             ThingWithComps thingWithComponents = current2 as ThingWithComps;
             if (thingWithComponents != null && thingWithComponents.GetComp <CompForbiddable>() != null)
             {
                 thingWithComponents.GetComp <CompForbiddable>().Forbidden = true;
             }
         }
         if (canInstaDropDuringInit && Find.TickManager.TicksGame < 2)
         {
             using (List <Thing> .Enumerator enumerator3 = current.GetEnumerator())
             {
                 while (enumerator3.MoveNext())
                 {
                     Thing current3 = enumerator3.Current;
                     GenPlace.TryPlaceThing(current3, intVec, ThingPlaceMode.Near);
                 }
                 continue;
             }
         }
         intVec = CellFinderLoose.RandomCellWith((IntVec3 c) => GenGrid.Standable(c) && !Find.RoofGrid.Roofed(c) && !Find.FogGrid.IsFogged(c), 1000);
         RazorRainUtility.MakeRazorRainAt(intVec);
     }
 }
コード例 #3
0
        private void DoRazorRainEvent()
        {
            this.numRazorEventCount--;
            if (this.numRazorEventCount < 0)
            {
                Find.LetterStack.ReceiveLetter("Razor rain over", "The Razor rain seems to be letting up.", LetterType.Good);
                this.Destroy(0);
                return;
            }
            int          num        = this.random.Next(1, 30);
            IntVec3      dropCenter = CellFinderLoose.RandomCellWith((IntVec3 c) => GenGrid.Standable(c) && !Find.RoofGrid.Roofed(c) && !Find.FogGrid.IsFogged(c), 1000);
            ThingDef     thingDef   = ThingDef.Named("RazorRainIncoming");
            List <Thing> list       = new List <Thing>();

            while (list.Count < num)
            {
                Thing item = ThingMaker.MakeThing(thingDef);
                list.Add(item);
            }
            RazorRainUtility.DropThingsNear(dropCenter, list, 1, true, false);
        }