コード例 #1
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);
     }
 }
 static void PostFix(IncidentParms parms, ref bool __result)
 {
     if (IncidentInterceptorUtility.isIntercepting_EdgeDropGroup)
     {
         __result = !IncidentInterceptorUtility.Intercept_SkyFaller <InterceptedIncident_SkyFaller_EdgeDropGroup>(IncidentDefOf.RaidEnemy, parms, true);
     }
 }
コード例 #3
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 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);
            }
        }
コード例 #5
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);
     }
 }