コード例 #1
0
        static bool Prefix(IncidentWorker __instance, ref bool __result, IncidentParms parms)
        {
            IncidentInterceptorUtility.CurrentIncidentDef = __instance.def;

            //TODO: This is for the ship part incident
            //I have no choice but do the patch like this
            //'cause the incidentworker for shippart is an internal class
            //and manual patching doesn't work
            var def = __instance.def;

            if (def != DefDatabase <IncidentDef> .GetNamed("PsychicEmanatorShipPartCrash") && def != DefDatabase <IncidentDef> .GetNamed("PoisonShipPartCrash"))
            {
                return(true);
            }
            if (IncidentInterceptorUtility.IsIntercepting_ShipPart == WorkerPatchType.ExecuteOrigin)
            {
                return(true);
            }
            else
            {
                if (!IncidentInterceptorUtility.Intercept_SkyFaller <InterceptedIncident_SkyFaller_ShipPartCrash>(__instance.def, parms))
                {
                    return(true);
                }
                __result = true;
                return(false);
            }
        }
 static void PostFix(IncidentParms parms, ref bool __result)
 {
     if (IncidentInterceptorUtility.isIntercepting_EdgeDropGroup)
     {
         __result = !IncidentInterceptorUtility.Intercept_SkyFaller <InterceptedIncident_SkyFaller_EdgeDropGroup>(IncidentDefOf.RaidEnemy, parms, true);
     }
 }
 static bool Prefix(IncidentWorker_TravelerGroup __instance, ref bool __result, IncidentParms parms)
 {
     if (PES_Settings.DebugModeOn)
     {
         Log.Message("-=PS=- Patch_IncidentWorker_VisitorGroup_TryExecuteWorker Prefix", false);
         IncidentInterceptorUtility.DebugParms(parms, __instance.ToString());
     }
     if (parms.quest != null || parms.questScriptDef != null)
     {
         Log.Message("-=PS=- It's a quest! Bailout! MAYDAY!", false);
         return(true);
     }
     if (parms != null && parms.questTag != null)                //Lt.Bob - May be redundant
     {
         Log.Error("-=PS=- Not redundant", false);
         Log.Message("-=PS=- Patch_IncidentWorker_TravelerGroup_TryExecuteWorker - questTag!=Null == " + parms.questTag, false);
         Log.Message("-=PS=- Returning true", false);
         return(true);
     }
     if (IncidentInterceptorUtility.isIntercepting_TravelerGroup)
     {
         return(!IncidentInterceptorUtility.CreateIncidentCaraven_HumanNeutral <InterceptedIncident_HumanCrowd_TravelerGroup>(__instance.def, parms));
     }
     return(true);
 }
 static bool Prefix(IncidentWorker_ManhunterPack __instance, ref bool __result, IncidentParms parms)
 {
     if (PES_Settings.DebugModeOn)
     {
         Log.Message("-=PS=- Patch_IncidentWorker_ManhunterPack_TryExecuteWorker Prefix", false);
         IncidentInterceptorUtility.DebugParms(parms, __instance.ToString());
     }
     if (parms.quest != null || parms.questScriptDef != null)
     {
         Log.Message("-=PS=- It's a quest! Bailout! MAYDAY!", false);
         return(true);
     }
     if (IncidentInterceptorUtility.isIntercepting_ManhunterPack == WorkerPatchType.ExecuteOrigin)
     {
         return(true);
     }
     if (IncidentInterceptorUtility.isIntercepting_ManhunterPack == WorkerPatchType.Forestall)
     {
         IncidentInterceptorUtility.CreateIncidentCaravan_Animal <InterceptedIncident_AnimalHerd_ManhunterPack>(__instance.def, parms);
         __result = true;
     }
     else
     {
         __result = IncidentInterceptorUtility.tmpIncident.SubstituionWorkerExecution();
     }
     return(false);
 }
        static void Postfix(PawnsArrivalModeWorker_EdgeWalkIn __instance, IncidentParms parms, ref bool __result)
        {
            //return;
            if (PreemptiveStrike.Mod.PES_Settings.DebugModeOn)
            {
                Log.Message("-=PS=- Patch_EdgeWalkIn_TryResolveRaidSpawnCenter Postfix");                 //Lt. Bob - Logging
                IncidentInterceptorUtility.DebugParms(parms, __instance.ToString());
            }
            if (parms != null && parms.questTag != null)             //Lt. Bob - "Temporary" bypass fix? for Quest handling
            {
                Log.Message("-=PS=- It's a quest! Bailout! MAYDAY!", false);
                return;
            }

            //This is a temporary fix for refugee chased
            if (IncidentInterceptorUtility.IncidentInQueue(parms, IncidentDefOf.RaidEnemy))
            {
                return;
            }

            if (IncidentInterceptorUtility.IsIntercepting_IncidentExcecution)
            {
                if (IncidentInterceptorUtility.Intercept_Raid(parms))
                {
                    __result = false;
                }
            }
        }
コード例 #6
0
 static void PostFix(IncidentParms parms, ref bool __result)
 {
     if (IncidentInterceptorUtility.isIntercepting_RandomDrop)
     {
         __result = !IncidentInterceptorUtility.Intercept_SkyFaller <InterceptedIncident_SkyFaller_RandomDrop>(IncidentInterceptorUtility.CurrentIncidentDef, parms, true, true);
     }
 }
コード例 #7
0
 static bool Prefix(IncidentWorker_VisitorGroup __instance, ref bool __result, IncidentParms parms)
 {
     if (IncidentInterceptorUtility.isIntercepting_VisitorGroup)
     {
         IncidentInterceptorUtility.CreateIncidentCaraven_HumanNeutral <InterceptedIncident_HumanCrowd_VisitorGroup>(parms);
     }
     return(true);
 }
コード例 #8
0
 static bool Prefix(IncidentWorker_TraderCaravanArrival __instance, ref bool __result, IncidentParms parms)
 {
     if (IncidentInterceptorUtility.isIntercepting_TraderCaravan_Worker)
     {
         IncidentInterceptorUtility.CreateIncidentCaraven_HumanNeutral <InterceptedIncident_HumanCrowd_TraderCaravan>(parms);
     }
     return(true);
 }
コード例 #9
0
 static void Postfix(PawnsArrivalModeWorker_EdgeWalkIn __instance, IncidentParms parms, ref bool __result)
 {
     if (IncidentInterceptorUtility.IsIntercepting_IncidentExcecution)
     {
         if (IncidentInterceptorUtility.Intercept_Raid(parms, true))
         {
             __result = false;
         }
     }
 }
        static bool Prefix(IncidentWorker __instance, ref bool __result, IncidentParms parms)
        {
            if (PES_Settings.DebugModeOn)
            {
                Messages.Message("-=PS=- Caught Patch_IncidentWorker_TryExecute Prefix", MessageTypeDefOf.NeutralEvent, true);
                Log.Message("-=PS=- Patch_IncidentWorker_TryExecute Prefix", false);
                IncidentInterceptorUtility.DebugParms(parms, __instance.ToString());
            }
            if (parms.quest != null || parms.questScriptDef != null)
            {
                Log.Message("-=PS=- It's a quest! Bailout! MAYDAY!", false);
                return(true);
            }
            if (__instance.def == null)
            {
                Log.Error("-=PS=- __instance.def=NULL", false);
                Log.Error("   PS=- Returning true", false);
                return(true);
            }
            Log.Message("   PS=- __instance.def= " + __instance.def.ToString(), false);
            if (__instance.def.ToString() == "RRY_PowerCut_Xenomorph")              //Lt.Bob - Handling for AvP powercut event
            {
                Log.Message("-=PS=- AVP PowerCut event", false);
                Log.Message("   PS=- Returning true", false);
                return(true);
            }

            //TODO: This is for the ship part incident
            //I have no choice but do the patch like this
            //'cause the incidentworker for shippart is an internal class
            //and manual patching doesn't work
            var def = __instance.def;

            if (def != DefDatabase <IncidentDef> .GetNamed("PsychicEmanatorShipPartCrash") && def != DefDatabase <IncidentDef> .GetNamed("DefoliatorShipPartCrash"))            //Lt. Bob: 1.1 - Replaced PoisonShipPartCrash with DefoliatorShipPartCrash
            {
                return(true);
            }
            if (IncidentInterceptorUtility.IsIntercepting_ShipPart == WorkerPatchType.ExecuteOrigin)
            {
                return(true);
            }
            else
            {
                if (!IncidentInterceptorUtility.Intercept_SkyFaller <InterceptedIncident_SkyFaller_ShipPartCrash>(__instance.def, parms))
                {
                    return(true);
                }
                __result = true;
                return(false);
            }
        }
コード例 #11
0
 static bool PreFix(IncidentWorker_MakeGameCondition __instance, ref bool __result, IncidentParms parms)
 {
     //return __instance.def != IncidentDefOf.SolarFlare || !IncidentInterceptorUtility.Intercept_SolarFlare(parms);
     if (__instance.def != IncidentDefOf.SolarFlare || IncidentInterceptorUtility.IsIntercepting_SolarFlare == WorkerPatchType.ExecuteOrigin)
     {
         return(true);
     }
     {
         if (!IncidentInterceptorUtility.Intercept_SolarFlare(parms))
         {
             return(true);
         }
         __result = true;
         return(false);
     }
 }
コード例 #12
0
 static bool PreFix(ref bool __result, IncidentParms parms)
 {
     if (IncidentInterceptorUtility.IsIntercepting_Infestation == WorkerPatchType.ExecuteOrigin)
     {
         return(true);
     }
     else
     {
         if (!IncidentInterceptorUtility.Intercept_Infestation(parms))
         {
             return(true);
         }
         __result = true;
         return(false);
     }
 }
コード例 #13
0
 static bool PreFix(ref bool __result, IncidentParms parms)
 {
     if (IncidentInterceptorUtility.IsIntercepting_ResourcePod == WorkerPatchType.ExecuteOrigin)
     {
         return(true);
     }
     else
     {
         if (!IncidentInterceptorUtility.Intercept_SkyFaller <InterceptedIncident_SkyFaller_ResourcePod>(DefDatabase <IncidentDef> .GetNamed("ResourcePodCrash"), parms))
         {
             return(true);
         }
         __result = true;
         return(false);
     }
 }
コード例 #14
0
        static void Postfix(PawnsArrivalModeWorker_EdgeWalkIn __instance, IncidentParms parms, ref bool __result)
        {
            //This is a temporary fix for refugee chased
            if (IncidentInterceptorUtility.IncidentInQueue(parms, IncidentDefOf.RaidEnemy))
            {
                return;
            }

            if (IncidentInterceptorUtility.IsIntercepting_IncidentExcecution)
            {
                if (IncidentInterceptorUtility.Intercept_Raid(parms))
                {
                    __result = false;
                }
            }
        }
コード例 #15
0
 static bool Prefix(IncidentWorker_ManhunterPack __instance, ref bool __result, IncidentParms parms)
 {
     if (IncidentInterceptorUtility.isIntercepting_ManhunterPack == WorkerPatchType.ExecuteOrigin)
     {
         return(true);
     }
     if (IncidentInterceptorUtility.isIntercepting_ManhunterPack == WorkerPatchType.Forestall)
     {
         IncidentInterceptorUtility.CreateIncidentCaravan_Animal <InterceptedIncident_AnimalHerd_ManhunterPack>(parms);
         __result = true;
     }
     else
     {
         __result = IncidentInterceptorUtility.tmpIncident.SubstituionWorkerExecution();
     }
     return(false);
 }
 static bool Prefix(IncidentWorker_VisitorGroup __instance, ref bool __result, IncidentParms parms)
 {
     if (PreemptiveStrike.Mod.PES_Settings.DebugModeOn)
     {
         Log.Message("-=PS=- Patch_IncidentWorker_VisitorGroup_TryExecuteWorker Prefix"); //Lt. Bob - Logging
     }
     if (parms != null && parms.questTag != null)                                         //Lt. Bob - "Temporary" bypass fix? for Quest handling
     {
         Log.Message("-=PS=- Patch_IncidentWorker_VisitorGroup_TryExecuteWorker - questTag!=Null == " + parms.questTag);
         Log.Message("-=PS=- Returning true");
         return(true);
     }
     if (IncidentInterceptorUtility.isIntercepting_VisitorGroup)
     {
         return(!IncidentInterceptorUtility.CreateIncidentCaraven_HumanNeutral <InterceptedIncident_HumanCrowd_VisitorGroup>(__instance.def, parms));
     }
     return(true);
 }
        static void Postfix(PawnsArrivalModeWorker_EdgeWalkIn __instance, IncidentParms parms, ref bool __result)
        {
            if (PES_Settings.DebugModeOn)
            {
                Log.Message("-=PS=- Patch_EdgeWalkInGroups_TryResolveRaidSpawnCenter Prefix", false);
                IncidentInterceptorUtility.DebugParms(parms, __instance.ToString());
            }
            if (parms.quest != null || parms.questScriptDef != null)
            {
                Log.Message("-=PS=- It's a quest! Bailout! MAYDAY!", false);
                return;
            }

            if (IncidentInterceptorUtility.IsIntercepting_IncidentExcecution)
            {
                if (IncidentInterceptorUtility.Intercept_Raid(parms, true))
                {
                    __result = false;
                }
            }
        }
        public static bool Prefix(IncidentWorker __instance, ref bool __result, IncidentParms parms)
        {
            if (PES_Settings.DebugModeOn)
            {
                Log.Message("-=PS=- Patch_IncidentWorker_Alphabeavers_TryExecuteWorker Prefix", false);
                IncidentInterceptorUtility.DebugParms(parms, __instance.ToString());
            }

            if (IncidentInterceptorUtility.isIntercepting_Alphabeavers == WorkerPatchType.ExecuteOrigin)
            {
                return(true);
            }
            if (IncidentInterceptorUtility.isIntercepting_Alphabeavers == WorkerPatchType.Forestall)
            {
                IncidentInterceptorUtility.CreateIncidentCaravan_Animal <InterceptedIncident_AnimalHerd_Alphabeavers>(__instance.def, parms);
                __result = true;
            }
            else
            {
                __result = IncidentInterceptorUtility.tmpIncident.SubstituionWorkerExecution();
            }
            return(false);
        }