public static bool Intercept_Raid(IncidentParms parms, bool splitInGroups = false) { if (parms.faction.PlayerRelationKind != FactionRelationKind.Hostile) { return(false); } InterceptedIncident incident; if (splitInGroups) { incident = new InterceptedIncident_HumanCrowd_RaidEnemy_Groups(); } else { incident = new InterceptedIncident_HumanCrowd_RaidEnemy(); } incident.incidentDef = CurrentIncidentDef; incident.parms = parms; if (!incident.ManualDeterminParams()) { return(false); } RaidingGoalUtility.ResolveRaidGoal(incident as InterceptedIncident_HumanCrowd_RaidEnemy); if (!IncidentCaravanUtility.AddNewIncidentCaravan(incident)) { Log.Error("Fail to create Incident Caravan"); return(false); } IsHoaxingStoryTeller = true; if (PES_Settings.DebugModeOn) { Messages.Message("PES_Debug: Successfully intercepted a raid Incident", MessageTypeDefOf.NeutralEvent); } return(true); }
public static bool Intercept_Raid(IncidentParms parms, bool splitInGroups = false) { if (PES_Settings.DebugModeOn) { Log.Message("-=PS=- Intercept_Raid Start", false); } if (parms.faction == null) { if (parms.traderKind != null) { Log.Message("-=PS=- parms.traderKind=" + parms.traderKind.ToString(), false); } Log.Message("-=PS=- parms.faction == null", false); return(false); } if (parms != null && parms.questTag != null) //Lt. Bob - "Temporary" bypass fix? for Quest handling { Log.Message("-=PS=- Intercept_Raid - questTag!=Null == " + parms.questTag); } if (parms.faction.PlayerRelationKind != FactionRelationKind.Hostile) { return(false); } InterceptedIncident incident; if (splitInGroups) { incident = new InterceptedIncident_HumanCrowd_RaidEnemy_Groups(); } else { incident = new InterceptedIncident_HumanCrowd_RaidEnemy(); } if (CurrentIncidentDef == null) { Log.Error("PES: A raid incident that is not compatible with Preemptive Strike is trying to execute. So this incident won't be intercepted by PES and will be executed in it vanilla way"); return(false); //Fix v1.1.4: In some mods, their raids are implemented without a incidentworker } incident.incidentDef = CurrentIncidentDef; incident.parms = parms; if (!incident.ManualDeterminParams()) { return(false); } RaidingGoalUtility.ResolveRaidGoal(incident as InterceptedIncident_HumanCrowd_RaidEnemy); if (!IncidentCaravanUtility.AddNewIncidentCaravan(incident)) { Log.Error("Fail to create Incident Caravan"); return(false); } IsHoaxingStoryTeller = true; if (PES_Settings.DebugModeOn) { Messages.Message("PES_Debug: Successfully intercepted a raid Incident", MessageTypeDefOf.NeutralEvent); } return(true); }