public override void SettingsChanged() { kinsey = toggleKinsey.Value; mode = kinseyMode.Value; notBabyMode = toggleIndividuality.Value; elections = toggleElections.Value; }
public override void SettingsChanged() { kinsey = toggleKinsey.Value; mode = kinseyMode.Value; sabotabby = toggleSabotage.Value; notBabyMode = toggleIndividuality.Value; }
public override void SettingsChanged() { kinsey = toggleKinsey.Value; mode = kinseyMode.Value; notBabyMode = toggleIndividuality.Value; elections = toggleElections.Value; convoDuration = conversationDuration.Value; dateLetters = toggleDateLetters.Value; bool oldBenchmarkVal = benchmark; benchmark = toggleBenchmarking.Value; // The game has to be restarted for benchmarking to be applied/removed. if (oldBenchmarkVal != benchmark) { GenCommandLine.Restart(); } }
public override void DefsLoaded() { if (ModIsActive) { /* Mod settings */ toggleEmpathy = Settings.GetHandle <bool>("EnableEmpathy", "EmpathyChangesTitle".Translate(), "EmpathyChangesTooltip".Translate(), true); toggleKinsey = Settings.GetHandle <bool>("EnableSexuality", "SexualityChangesTitle".Translate(), "SexualityChangesTooltip".Translate(), true); kinseyMode = Settings.GetHandle <KinseyMode>("KinseyMode", "KinseyModeTitle".Translate(), "KinseyModeTooltip".Translate(), KinseyMode.Realistic, null, "KinseyMode_"); toggleIndividuality = Settings.GetHandle <bool>("EnableIndividuality", "IndividualityTitle".Translate(), "IndividualityTooltip".Translate(), true); toggleElections = Settings.GetHandle <bool>("EnableElections", "ElectionsTitle".Translate(), "ElectionsTooltip".Translate(), true); notBabyMode = toggleIndividuality.Value; elections = toggleElections.Value; if (PsychologyBase.ActivateKinsey()) { mode = kinseyMode.Value; } /* Mod conflict detection */ TraitDef bisexual = DefDatabase <TraitDef> .GetNamedSilentFail("Bisexual"); TraitDef asexual = DefDatabase <TraitDef> .GetNamedSilentFail("Asexual"); if (bisexual != null || asexual != null || !toggleKinsey) { if (toggleKinsey) { Logger.Message("KinseyDisable".Translate()); } kinsey = false; } /* Conditional vanilla Def edits */ ThoughtDef knowGuestExecuted = AddNullifyingTraits("KnowGuestExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowGuestExecuted != null && toggleEmpathy) { knowGuestExecuted = ModifyThoughtStages(knowGuestExecuted, new int[] { -1, -2, -4, -5 }); } ThoughtDef knowColonistExecuted = AddNullifyingTraits("KnowColonistExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistExecuted != null && toggleEmpathy) { knowColonistExecuted = ModifyThoughtStages(knowColonistExecuted, new int[] { -1, -2, -4, -5 }); } ThoughtDef knowPrisonerDiedInnocent = AddNullifyingTraits("KnowPrisonerDiedInnocent", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowPrisonerDiedInnocent != null && toggleEmpathy) { knowPrisonerDiedInnocent = ModifyThoughtStages(knowPrisonerDiedInnocent, new int[] { -4 }); } ThoughtDef knowColonistDied = AddNullifyingTraits("KnowColonistDied", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistDied != null && toggleEmpathy) { knowColonistDied = ModifyThoughtStages(knowColonistDied, new int[] { -2 }); } ThoughtDef colonistAbandoned = AddNullifyingTraits("ColonistAbandoned", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (colonistAbandoned != null && toggleEmpathy) { colonistAbandoned = ModifyThoughtStages(colonistAbandoned, new int[] { -2 }); } ThoughtDef colonistAbandonedToDie = AddNullifyingTraits("ColonistAbandonedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (colonistAbandonedToDie != null && toggleEmpathy) { colonistAbandonedToDie = ModifyThoughtStages(colonistAbandonedToDie, new int[] { -4 }); } ThoughtDef prisonerAbandonedToDie = AddNullifyingTraits("PrisonerAbandonedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (prisonerAbandonedToDie != null && toggleEmpathy) { prisonerAbandonedToDie = ModifyThoughtStages(prisonerAbandonedToDie, new int[] { -3 }); } ThoughtDef knowPrisonerSold = AddNullifyingTraits("KnowPrisonerSold", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowPrisonerSold != null && toggleEmpathy) { knowPrisonerSold = ModifyThoughtStages(knowPrisonerSold, new int[] { -4 }); } ThoughtDef knowGuestOrganHarvested = AddNullifyingTraits("KnowGuestOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowGuestOrganHarvested != null && toggleEmpathy) { knowGuestOrganHarvested = ModifyThoughtStages(knowGuestOrganHarvested, new int[] { -4 }); } ThoughtDef knowColonistOrganHarvested = AddNullifyingTraits("KnowColonistOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistOrganHarvested != null && toggleEmpathy) { knowColonistOrganHarvested = ModifyThoughtStages(knowColonistOrganHarvested, new int[] { -4 }); } ThoughtDef beauty = AddNullifyingTraits("KnowColonistOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistOrganHarvested != null && toggleEmpathy) { knowColonistOrganHarvested = ModifyThoughtStages(knowColonistOrganHarvested, new int[] { -4 }); } IEnumerable <ThingDef> things = (from m in LoadedModManager.RunningMods from def in m.AllDefs.OfType <ThingDef>() where typeof(Pawn).IsAssignableFrom(def.thingClass) select def); foreach (ThingDef t in things) { if (t.race.intelligence == Intelligence.Humanlike && (DefDatabase <ThinkTreeDef> .GetNamedSilentFail("Zombie") == null || t.race.thinkTreeMain != DefDatabase <ThinkTreeDef> .GetNamedSilentFail("Zombie"))) { t.thingClass = typeof(PsychologyPawn); t.inspectorTabsResolved.Add(InspectTabManager.GetSharedInstance(typeof(ITab_Pawn_Psyche))); t.recipes.Add(RecipeDefOfPsychology.TreatPyromania); t.recipes.Add(RecipeDefOfPsychology.TreatChemicalInterest); t.recipes.Add(RecipeDefOfPsychology.TreatChemicalFascination); t.recipes.Add(RecipeDefOfPsychology.TreatDepression); if (!t.race?.hediffGiverSets?.NullOrEmpty() ?? false) { if (t.race.hediffGiverSets.Contains(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicStandard"))) { t.race.hediffGiverSets.Add(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicPsychology")); } } } } /* * Now to enjoy the benefits of having made a popular mod! * This will be our little secret. */ Backstory childMe = new Backstory(); childMe.bodyTypeMale = BodyType.Male; childMe.bodyTypeFemale = BodyType.Female; childMe.slot = BackstorySlot.Childhood; childMe.SetTitle("Child soldier"); childMe.SetTitleShort("Scout"); childMe.baseDesc = "NAME was born into a dictatorial outlander society on a nearby rimworld. Their chief export was war, and HE was conscripted at a young age into the military to serve as a scout due to HIS runner's build. HECAP learned how to use a gun, patch wounds on the battlefield, and communicate with HIS squad. It was there HE earned HIS nickname."; childMe.skillGains.Add("Shooting", 4); childMe.skillGains.Add("Medicine", 2); childMe.skillGains.Add("Social", 1); childMe.requiredWorkTags = WorkTags.Violent; childMe.shuffleable = false; childMe.PostLoad(); childMe.ResolveReferences(); //Disabled until I can be bothered to code it so they're actually siblings. /*Backstory adultMale = new Backstory(); * adultMale.bodyTypeMale = BodyType.Male; * adultMale.bodyTypeFemale = BodyType.Female; * adultMale.slot = BackstorySlot.Adulthood; * adultMale.SetTitle("Missing in action"); * adultMale.SetTitleShort("P.O.W."); * adultMale.baseDesc = "Eventually, HE was captured on a mission by one of his faction's many enemies. HECAP was tortured for information, the techniques of which HE never forgot. When they could get no more out of HIM, HE was sent to a prison camp, where HE worked for years before staging an escape and fleeing into civilization."; * adultMale.skillGains.Add("Crafting", 4); * adultMale.skillGains.Add("Construction", 3); * adultMale.skillGains.Add("Mining", 2); * adultMale.skillGains.Add("Social", 1); * adultMale.spawnCategories = new List<string>(); * adultMale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" }); * adultMale.shuffleable = false; * adultMale.PostLoad(); * adultMale.ResolveReferences();*/ Backstory adultFemale = new Backstory(); adultFemale.bodyTypeMale = BodyType.Male; adultFemale.bodyTypeFemale = BodyType.Female; adultFemale.slot = BackstorySlot.Adulthood; adultFemale.SetTitle("Battlefield medic"); adultFemale.SetTitleShort("Medic"); adultFemale.baseDesc = "HECAP continued to serve in the military, being promoted through the ranks as HIS skill increased. HECAP learned how to treat more serious wounds as HIS role slowly transitioned from scout to medic, as well as how to make good use of army rations. HECAP built good rapport with HIS squad as a result."; adultFemale.skillGains.Add("Shooting", 4); adultFemale.skillGains.Add("Medicine", 3); adultFemale.skillGains.Add("Cooking", 2); adultFemale.skillGains.Add("Social", 1); adultFemale.spawnCategories = new List <string>(); adultFemale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" }); adultFemale.shuffleable = false; adultFemale.PostLoad(); adultFemale.ResolveReferences(); /*PawnBio maleMe = new PawnBio(); * maleMe.childhood = childMe; * maleMe.adulthood = adultMale; * maleMe.gender = GenderPossibility.Male; * maleMe.name = NameTriple.FromString("Nathan 'Jackal' Tarai"); * maleMe.PostLoad(); * SolidBioDatabase.allBios.Add(maleMe);*/ PawnBio femaleMe = new PawnBio(); femaleMe.childhood = childMe; femaleMe.adulthood = adultFemale; femaleMe.gender = GenderPossibility.Female; femaleMe.name = NameTriple.FromString("Elizabeth 'Eagle' Tarai"); femaleMe.PostLoad(); SolidBioDatabase.allBios.Add(femaleMe); BackstoryDatabase.AddBackstory(childMe); //BackstoryDatabase.AddBackstory(adultMale); BackstoryDatabase.AddBackstory(adultFemale); } }
public override void DefsLoaded() { if (ModIsActive) { toggleEmpathy = Settings.GetHandle <bool>("EnableEmpathy", "EmpathyChangesTitle".Translate(), "EmpathyChangesTooltip".Translate(), true); toggleKinsey = Settings.GetHandle <bool>("EnableSexuality", "SexualityChangesTitle".Translate(), "SexualityChangesTooltip".Translate(), true); kinseyMode = Settings.GetHandle <KinseyMode>("KinseyMode", "KinseyModeTitle".Translate(), "KinseyModeTooltip".Translate(), KinseyMode.Realistic, null, "KinseyMode_"); toggleSabotage = Settings.GetHandle <bool>("EnableSabotage", "SabotageIncidentTitle".Translate(), "SabotageIncidentTooltip".Translate(), false); toggleIndividuality = Settings.GetHandle <bool>("EnableIndividuality", "IndividualityTitle".Translate(), "IndividualityTooltip".Translate(), true); sabotabby = toggleSabotage.Value; notBabyMode = toggleIndividuality.Value; if (!detoursMedical) { Logger.Warning("MedicalDetourDisable".Translate()); } //Vanilla Defs will be edited at load to improve compatibility with other mods. AddConflictingTraits("Nudist", new TraitDef[] { TraitDefOfPsychology.Prude }); AddConflictingTraits("Bloodlust", new TraitDef[] { TraitDefOfPsychology.BleedingHeart, TraitDefOfPsychology.Desensitized }); AddConflictingTraits("Psychopath", new TraitDef[] { TraitDefOfPsychology.BleedingHeart, TraitDefOfPsychology.Desensitized, TraitDefOfPsychology.OpenMinded }); AddConflictingTraits("Cannibal", new TraitDef[] { TraitDefOfPsychology.BleedingHeart, TraitDefOfPsychology.Gourmet }); AddConflictingTraits("Ascetic", new TraitDef[] { TraitDefOfPsychology.Gourmet }); AddConflictingTraits("Neurotic", new TraitDef[] { TraitDefOfPsychology.HeavySleeper }); AddConflictingTraits("DislikesMen", new TraitDef[] { TraitDefOfPsychology.OpenMinded }); AddConflictingTraits("DislikesWomen", new TraitDef[] { TraitDefOfPsychology.OpenMinded }); AddConflictingTraits("Prosthophobe", new TraitDef[] { TraitDefOfPsychology.OpenMinded }); TraitDef bisexual = DefDatabase <TraitDef> .GetNamedSilentFail("Bisexual"); TraitDef asexual = DefDatabase <TraitDef> .GetNamedSilentFail("Asexual"); if (bisexual != null || asexual != null || !toggleKinsey || !detoursSexual) { if (toggleKinsey) { Logger.Message("KinseyDisable".Translate()); if (!detoursSexual) { Logger.Warning("KinseyDetourDisable".Translate()); TraitDefOfPsychology.Codependent.SetCommonality(0f); TraitDefOfPsychology.Lecher.SetCommonality(0f); TraitDefOfPsychology.OpenMinded.SetCommonality(0f); TraitDefOfPsychology.Polygamous.SetCommonality(0f); } } kinsey = false; } if (PsychologyBase.ActivateKinsey()) { mode = kinseyMode.Value; TraitDef gay = TraitDef.Named("Gay"); if (gay != null) { gay.SetCommonality(0f); } foreach (ThingDef t in DefDatabase <ThingDef> .AllDefsListForReading) { if (t.thingClass == typeof(Pawn)) { t.thingClass = typeof(PsychologyPawn); } } } AddNullifyingTraits("AteLavishMeal", new TraitDef[] { TraitDefOfPsychology.Gourmet }); AddNullifyingTraits("AteFineMeal", new TraitDef[] { TraitDefOfPsychology.Gourmet }); AddNullifyingTraits("AteAwfulMeal", new TraitDef[] { TraitDefOfPsychology.Gourmet }); AddNullifyingTraits("AteRawFood", new TraitDef[] { TraitDefOfPsychology.Gourmet }); AddNullifyingTraits("AteInsectMeatAsIngredient", new TraitDef[] { TraitDefOfPsychology.Gourmet }); AddNullifyingTraits("AteInsectMeatDirect", new TraitDef[] { TraitDefOfPsychology.Gourmet }); AddNullifyingTraits("AteRottenFood", new TraitDef[] { TraitDefOfPsychology.Gourmet }); AddNullifyingTraits("SleepDisturbed", new TraitDef[] { TraitDefOfPsychology.HeavySleeper }); AddNullifyingTraits("ObservedLayingCorpse", new TraitDef[] { TraitDefOfPsychology.Desensitized }); AddNullifyingTraits("WitnessedDeathAlly", new TraitDef[] { TraitDefOfPsychology.BleedingHeart, TraitDefOfPsychology.Desensitized }); AddNullifyingTraits("WitnessedDeathNonAlly", new TraitDef[] { TraitDefOfPsychology.BleedingHeart, TraitDefOfPsychology.Desensitized }); AddNullifyingTraits("FeelingRandom", new TraitDef[] { TraitDefOfPsychology.Unstable }); AddNullifyingTraits("ApparelDamaged", new TraitDef[] { TraitDefOfPsychology.Prude }); AddNullifyingTraits("EnvironmentDark", new TraitDef[] { TraitDefOfPsychology.Photosensitive }); AddNullifyingTraits("DeadMansApparel", new TraitDef[] { TraitDefOfPsychology.Desensitized }); AddNullifyingTraits("Naked", new TraitDef[] { TraitDefOfPsychology.Prude }); AddNullifyingTraits("ColonistLeftUnburied", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); AddNullifyingTraits("CheatedOnMe", new TraitDef[] { TraitDefOfPsychology.Polygamous }); AddNullifyingTraits("Affair", new TraitDef[] { TraitDefOfPsychology.Polygamous }); AddNullifyingTraits("Disfigured", new TraitDef[] { TraitDefOfPsychology.OpenMinded }); AddNullifyingTraits("Pretty", new TraitDef[] { TraitDefOfPsychology.OpenMinded }); AddNullifyingTraits("Ugly", new TraitDef[] { TraitDefOfPsychology.OpenMinded }); AddNullifyingTraits("SleptOutside", new TraitDef[] { TraitDefOfPsychology.Outdoorsy }); ThoughtDef knowGuestExecuted = AddNullifyingTraits("KnowGuestExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowGuestExecuted != null && toggleEmpathy) { if (knowGuestExecuted.stages.Count >= 1) //We can't assume that other mods won't remove stages from this thought, so we'll try to avoid OutOfBounds exceptions. { knowGuestExecuted.stages[0].baseMoodEffect = -1; } if (knowGuestExecuted.stages.Count >= 2) { knowGuestExecuted.stages[1].baseMoodEffect = -2; } if (knowGuestExecuted.stages.Count >= 3) { knowGuestExecuted.stages[2].baseMoodEffect = -4; } if (knowGuestExecuted.stages.Count >= 4) { knowGuestExecuted.stages[3].baseMoodEffect = -5; } } ThoughtDef knowColonistExecuted = AddNullifyingTraits("KnowColonistExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistExecuted != null && toggleEmpathy) { if (knowColonistExecuted.stages.Count >= 1) { knowColonistExecuted.stages[0].baseMoodEffect = -1; } if (knowColonistExecuted.stages.Count >= 2) { knowColonistExecuted.stages[1].baseMoodEffect = -2; } if (knowColonistExecuted.stages.Count >= 3) { knowColonistExecuted.stages[2].baseMoodEffect = -4; } if (knowColonistExecuted.stages.Count >= 4) { knowColonistExecuted.stages[3].baseMoodEffect = -5; } } ThoughtDef knowPrisonerDiedInnocent = AddNullifyingTraits("KnowPrisonerDiedInnocent", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowPrisonerDiedInnocent != null && toggleEmpathy) { if (knowPrisonerDiedInnocent.stages.Count >= 1) { knowPrisonerDiedInnocent.stages[0].baseMoodEffect = -4; } } ThoughtDef knowColonistDied = AddNullifyingTraits("KnowColonistDied", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistDied != null && toggleEmpathy) { if (knowColonistDied.stages.Count >= 1) { knowColonistDied.stages[0].baseMoodEffect = -2; } } ThoughtDef colonistAbandoned = AddNullifyingTraits("ColonistAbandoned", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (colonistAbandoned != null && toggleEmpathy) { if (colonistAbandoned.stages.Count >= 1) { colonistAbandoned.stages[0].baseMoodEffect = -2; } } ThoughtDef colonistAbandonedToDie = AddNullifyingTraits("ColonistAbandonedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (colonistAbandonedToDie != null && toggleEmpathy) { if (colonistAbandonedToDie.stages.Count >= 1) { colonistAbandonedToDie.stages[0].baseMoodEffect = -4; } } ThoughtDef prisonerAbandonedToDie = AddNullifyingTraits("PrisonerAbandonedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (prisonerAbandonedToDie != null && toggleEmpathy) { if (prisonerAbandonedToDie.stages.Count >= 1) { prisonerAbandonedToDie.stages[0].baseMoodEffect = -3; } } ThoughtDef knowPrisonerSold = AddNullifyingTraits("KnowPrisonerSold", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowPrisonerSold != null && toggleEmpathy) { if (knowPrisonerSold.stages.Count >= 1) { knowPrisonerSold.stages[0].baseMoodEffect = -4; } } ThoughtDef knowGuestOrganHarvested = AddNullifyingTraits("KnowGuestOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowGuestOrganHarvested != null && toggleEmpathy) { if (knowGuestOrganHarvested.stages.Count >= 1) { knowGuestOrganHarvested.stages[0].baseMoodEffect = -4; } } ThoughtDef knowColonistOrganHarvested = AddNullifyingTraits("KnowColonistOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistOrganHarvested != null && toggleEmpathy) { if (knowColonistOrganHarvested.stages.Count >= 1) { knowColonistOrganHarvested.stages[0].baseMoodEffect = -4; } } ReplaceThoughtWorker("CabinFever", typeof(ThoughtWorker_CabinFever)); ReplaceThoughtWorker("Disfigured", typeof(ThoughtWorker_Disfigured)); ReplaceThoughtWorker("Ugly", typeof(ThoughtWorker_Ugly)); ReplaceThoughtWorker("AnnoyingVoice", typeof(ThoughtWorker_AnnoyingVoice)); ReplaceThoughtWorker("CreepyBreathing", typeof(ThoughtWorker_CreepyBreathing)); ReplaceThoughtWorker("Pretty", typeof(ThoughtWorker_Pretty)); ReplaceIncidentWorker("RaidEnemy", typeof(IncidentWorker_RaidEnemy)); // Credit to FluffierThanThou for the code. var livingRaces = DefDatabase <ThingDef> .AllDefsListForReading .Where(t => !t.race?.hediffGiverSets?.NullOrEmpty() ?? false); foreach (ThingDef alive in livingRaces) { if (alive.race.hediffGiverSets.Contains(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicStandard"))) { alive.race.hediffGiverSets.Add(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicPsychology")); alive.recipes.Add(RecipeDefOfPsychology.TreatPyromania); } } MentalBreakDef berserk = DefDatabase <MentalBreakDef> .GetNamed("Berserk"); berserk.baseCommonality = 0f; MentalStateDef fireStartingSpree = DefDatabase <MentalStateDef> .GetNamed("FireStartingSpree"); fireStartingSpree.workerClass = typeof(MentalStateWorker_FireStartingSpree); /* * Now to enjoy the benefits of having made a popular mod! * This will be our little secret. */ Backstory childMe = new Backstory(); childMe.bodyTypeMale = BodyType.Male; childMe.bodyTypeFemale = BodyType.Female; childMe.slot = BackstorySlot.Childhood; childMe.SetTitle("Child soldier"); childMe.SetTitleShort("Scout"); childMe.baseDesc = "NAME was born into a dictatorial outlander society on a nearby rimworld. Their chief export was war, and HE was conscripted at a young age into the military to serve as a scout due to HIS runner's build. HECAP learned how to use a gun, patch wounds on the battlefield, and communicate with HIS squad. It was there HE earned HIS nickname."; childMe.skillGains.Add("Shooting", 4); childMe.skillGains.Add("Medicine", 2); childMe.skillGains.Add("Social", 1); childMe.requiredWorkTags = WorkTags.Violent; childMe.shuffleable = false; childMe.PostLoad(); childMe.ResolveReferences(); //Disabled until I can be bothered to code it so they're actually siblings. /*Backstory adultMale = new Backstory(); * adultMale.bodyTypeMale = BodyType.Male; * adultMale.bodyTypeFemale = BodyType.Female; * adultMale.slot = BackstorySlot.Adulthood; * adultMale.SetTitle("Missing in action"); * adultMale.SetTitleShort("P.O.W."); * adultMale.baseDesc = "Eventually, HE was captured on a mission by one of his faction's many enemies. HECAP was tortured for information, the techniques of which HE never forgot. When they could get no more out of HIM, HE was sent to a prison camp, where HE worked for years before staging an escape and fleeing into civilization."; * adultMale.skillGains.Add("Crafting", 4); * adultMale.skillGains.Add("Construction", 3); * adultMale.skillGains.Add("Mining", 2); * adultMale.skillGains.Add("Social", 1); * adultMale.spawnCategories = new List<string>(); * adultMale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" }); * adultMale.shuffleable = false; * adultMale.PostLoad(); * adultMale.ResolveReferences();*/ Backstory adultFemale = new Backstory(); adultFemale.bodyTypeMale = BodyType.Male; adultFemale.bodyTypeFemale = BodyType.Female; adultFemale.slot = BackstorySlot.Adulthood; adultFemale.SetTitle("Battlefield medic"); adultFemale.SetTitleShort("Medic"); adultFemale.baseDesc = "HECAP continued to serve in the military, being promoted through the ranks as HIS skill increased. HECAP learned how to treat more serious wounds as HIS role slowly transitioned from scout to medic, as well as how to make good use of army rations. HECAP built good rapport with HIS squad as a result."; adultFemale.skillGains.Add("Shooting", 4); adultFemale.skillGains.Add("Medicine", 3); adultFemale.skillGains.Add("Cooking", 2); adultFemale.skillGains.Add("Social", 1); adultFemale.spawnCategories = new List <string>(); adultFemale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" }); adultFemale.shuffleable = false; adultFemale.PostLoad(); adultFemale.ResolveReferences(); /*PawnBio maleMe = new PawnBio(); * maleMe.childhood = childMe; * maleMe.adulthood = adultMale; * maleMe.gender = GenderPossibility.Male; * maleMe.name = NameTriple.FromString("Nathan 'Jackal' Tarai"); * maleMe.PostLoad(); * SolidBioDatabase.allBios.Add(maleMe);*/ PawnBio femaleMe = new PawnBio(); femaleMe.childhood = childMe; femaleMe.adulthood = adultFemale; femaleMe.gender = GenderPossibility.Female; femaleMe.name = NameTriple.FromString("Elizabeth 'Eagle' Tarai"); femaleMe.PostLoad(); SolidBioDatabase.allBios.Add(femaleMe); BackstoryDatabase.AddBackstory(childMe); //BackstoryDatabase.AddBackstory(adultMale); BackstoryDatabase.AddBackstory(adultFemale); } }
public override void DefsLoaded() { if (ModIsActive) { /* Mod settings */ toggleEmpathy = Settings.GetHandle <bool>("EnableEmpathy", "EmpathyChangesTitle".Translate(), "EmpathyChangesTooltip".Translate(), true); toggleKinsey = Settings.GetHandle <bool>("EnableSexuality", "SexualityChangesTitle".Translate(), "SexualityChangesTooltip".Translate(), true); kinseyMode = Settings.GetHandle <KinseyMode>("KinseyMode", "KinseyModeTitle".Translate(), "KinseyModeTooltip".Translate(), KinseyMode.Realistic, null, "KinseyMode_"); toggleIndividuality = Settings.GetHandle <bool>("EnableIndividuality", "IndividualityTitle".Translate(), "IndividualityTooltip".Translate(), true); toggleElections = Settings.GetHandle <bool>("EnableElections", "ElectionsTitle".Translate(), "ElectionsTooltip".Translate(), true); conversationDuration = Settings.GetHandle <float>("ConversationDuration", "DurationTitle".Translate(), "DurationTooltip".Translate(), 60f, (String s) => float.Parse(s) >= 15f && float.Parse(s) <= 180f); toggleDateLetters = Settings.GetHandle <bool>("SendDateLetters", "SendDateLettersTitle".Translate(), "SendDateLettersTooltip".Translate(), true); toggleBenchmarking = Settings.GetHandle <bool>("Benchmarking", "BenchmarkingTitle".Translate(), "BenchmarkingTooltip".Translate(), false); kinsey = toggleKinsey.Value; notBabyMode = toggleIndividuality.Value; elections = toggleElections.Value; dateLetters = toggleDateLetters.Value; benchmark = toggleBenchmarking.Value; convoDuration = conversationDuration.Value; if (PsychologyBase.ActivateKinsey()) { mode = kinseyMode.Value; } /* Mod conflict detection */ TraitDef bisexual = DefDatabase <TraitDef> .GetNamedSilentFail("Bisexual"); TraitDef asexual = DefDatabase <TraitDef> .GetNamedSilentFail("Asexual"); if (bisexual != null || asexual != null || !toggleKinsey) { if (toggleKinsey) { Logger.Message("KinseyDisable".Translate()); } kinsey = false; } /* Conditional vanilla Def edits */ ThoughtDef knowGuestExecuted = AddNullifyingTraits("KnowGuestExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowGuestExecuted != null && toggleEmpathy) { knowGuestExecuted = ModifyThoughtStages(knowGuestExecuted, new int[] { -1, -2, -4, -5 }); } ThoughtDef knowColonistExecuted = AddNullifyingTraits("KnowColonistExecuted", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistExecuted != null && toggleEmpathy) { knowColonistExecuted = ModifyThoughtStages(knowColonistExecuted, new int[] { -1, -2, -4, -5 }); } ThoughtDef knowPrisonerDiedInnocent = AddNullifyingTraits("KnowPrisonerDiedInnocent", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowPrisonerDiedInnocent != null && toggleEmpathy) { knowPrisonerDiedInnocent = ModifyThoughtStages(knowPrisonerDiedInnocent, new int[] { -4 }); } ThoughtDef knowColonistDied = AddNullifyingTraits("KnowColonistDied", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistDied != null && toggleEmpathy) { knowColonistDied = ModifyThoughtStages(knowColonistDied, new int[] { -2 }); } ThoughtDef colonistAbandoned = AddNullifyingTraits("ColonistBanished", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (colonistAbandoned != null && toggleEmpathy) { colonistAbandoned = ModifyThoughtStages(colonistAbandoned, new int[] { -2 }); } ThoughtDef colonistAbandonedToDie = AddNullifyingTraits("ColonistBanishedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (colonistAbandonedToDie != null && toggleEmpathy) { colonistAbandonedToDie = ModifyThoughtStages(colonistAbandonedToDie, new int[] { -4 }); } ThoughtDef prisonerAbandonedToDie = AddNullifyingTraits("PrisonerBanishedToDie", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (prisonerAbandonedToDie != null && toggleEmpathy) { prisonerAbandonedToDie = ModifyThoughtStages(prisonerAbandonedToDie, new int[] { -3 }); } ThoughtDef knowPrisonerSold = AddNullifyingTraits("KnowPrisonerSold", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowPrisonerSold != null && toggleEmpathy) { knowPrisonerSold = ModifyThoughtStages(knowPrisonerSold, new int[] { -4 }); } ThoughtDef knowGuestOrganHarvested = AddNullifyingTraits("KnowGuestOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowGuestOrganHarvested != null && toggleEmpathy) { knowGuestOrganHarvested = ModifyThoughtStages(knowGuestOrganHarvested, new int[] { -4 }); } ThoughtDef knowColonistOrganHarvested = AddNullifyingTraits("KnowColonistOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistOrganHarvested != null && toggleEmpathy) { knowColonistOrganHarvested = ModifyThoughtStages(knowColonistOrganHarvested, new int[] { -4 }); } ThoughtDef beauty = AddNullifyingTraits("KnowColonistOrganHarvested", new TraitDef[] { TraitDefOfPsychology.BleedingHeart }); if (knowColonistOrganHarvested != null && toggleEmpathy) { knowColonistOrganHarvested = ModifyThoughtStages(knowColonistOrganHarvested, new int[] { -4 }); } /* ThingDef injection reworked by notfood */ var zombieThinkTree = DefDatabase <ThinkTreeDef> .GetNamedSilentFail("Zombie"); IEnumerable <ThingDef> things = ( from def in DefDatabase <ThingDef> .AllDefs where typeof(Pawn).IsAssignableFrom(def.thingClass) && def.race?.intelligence == Intelligence.Humanlike && !def.defName.Contains("AIPawn") && (zombieThinkTree == null || def.race.thinkTreeMain != zombieThinkTree) select def ); List <string> registered = new List <string>(); foreach (ThingDef t in things) { if (t.inspectorTabsResolved == null) { t.inspectorTabsResolved = new List <InspectTabBase>(1); } t.inspectorTabsResolved.Add(InspectTabManager.GetSharedInstance(typeof(ITab_Pawn_Psyche))); if (t.recipes == null) { t.recipes = new List <RecipeDef>(6); } t.recipes.Add(RecipeDefOfPsychology.TreatPyromania); t.recipes.Add(RecipeDefOfPsychology.TreatChemicalInterest); t.recipes.Add(RecipeDefOfPsychology.TreatChemicalFascination); t.recipes.Add(RecipeDefOfPsychology.TreatDepression); t.recipes.Add(RecipeDefOfPsychology.TreatInsomnia); t.recipes.Add(RecipeDefOfPsychology.CureAnxiety); if (t.comps == null) { t.comps = new List <CompProperties>(1); } t.comps.Add(new CompProperties_Psychology()); if (!t.race.hediffGiverSets.NullOrEmpty()) { if (t.race.hediffGiverSets.Contains(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicStandard"))) { t.race.hediffGiverSets.Add(DefDatabase <HediffGiverSetDef> .GetNamed("OrganicPsychology")); } } registered.Add(t.defName); } if (Prefs.DevMode && Prefs.LogVerbose) { Log.Message("Psychology :: Registered " + string.Join(", ", registered.ToArray())); } /* * Now to enjoy the benefits of having made a popular mod! * This will be our little secret. */ Traverse.Create(child).Field("bodyTypeMale").SetValue("Male"); Traverse.Create(child).Field("bodyTypeFemale").SetValue("Female"); child.slot = BackstorySlot.Childhood; child.SetTitle("Child soldier", "Child soldier"); child.SetTitleShort("Scout", "Scout"); child.baseDesc = "[PAWN_nameDef] was born into a dictatorial outlander society on a nearby rimworld. Their chief export was war, and [PAWN_pronoun] was conscripted at a young age into the military to serve as a scout due to [PAWN_possessive] runner's build. [PAWN_pronoun] learned how to use a gun, patch wounds on the battlefield, and communicate with [PAWN_possessive] squad. It was there [PAWN_pronoun] earned [PAWN_possessive] nickname."; Traverse.Create(child).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Shooting", 4); Traverse.Create(child).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Medicine", 2); Traverse.Create(child).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Social", 1); child.requiredWorkTags = WorkTags.Violent; child.shuffleable = false; child.PostLoad(); child.ResolveReferences(); Backstory adultMale = new Backstory(); Traverse.Create(adultMale).Field("bodyTypeMale").SetValue("Male"); Traverse.Create(adultMale).Field("bodyTypeFemale").SetValue("Female"); adultMale.slot = BackstorySlot.Adulthood; adultMale.SetTitle("Missing in action", "Missing in action"); adultMale.SetTitleShort("Ex-P.O.W.", "Ex-P.O.W."); adultMale.baseDesc = "Eventually, [PAWN_pronoun] was captured on a mission by one of [PAWN_possessive] faction's many enemies. [PAWN_pronoun] was tortured for information, the techniques of which [PAWN_pronoun] never forgot. When they could get no more out of [PAWN_objective], [PAWN_pronoun] was sent to a prison camp, where [PAWN_pronoun] worked for years before staging an escape and fleeing into civilization."; Traverse.Create(adultMale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Crafting", 4); Traverse.Create(adultMale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Construction", 3); Traverse.Create(adultMale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Mining", 2); Traverse.Create(adultMale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Social", 1); adultMale.spawnCategories = new List <string>(); adultMale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" }); adultMale.shuffleable = false; adultMale.PostLoad(); adultMale.ResolveReferences(); Backstory adultFemale = new Backstory(); Traverse.Create(adultFemale).Field("bodyTypeMale").SetValue("Male"); Traverse.Create(adultFemale).Field("bodyTypeFemale").SetValue("Female"); adultFemale.slot = BackstorySlot.Adulthood; adultFemale.SetTitle("Battlefield medic", "Battlefield medic"); adultFemale.SetTitleShort("Medic", "Medic"); adultFemale.baseDesc = "[PAWN_pronoun] continued to serve in the military, being promoted through the ranks as [PAWN_possessive] skill increased. [PAWN_pronoun] learned how to treat more serious wounds as [PAWN_possessive] role slowly transitioned from scout to medic, as well as how to make good use of army rations. [PAWN_pronoun] built good rapport with [PAWN_possessive] squad as a result."; Traverse.Create(adultFemale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Shooting", 4); Traverse.Create(adultFemale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Medicine", 3); Traverse.Create(adultFemale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Cooking", 2); Traverse.Create(adultFemale).Field("skillGains").GetValue <Dictionary <string, int> >().Add("Social", 1); adultFemale.spawnCategories = new List <string>(); adultFemale.spawnCategories.AddRange(new string[] { "Civil", "Raider", "Slave", "Trader", "Traveler" }); adultFemale.shuffleable = false; adultFemale.PostLoad(); adultFemale.ResolveReferences(); PawnBio male = new PawnBio(); male.childhood = child; male.adulthood = adultMale; male.gender = GenderPossibility.Male; male.name = NameTriple.FromString("Jason 'Jackal' Tarai"); male.PostLoad(); SolidBioDatabase.allBios.Add(male); PawnBio female = new PawnBio(); female.childhood = child; female.adulthood = adultFemale; female.gender = GenderPossibility.Female; female.name = NameTriple.FromString("Elizabeth 'Eagle' Tarai"); female.PostLoad(); SolidBioDatabase.allBios.Add(female); BackstoryDatabase.AddBackstory(child); BackstoryDatabase.AddBackstory(adultMale); BackstoryDatabase.AddBackstory(adultFemale); } }