예제 #1
0
        // And now maybe you're asking yourself, "What is this?"
        // Well, there's no way to set conditions on a faction being used for a raid, for some reason.

        public static float Postfix(float __result, FactionDef __instance)
        {
            if (__instance == PsiTechDefOf.PTPsionic && (!PsiTechSettings.Get().EnablePsychicFactionRaids ||
                                                         !PsiTechDefOf.PTProjectionTheory.IsFinished))
            {
                return(0f);
            }

            return(__result);
        }
        static PsiTechAlienRacesPatcherUtility()
        {
            if (!PsiTechSettings.Get().PatchAllRaces)
            {
                return;
            }

            // This approach has some serious start-up time implications but at least it doesn't impact
            // runtime performance. I'd choose seconds on a load over constant overhead any day.
            var allThings = DefDatabase <ThingDef> .AllDefs;

            foreach (var def in allThings)
            {
                if (!(def.inspectorTabsResolved?.Any(tab => tab is ITab_Pawn_Needs) ?? false) ||
                    def.inspectorTabsResolved.Any(tab => tab is ITab_Pawn_Psi))
                {
                    continue;
                }

                def.inspectorTabsResolved.Add(InspectTabManager.GetSharedInstance(typeof(ITab_Pawn_Psi)));
            }
        }