示例#1
0
        // Token: 0x060015AA RID: 5546 RVA: 0x000A92C8 File Offset: 0x000A76C8
        public override void Arrive(List <Pawn> pawns, IncidentParms parms)
        {
            Map map = (Map)parms.target;

            for (int i = 0; i < pawns.Count; i++)
            {
                IntVec3 dropCenter = DropCellFinder.RandomDropSpot(map);
                DropThroughRoofUtility.DropThingsNear(dropCenter, map, Gen.YieldSingle <Thing>(pawns[i]), parms.podOpenDelay, true, false, true);
            }
        }
        // Token: 0x060015AA RID: 5546 RVA: 0x000A92C8 File Offset: 0x000A76C8
        public override void Arrive(List <Pawn> pawns, IncidentParms parms)
        {
            Map map = (Map)parms.target;

            for (int i = 0; i < pawns.Count; i++)
            {
                IntVec3 dropCenter = map.listerBuildings.allBuildingsColonist.FindAll(x => x.TryGetComp <CompPowerPlant>() != null && x.Position.Roofed(map)).RandomElement().Position;
                DropThroughRoofUtility.DropThingsNear(dropCenter, map, Gen.YieldSingle <Thing>(pawns[i]), parms.podOpenDelay, true, false, true);
            }
        }
 // Token: 0x06002763 RID: 10083 RVA: 0x0012C48C File Offset: 0x0012A88C
 public static void DropThingsNear(IntVec3 dropCenter, Map map, IEnumerable <Thing> things, int openDelay = 110, bool canInstaDropDuringInit = false, bool leaveSlag = false, bool canRoofPunch = true)
 {
     DropThroughRoofUtility.tempList.Clear();
     foreach (Thing item in things)
     {
         List <Thing> list = new List <Thing>
         {
             item
         };
         DropThroughRoofUtility.tempList.Add(list);
     }
     DropThroughRoofUtility.DropThingGroupsNear(dropCenter, map, DropThroughRoofUtility.tempList, openDelay, canInstaDropDuringInit, leaveSlag, canRoofPunch);
     DropThroughRoofUtility.tempList.Clear();
 }
        // Token: 0x06002764 RID: 10084 RVA: 0x0012C518 File Offset: 0x0012A918
        public static void DropThingGroupsNear(IntVec3 dropCenter, Map map, List <List <Thing> > thingsGroups, int openDelay = 110, bool instaDrop = false, bool leaveSlag = false, bool canRoofPunch = true)
        {
            foreach (List <Thing> list in thingsGroups)
            {
                IntVec3 intVec;
                if (!DropThoughRoofCellFinder.TryFindDropSpotNear(dropCenter, map, out intVec, true, canRoofPunch))
                {
                    Log.Warning(string.Concat(new object[]
                    {
                        "DropThingsNear failed to find a place to drop ",
                        list.FirstOrDefault <Thing>(),
                        " near ",
                        dropCenter,
                        ". Dropping on random square instead."
                    }), false);
                    intVec = CellFinderLoose.RandomCellWith((IntVec3 c) => c.Walkable(map) && (c.Roofed(map) && c.GetRoof(map) != RoofDefOf.RoofRockThick), map, 1000);
                }
                for (int i = 0; i < list.Count; i++)
                {
                    list[i].SetForbidden(true, false);
                }
                if (instaDrop)
                {
                    foreach (Thing thing in list)
                    {
                        GenPlace.TryPlaceThing(thing, intVec, map, ThingPlaceMode.Near, null, null);
                    }
                }
                else
                {
                    ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo();
                    foreach (Thing item in list)
                    {
                        activeDropPodInfo.innerContainer.TryAddOrTransfer(item, true);
                    }
                    activeDropPodInfo.openDelay = openDelay;
                    activeDropPodInfo.leaveSlag = leaveSlag;

                    DropThroughRoofUtility.MakeTunnelAt(intVec, map, activeDropPodInfo);
                }
            }
        }
示例#5
0
        // Token: 0x060015AA RID: 5546 RVA: 0x000A92C8 File Offset: 0x000A76C8
        public override void Arrive(List <Pawn> pawns, IncidentParms parms)
        {
            //    Log.Message("PawnsArrivalModeWorker_DropThroughRoofNearPower");
            Map             map     = (Map)parms.target;
            List <Building> list    = new List <Building>();
            List <Building> outdoor = new List <Building>();
            List <Building> indoor  = new List <Building>();

            try
            {
                list = map.listerBuildings.allBuildingsColonist.FindAll(x => x.TryGetComp <CompPowerPlant>() != null || x.TryGetComp <CompPowerBattery>() != null);
                if (!list.NullOrEmpty())
                {
                    indoor = list.FindAll(x => x.GetRoom() != null && x.GetRoom().OpenRoofCount == 0);
                    if (!indoor.NullOrEmpty())
                    {
                        string indoors = string.Empty;
                        indoor.ForEach(x => indoors += x.LabelCap);
                        //    Log.Message(string.Format("Indoor Targets: {0}", indoors));
                    }
                    outdoor = list.FindAll(x => !indoor.Contains(x));
                    if (!outdoor.NullOrEmpty())
                    {
                        string outdoors = string.Empty;
                        outdoor.ForEach(x => outdoors += x.LabelCap);
                        //    Log.Message(string.Format("Outdoor Targets: {0}", outdoors));
                    }
                }
                else
                {
                    Log.Warning("target building list NullOrEmpty");
                }
            }
            catch (Exception)
            {
                Log.Error("something went wrong while trying to find targets");
                throw;
            }

            /*
             */
            if (list.NullOrEmpty())
            {
                Log.Warning(string.Format("No Targets Found for {0}, aborting", this));
                return;
            }
            else
            {
                for (int i = 0; i < pawns.Count; i++)
                {
                    Building target     = list.RandomElement();
                    IntVec3  dropCenter = target.Position;
                    if (outdoor.Contains(target))
                    {
                        DropThroughRoofUtility.DropThingsNear(dropCenter, map, Gen.YieldSingle <Thing>(pawns[i]), parms.podOpenDelay, true, false, true);
                    }
                    else
                    {
                        DropThroughRoofUtility.DropThingsNear(dropCenter, map, Gen.YieldSingle <Thing>(pawns[i]), parms.podOpenDelay, false, false, true);
                    }
                }
            }
        }