public static void PawnGenerator_GenerateSkills_Postfix(Pawn pawn) { var raceSettings = AutomataRaceSettingCache.Get(pawn.def); if (raceSettings == null) { return; } foreach (var skillDef in raceSettings.conflictingPassions) { if (pawn.skills == null) { continue; } var skillRecord = pawn.skills.GetSkill(skillDef); if (skillRecord == null) { continue; } skillRecord.passion = Passion.None; } }
public static void PawnDiedOrDownedThoughtsUtility_GetThoughts_Postfix(Pawn victim, ref DamageInfo?dinfo, PawnDiedOrDownedThoughtsKind thoughtsKind, List <IndividualThoughtToAdd> outIndividualThoughts, List <ThoughtToAddToAll> outAllColonistsThoughts) { var raceSettings = AutomataRaceSettingCache.Get(victim.def); if (!(raceSettings?.deadThoughtOverrides?.NullOrEmpty() ?? true)) { var oldIndividualThoughts = new List <IndividualThoughtToAdd>(outIndividualThoughts); var oldAllColonistsThoughts = new List <ThoughtToAddToAll>(outAllColonistsThoughts); outIndividualThoughts.Clear(); foreach (var individualThought in oldIndividualThoughts) { var overrideData = raceSettings.deadThoughtOverrides.FirstOrDefault(x => x.source == individualThought.thought.def); if (overrideData != null) { if (overrideData.overwrite != null) { var oldThought = individualThought.thought; var newThought = new IndividualThoughtToAdd( overrideData.overwrite, individualThought.addTo, otherPawn: oldThought.otherPawn, moodPowerFactor: oldThought.moodPowerFactor); var newThoughtSocial = newThought.thought as Thought_MemorySocial; if (newThoughtSocial != null) { newThoughtSocial.opinionOffset = (oldThought as Thought_MemorySocial)?.opinionOffset ?? newThoughtSocial.opinionOffset; } outIndividualThoughts.Add(newThought); } } else { outIndividualThoughts.Add(individualThought); } } outAllColonistsThoughts.Clear(); foreach (var allColonistThought in oldAllColonistsThoughts) { var overrideData = raceSettings.deadThoughtOverrides.FirstOrDefault(x => x.source == allColonistThought.thoughtDef); if (overrideData != null) { if (overrideData.overwrite != null) { outAllColonistsThoughts.Add(new ThoughtToAddToAll(overrideData.overwrite, allColonistThought.otherPawn)); } } else { outAllColonistsThoughts.Add(allColonistThought); } } } }
public static void Pawn_NeedsTracker_ShouldHaveNeed_Postfix(NeedDef nd, Pawn ___pawn, ref bool __result) { var raceSettings = AutomataRaceSettingCache.Get(___pawn.def); if (raceSettings != null) { if (raceSettings.needBlacklists.Contains(nd)) { __result = false; } } }
public static void InteractionUtility_CanInitiateInteraction_Postfix(Pawn pawn, ref bool __result) { if (__result) { var raceSettings = AutomataRaceSettingCache.Get(pawn.def); if (raceSettings != null) { if (!raceSettings.socialActivated) { __result = false; } } } }
public static bool HealthAIUtility_FindBestMedicine_Prefix(Pawn patient, Thing __result) { var raceSettings = AutomataRaceSettingCache.Get(patient.def); if (raceSettings != null) { if (!raceSettings.medicineTendable) { __result = null; return(false); } } return(true); }
public static bool Pawn_SkillTracker_SkillsTick_Prefix(Pawn ___pawn, Pawn_SkillTracker __instance, ref int ___lastXpSinceMidnightResetTimestamp) { if (___pawn.IsHashIntervalTick(200)) { var raceSettings = AutomataRaceSettingCache.Get(___pawn.def); if (raceSettings != null) { if (!raceSettings.skillDecayActivated) { return(false); } } } return(true); }
public static bool HediffComp_Infecter_CheckMakeInfection_Prefix(HediffComp_Infecter __instance) { Pawn pawn = __instance.Pawn; if (pawn != null) { var raceSettings = AutomataRaceSettingCache.Get(pawn.def); if (raceSettings != null) { if (!raceSettings.infectionActivated) { return(false); } } } return(true); }