Esempio n. 1
0
        public static bool get_AnyPawnBlockingMapRemoval(MapPawns __instance, ref bool __result)
        {
            Faction ofPlayer = Faction.OfPlayer;

            lock (pawnsSpawned(__instance)) {
                for (int index = 0; index < pawnsSpawned(__instance).Count; ++index)
                {
                    if (!pawnsSpawned(__instance)[index].Downed && pawnsSpawned(__instance)[index].IsColonist || pawnsSpawned(__instance)[index].relations != null && pawnsSpawned(__instance)[index].relations.relativeInvolvedInRescueQuest != null)
                    {
                        __result = true;
                        return(false);
                    }
                    if (pawnsSpawned(__instance)[index].Faction == ofPlayer || pawnsSpawned(__instance)[index].HostFaction == ofPlayer)
                    {
                        Job curJob = pawnsSpawned(__instance)[index].CurJob;
                        if (curJob != null && curJob.exitMapOnArrival)
                        {
                            __result = true;
                            return(false);
                        }
                    }
                    if (CaravanExitMapUtility.FindCaravanToJoinFor(pawnsSpawned(__instance)[index]) != null && !pawnsSpawned(__instance)[index].Downed)
                    {
                        __result = true;
                        return(false);
                    }
                }
            }
            List <Thing> thingList = map(__instance).listerThings.ThingsInGroup(ThingRequestGroup.ThingHolder);

            for (int index1 = 0; index1 < thingList.Count; ++index1)
            {
                if (thingList[index1] is IActiveDropPod || thingList[index1] is PawnFlyer || thingList[index1].TryGetComp <CompTransporter>() != null)
                {
                    IThingHolder holder    = (IThingHolder)thingList[index1].TryGetComp <CompTransporter>() ?? (IThingHolder)thingList[index1];
                    List <Thing> tmpThings = new List <Thing>();
                    ThingOwnerUtility.GetAllThingsRecursively(holder, tmpThings, true, (Predicate <IThingHolder>)null);
                    for (int index2 = 0; index2 < tmpThings.Count; ++index2)
                    {
                        if (tmpThings[index2] is Pawn tmpThing && !tmpThing.Dead && (!tmpThing.Downed && tmpThing.IsColonist))
                        {
                            __result = true;
                            return(false);
                        }
                    }
                }
            }
            __result = false;
            return(false);
        }
Esempio n. 2
0
 protected override bool Satisfied(Pawn pawn)
 {
     return(CaravanExitMapUtility.FindCaravanToJoinFor(pawn) != null);
 }
Esempio n. 3
0
        public static bool get_AnyPawnBlockingMapRemoval(MapPawns __instance, ref bool __result)
        {
            Faction     ofPlayer     = Faction.OfPlayer;
            List <Pawn> pawnsSpawned = pawnsSpawnedFieldRef(__instance);

            for (int i = 0; i < pawnsSpawned.Count; i++)
            {
                if (!pawnsSpawned[i].Downed && pawnsSpawned[i].IsColonist)
                {
                    __result = true;
                    return(false);
                }

                if (pawnsSpawned[i].relations != null && pawnsSpawned[i].relations.relativeInvolvedInRescueQuest != null)
                {
                    __result = true;
                    return(false);
                }

                if (pawnsSpawned[i].Faction == ofPlayer || pawnsSpawned[i].HostFaction == ofPlayer)
                {
                    Job curJob = pawnsSpawned[i].CurJob;
                    if (curJob != null && curJob.exitMapOnArrival)
                    {
                        __result = true;
                        return(false);
                    }
                }

                if (CaravanExitMapUtility.FindCaravanToJoinFor(pawnsSpawned[i]) != null && !pawnsSpawned[i].Downed)
                {
                    __result = true;
                    return(false);
                }
            }

            List <Thing> list = mapFieldRef(__instance).listerThings.ThingsInGroup(ThingRequestGroup.ThingHolder);

            for (int j = 0; j < list.Count; j++)
            {
                if (!(list[j] is IActiveDropPod) && !(list[j] is PawnFlyer) && list[j].TryGetComp <CompTransporter>() == null)
                {
                    continue;
                }

                IThingHolder thingHolder = list[j].TryGetComp <CompTransporter>();
                IThingHolder holder      = thingHolder ?? ((IThingHolder)list[j]);
                if (tmpThings == null)
                {
                    tmpThings = new List <Thing>();
                }
                else
                {
                    tmpThings.Clear();
                }
                ThingOwnerUtility.GetAllThingsRecursively(holder, tmpThings);
                for (int k = 0; k < tmpThings.Count; k++)
                {
                    Pawn pawn = tmpThings[k] as Pawn;
                    if (pawn != null && !pawn.Dead && !pawn.Downed && pawn.IsColonist)
                    {
                        tmpThings.Clear();
                        __result = true;
                        return(false);
                    }
                }
            }

            //tmpThings.Clear();
            __result = false;
            return(false);
        }