Пример #1
0
        public static void ShouldBeLitNow_Postfix(ref bool __result, CompGlower __instance)
        {
            if (__result)
            {
                return;
            }

            if (!__instance.parent.Spawned)
            {
                return;
            }
            if (!FlickUtility.WantsToBeOn(__instance.parent))
            {
                return;
            }
            Comp.VoidNetPort compPowerTrader = __instance.parent.TryGetComp <Comp.VoidNetPort>();
            if (compPowerTrader != null && !compPowerTrader.PowerOn)
            {
                __result = true;
                return;
            }
            CompRefuelable compRefuelable = __instance.parent.TryGetComp <CompRefuelable>();

            if (compRefuelable != null && !compRefuelable.HasFuel)
            {
                return;
            }
            CompSendSignalOnCountdown compSendSignalOnCountdown = __instance.parent.TryGetComp <CompSendSignalOnCountdown>();

            if (compSendSignalOnCountdown != null && compSendSignalOnCountdown.ticksLeft <= 0)
            {
                return;
            }
            return;
        }
        // Token: 0x0600308D RID: 12429 RVA: 0x00110270 File Offset: 0x0010E470
        public override bool ShouldSkip(Pawn pawn, bool forced = false)
        {
            List <Building> allBuildingsColonist = pawn.Map.listerBuildings.allBuildingsColonist;

            for (int i = 0; i < allBuildingsColonist.Count; i++)
            {
                Building building = allBuildingsColonist[i];
                if (building.def == Resources.ThingDefs.VoidNetDeepDrill)
                {
                    Comp.VoidNetPort comp = building.GetComp <Comp.VoidNetPort>();
                    if ((comp == null || comp.PowerOn) && building.Map.designationManager.DesignationOn(building, DesignationDefOf.Uninstall) == null)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Пример #3
0
        public static bool CanBeResearchedAt_Prefix(ref bool __result, ResearchProjectDef __instance, Building_ResearchBench bench, bool ignoreResearchBenchPowerStatus)
        {
            //不是幽能工作台不处理
            if (bench.def != Resources.ThingDefs.VoidEnergyResearchBench)
            {
                return(true);
            }
            //只允许幽能研究台研究幽能科技
            if (__instance.requiredResearchBuilding != null && bench.def != __instance.requiredResearchBuilding)
            {
                __result = false;
                return(false);
            }
            Comp.VoidNetPort comp = bench.GetComp <Comp.VoidNetPort>();
            if (comp != null && !comp.PowerOn)
            {
                __result = false;
                return(false);
            }

            if (!__instance.requiredResearchFacilities.NullOrEmpty())
            {
                CompAffectedByFacilities affectedByFacilities = bench.TryGetComp <CompAffectedByFacilities>();
                if (affectedByFacilities == null)
                {
                    __result = false;
                    return(false);
                }
                List <Thing> linkedFacilitiesListForReading = affectedByFacilities.LinkedFacilitiesListForReading;
                foreach (ThingDef item in __instance.requiredResearchFacilities)
                {
                    if (linkedFacilitiesListForReading.Find((Thing x) => x.def == item && affectedByFacilities.IsFacilityActive(x)) == null)
                    {
                        __result = false;
                        return(false);
                    }
                }
            }
            __result = true;
            return(false);
        }