コード例 #1
0
        public static List <Pair <List <Pawn>, IntVec3> > SplitIntoRandomGroupsNearMapEdge(List <Pawn> pawns, Map map, bool arriveInPods)
        {
            List <Pair <List <Pawn>, IntVec3> > list = new List <Pair <List <Pawn>, IntVec3> >();
            List <Pair <List <Pawn>, IntVec3> > result;

            if (!pawns.Any <Pawn>())
            {
                result = list;
            }
            else
            {
                int maxGroupsCount = PawnsArrivalModeWorkerUtility.GetMaxGroupsCount(pawns.Count);
                int num            = (maxGroupsCount != 1) ? Rand.RangeInclusive(2, maxGroupsCount) : 1;
                for (int i = 0; i < num; i++)
                {
                    IntVec3 second = PawnsArrivalModeWorkerUtility.FindNewMapEdgeGroupCenter(map, list, arriveInPods);
                    list.Add(new Pair <List <Pawn>, IntVec3>(new List <Pawn>(), second)
                    {
                        First =
                        {
                            pawns[i]
                        }
                    });
                }
                for (int j = num; j < pawns.Count; j++)
                {
                    list.RandomElement <Pair <List <Pawn>, IntVec3> >().First.Add(pawns[j]);
                }
                result = list;
            }
            return(result);
        }
コード例 #2
0
        public override void Arrive(List <Pawn> pawns, IncidentParms parms)
        {
            Map map = (Map)parms.target;
            List <Pair <List <Pawn>, IntVec3> > list = PawnsArrivalModeWorkerUtility.SplitIntoRandomGroupsNearMapEdge(pawns, map, arriveInPods: true);

            PawnsArrivalModeWorkerUtility.SetPawnGroupsInfo(parms, list);
            for (int i = 0; i < list.Count; i++)
            {
                DropPodUtility.DropThingsNear(list[i].Second, map, list[i].First.Cast <Thing>(), parms.podOpenDelay, canInstaDropDuringInit: false, leaveSlag: true);
            }
        }
        public override void Arrive(List <Pawn> pawns, IncidentParms parms)
        {
            Map map = (Map)parms.target;
            List <Pair <List <Pawn>, IntVec3> > list = PawnsArrivalModeWorkerUtility.SplitIntoRandomGroupsNearMapEdge(pawns, map, false);

            PawnsArrivalModeWorkerUtility.SetPawnGroupsInfo(parms, list);
            for (int i = 0; i < list.Count; i++)
            {
                for (int j = 0; j < list[i].First.Count; j++)
                {
                    IntVec3 loc = CellFinder.RandomClosewalkCellNear(list[i].Second, map, 8, null);
                    GenSpawn.Spawn(list[i].First[j], loc, map, parms.spawnRotation, WipeMode.Vanish, false);
                }
            }
        }
コード例 #4
0
 public override void Arrive(List <Pawn> pawns, IncidentParms parms)
 {
     PawnsArrivalModeWorkerUtility.DropInDropPodsNearSpawnCenter(parms, pawns);
 }