Пример #1
0
        public static void InitializeAllThreadStatics()
        {
            CellFinder_Patch.InitializeThreadStatics();
            ColoredText_Patch.InitializeThreadStatics();
            CompCauseGameCondition_Patch.InitializeThreadStatics();
            Dijkstra_Patch <IntVec3> .InitializeThreadStatics();

            Dijkstra_Patch <Region> .InitializeThreadStatics();

            Dijkstra_Patch <int> .InitializeThreadStatics();

            GenTemperature_Patch.InitializeThreadStatics();
            HaulingCache.InitializeThreadStatics();
            HediffSet_Patch.InitializeThreadStatics();
            PathFinder_Patch.InitializeThreadStatics();
            PawnPathPool_Patch.InitializeThreadStatics();
            Reachability_Patch.InitializeThreadStatics();
            ReachabilityCache_Patch.InitializeThreadStatics();
            Region_Patch.InitializeThreadStatics();
            //RegionAndRoomUpdater_Patch.InitializeThreadStatics();
            RegionDirtyer_Patch.InitializeThreadStatics();
            RegionTraverser_Patch.InitializeThreadStatics();
            SituationalThoughtHandler_Patch.InitializeThreadStatics();
            SustainerManager_Patch.InitializeThreadStatics();
            Toils_Ingest_Patch.InitializeThreadStatics();
            World_Patch.InitializeThreadStatics();
            WorldPawns_Patch.InitializeThreadStatics();
        }
Пример #2
0
        public static bool ClosestThingReachable(ref Thing __result,
                                                 IntVec3 root,
                                                 Map map,
                                                 ThingRequest thingReq,
                                                 PathEndMode peMode,
                                                 TraverseParms traverseParams,
                                                 float maxDistance           = 9999f,
                                                 Predicate <Thing> validator = null,
                                                 IEnumerable <Thing> customGlobalSearchSet = null,
                                                 int searchRegionsMin                = 0,
                                                 int searchRegionsMax                = -1,
                                                 bool forceAllowGlobalSearch         = false,
                                                 RegionType traversableRegionTypes   = RegionType.Set_Passable,
                                                 bool ignoreEntirelyForbiddenRegions = false)
        {
            bool flag1 = searchRegionsMax < 0 | forceAllowGlobalSearch;

            if (!flag1 && customGlobalSearchSet != null)
            {
                Log.ErrorOnce("searchRegionsMax >= 0 && customGlobalSearchSet != null && !forceAllowGlobalSearch. customGlobalSearchSet will never be used.", 634984, false);
            }
            if (!flag1 && !thingReq.IsUndefined && !thingReq.CanBeFoundInRegion)
            {
                Log.ErrorOnce("ClosestThingReachable with thing request group " + thingReq.group + " and global search not allowed. This will never find anything because this group is never stored in regions. Either allow global search or don't call this method at all.", 518498981, false);
                __result = null;
                return(false);
            }
            if (EarlyOutSearch(root, map, thingReq, customGlobalSearchSet, validator))
            {
                __result = null;
                return(false);
            }
            Thing thing = null;
            bool  flag2 = false;

            if (!thingReq.IsUndefined && thingReq.CanBeFoundInRegion)
            {
                int maxRegions = searchRegionsMax > 0 ? searchRegionsMax : 30;
                int regionsSeen;
                thing = GenClosest.RegionwiseBFSWorker(root, map, thingReq, peMode, traverseParams, validator, null, searchRegionsMin, maxRegions, maxDistance, out regionsSeen, traversableRegionTypes, ignoreEntirelyForbiddenRegions);
                flag2 = thing == null && regionsSeen < maxRegions;
            }
            if (thing == null & flag1 && !flag2)
            {
                if (traversableRegionTypes != RegionType.Set_Passable)
                {
                    Log.ErrorOnce("ClosestThingReachable had to do a global search, but traversableRegionTypes is not set to passable only. It's not supported, because Reachability is based on passable regions only.", 14384767, false);
                }
                // Predicate<Thing> validator1 = t => map.reachability.CanReach(root, t, peMode, traverseParams) && (validator == null || validator(t));
                Predicate <Thing>   validator1 = t => Reachability_Patch.CanReach2(map.reachability, root, t, peMode, traverseParams) && (validator == null || validator(t));
                IEnumerable <Thing> things     = customGlobalSearchSet ?? map.listerThings.ThingsMatching(thingReq);
                thing = GenClosest.ClosestThing_Global(root, things, maxDistance, validator1, null);
            }
            __result = thing;
            return(false);
        }
Пример #3
0
 public static void InitializeAllThreadStatics()
 {
     AttackTargetFinder_Patch.InitializeThreadStatics();
     AttackTargetsCache_Patch.InitializeThreadStatics();
     BeautyUtility_Patch.InitializeThreadStatics();
     CellFinder_Patch.InitializeThreadStatics();
     CompCauseGameCondition_Patch.InitializeThreadStatics();
     DamageWorker_Patch.InitializeThreadStatics();
     DijkstraInt.InitializeThreadStatics();
     Fire_Patch.InitializeThreadStatics();
     FloatMenuMakerMap_Patch.InitializeThreadStatics();
     FoodUtility_Patch.InitializeThreadStatics();
     FloodFiller_Patch.InitializeThreadStatics();
     GenAdj_Patch.InitializeThreadStatics();
     GenAdjFast_Patch.InitializeThreadStatics();
     GenLeaving_Patch.InitializeThreadStatics();
     GenRadial_Patch.InitializeThreadStatics();
     GenTemperature_Patch.InitializeThreadStatics();
     GenText_Patch.InitializedThreadStatics();
     HaulAIUtility_Patch.InitializeThreadStatics();
     ImmunityHandler_Patch.InitializeThreadStatics();
     InfestationCellFinder_Patch.InitializeThreadStatics();
     MapTemperature_Patch.InitializeThreadStatics();
     PathFinder_Patch.InitializeThreadStatics();
     Pawn_InteractionsTracker_Transpile.InitializeThreadStatics();
     Pawn_MeleeVerbs_Patch.InitializeThreadStatics();
     Pawn_WorkSettings_Patch.InitializeThreadStatics();
     PawnDiedOrDownedThoughtsUtility_Patch.InitializeThreadStatics();
     PawnsFinder_Patch.InitializeThreadStatics();
     Rand_Patch.InitializeThreadStatics();
     RCellFinder_Patch.InitializeThreadStatics();
     Reachability_Patch.InitializeThreadStatics();
     ReachabilityCache_Patch.InitializeThreadStatics();
     RegionDirtyer_Patch.InitializeThreadStatics();
     RegionListersUpdater_Patch.InitializeThreadStatics();
     RegionTraverser_Transpile.InitializeThreadStatics(); //this
     Projectile_Patch.InitializeThreadStatics();
     ThinkNode_PrioritySorter_Patch.InitializeThreadStatics();
     ThoughtHandler_Patch.InitializeThreadStatics();
     Verb_Patch.InitializeThreadStatics();
     WealthWatcher_Patch.InitializeThreads();
     World_Patch.InitializeThreadStatics();
     JoyGiver_InteractBuilding_Patch.InitializeThreadStatics();
     JoyGiver_InteractBuildingSitAdjacent_Patch.InitializeThreadStatics();
     JoyGiver_TakeDrug_Patch.InitializeThreadStatics();
     WorkGiver_DoBill_RegionProcessor.InitializeThreadStatics();
     Pawn_RelationsTracker_Patch.InitializeThreadStatics();
     Battle_Patch.InitializeThreadStatics();
 }