Beispiel #1
0
        public override void ResolveReferences()
        {
            Dictionary <SkillDef, int> skills = new Dictionary <SkillDef, int>();

            base.ResolveReferences();
            foreach (skillGains skillGains in this.skillGains)
            {
                if (!skills.ContainsKey(skillGains.skill))
                {
                    skills.Add(skillGains.skill, skillGains.amount);
                }
            }

            this.story = new Backstory
            {
                slot               = this.backstorySlot,
                title              = this.title,
                titleFemale        = this.femaleTitle,
                titleShort         = this.shortTitle,
                titleShortFemale   = this.shortFemaleTitle,
                identifier         = this.defName,
                baseDesc           = this.storyDesc,
                spawnCategories    = this.spawnInCategories,
                skillGainsResolved = skills,
                forcedTraits       = this.forcedTraits,
                disallowedTraits   = this.disabledTraits,
            };

            BackstoryDatabase.AddBackstory(story);
        }
 public static void AddAllCustom()
 {
     foreach (PawnBio curPawnBio in from def in DefDatabase <PawnBioDef> .AllDefsListForReading
              select def.ToPawnBio())
     {
         curPawnBio.name.ResolveMissingPieces();
         if (curPawnBio.childhood == null || curPawnBio.adulthood == null)
         {
             PawnNameDatabaseSolid.AddPlayerContentName(curPawnBio.name, curPawnBio.gender);
         }
         else
         {
             SolidBioDatabase.allBios.Add(curPawnBio);
             curPawnBio.childhood.shuffleable = false;
             curPawnBio.childhood.slot        = BackstorySlot.Childhood;
             BackstoryDatabase.AddBackstory(curPawnBio.childhood);
             curPawnBio.adulthood.shuffleable = false;
             curPawnBio.adulthood.slot        = BackstorySlot.Adulthood;
             BackstoryDatabase.AddBackstory(curPawnBio.adulthood);
         }
     }
     foreach (Backstory curBackstory in from def in DefDatabase <BackstoryDef> .AllDefsListForReading
              where def.shuffleable
              select def.ToBackstory())
     {
         if (!BackstoryDatabase.allBackstories.ContainsKey(curBackstory.identifier))
         {
             BackstoryDatabase.AddBackstory(curBackstory);
         }
     }
 }
 static DroneBackstories()
 {
     LongEventHandler.ExecuteWhenFinished(() =>
     {
         childhood = new Backstory()
         {
             title        = "PRFDroneName".Translate(),
             titleShort   = "PRFDroneName".Translate(),
             identifier   = "PRFNoneBracketsC",
             workDisables = WorkTags.Social,
             slot         = BackstorySlot.Childhood,
             baseDesc     = "NoneBrackets".Translate()
         };
         //this check is required to avoid an issue with "BetterLoading" as it calls "LongEventHandler.ExecuteWhenFinished" twice
         if (!BackstoryDatabase.allBackstories.ContainsKey(childhood.identifier))
         {
             BackstoryDatabase.AddBackstory(childhood);
         }
         adulthood = new Backstory()
         {
             title        = "PRFDroneName".Translate(),
             titleShort   = "PRFDroneName".Translate(),
             identifier   = "PRFNoneBracketsA",
             workDisables = WorkTags.Social,
             slot         = BackstorySlot.Adulthood,
             baseDesc     = "NoneBrackets".Translate()
         };
         //this check is required to avoid an issue with "BetterLoading" as it calls "LongEventHandler.ExecuteWhenFinished" twice
         if (!BackstoryDatabase.allBackstories.ContainsKey(adulthood.identifier))
         {
             BackstoryDatabase.AddBackstory(adulthood);
         }
     });
 }
Beispiel #4
0
        public override void Initialize()
        {
            base.Initialize();
            Backstory cbs = new Backstory();
            Backstory abs = new Backstory();

            cbs.identifier     = childBS;
            cbs.slot           = BackstorySlot.Childhood;
            cbs.baseDesc       = "Questions... ";
            cbs.bodyTypeGlobal = BodyType.Undefined;
            cbs.bodyTypeMale   = BodyType.Male;
            cbs.bodyTypeFemale = BodyType.Female;
            cbs.shuffleable    = false;
            cbs.SetTitleShort("Amnesiac");
            cbs.SetTitle("Child Amnesiac");

            abs.identifier     = adultBS;
            abs.slot           = BackstorySlot.Adulthood;
            abs.baseDesc       = "Nope, still nothing.";
            abs.bodyTypeGlobal = BodyType.Undefined;
            abs.bodyTypeMale   = BodyType.Male;
            abs.bodyTypeFemale = BodyType.Female;
            abs.shuffleable    = false;
            abs.SetTitleShort("Amnesiac");
            abs.SetTitle("Complete Amnesiac");

            BackstoryDatabase.AddBackstory(abs);
            BackstoryDatabase.AddBackstory(cbs);
        }
Beispiel #5
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();


            if (!this.addToDatabase || BackstoryDatabase.allBackstories.ContainsKey(key: this.defName) || this.title.NullOrEmpty() || this.spawnCategories.NullOrEmpty())
            {
                return;
            }

            this.backstory = new Backstory
            {
                slot             = this.slot,
                shuffleable      = this.shuffleable,
                spawnCategories  = this.spawnCategories,
                forcedTraits     = this.forcedTraits.NullOrEmpty() ? null : this.forcedTraits.Where(predicate: trait => Rand.Range(min: 0, max: 100) < trait.chance).ToList().ConvertAll(converter: trait => new TraitEntry(def: TraitDef.Named(defName: trait.defName), degree: trait.degree)),
                disallowedTraits = this.disallowedTraits.NullOrEmpty() ? null : this.disallowedTraits.Where(predicate: trait => Rand.Range(min: 0, max: 100) < trait.chance).ToList().ConvertAll(converter: trait => new TraitEntry(def: TraitDef.Named(defName: trait.defName), degree: trait.degree)),
                workDisables     = this.workAllows.NullOrEmpty() ? this.workDisables.NullOrEmpty() ? WorkTags.None : ((Func <WorkTags>) delegate
                {
                    WorkTags wt = WorkTags.None;
                    this.workDisables.ForEach(action: tag => wt |= tag);
                    return(wt);
                })() : ((Func <WorkTags>) delegate
                {
                    WorkTags wt = WorkTags.None;
                    Enum.GetValues(enumType: typeof(WorkTags)).Cast <WorkTags>().Where(predicate: tag => !this.workAllows.Contains(item: tag)).ToList().ForEach(action: tag => wt |= tag);
                    return(wt);
                })(),
                identifier       = this.defName,
                requiredWorkTags = ((Func <WorkTags>) delegate
                {
                    WorkTags wt = WorkTags.None;
                    this.requiredWorkTags.ForEach(action: tag => wt |= tag);
                    return(wt);
                })()
            };

            Traverse.Create(root: this.backstory).Field(name: "bodyTypeGlobalResolved").SetValue(value: this.bodyTypeGlobal);
            Traverse.Create(root: this.backstory).Field(name: "bodyTypeFemaleResolved").SetValue(value: this.bodyTypeFemale);
            Traverse.Create(root: this.backstory).Field(name: "bodyTypeMaleResolved").SetValue(value: this.bodyTypeMale);
            Traverse.Create(root: this.backstory).Field(name: nameof(this.skillGains)).SetValue(value: this.skillGains.ToDictionary(keySelector: i => i.defName, elementSelector: i => i.amount));

            UpdateTranslateableFields(bs: this);

            this.backstory.ResolveReferences();
            this.backstory.PostLoad();

            this.backstory.identifier = this.defName;

            IEnumerable <string> errors;

            if (!(errors = this.backstory.ConfigErrors(ignoreNoSpawnCategories: false)).Any())
            {
                BackstoryDatabase.AddBackstory(bs: this.backstory);
            }
            else
            {
                Log.Error(text: this.defName + " has errors:\n" + string.Join(separator: "\n", value: errors.ToArray()));
            }
        }
 static ConstructBackstories()
 {
     LongEventHandler.ExecuteWhenFinished(() =>
     {
         childhood = new Backstory()
         {
             title        = "Artificial Construct",
             titleShort   = "Construct",
             identifier   = "ConstructBackstoryC",
             workDisables = WorkTags.Social,
             slot         = BackstorySlot.Childhood,
             baseDesc     = ""
         };
         BackstoryDatabase.AddBackstory(childhood);
         adulthood = new Backstory()
         {
             title        = "Artificial Construct",
             titleShort   = "Construct",
             identifier   = "ConstructBackstoryA",
             workDisables = WorkTags.Social,
             slot         = BackstorySlot.Adulthood,
             baseDesc     = ""
         };
         BackstoryDatabase.AddBackstory(adulthood);
     });
 }
 static DroneBackstories()
 {
     LongEventHandler.ExecuteWhenFinished(() =>
     {
         childhood = new Backstory()
         {
             title        = "PRFDroneName".Translate(),
             titleShort   = "PRFDroneName".Translate(),
             identifier   = "PRFNoneBracketsC",
             workDisables = WorkTags.Social,
             slot         = BackstorySlot.Childhood,
             baseDesc     = "NoneBrackets".Translate()
         };
         BackstoryDatabase.AddBackstory(childhood);
         adulthood = new Backstory()
         {
             title        = "PRFDroneName".Translate(),
             titleShort   = "PRFDroneName".Translate(),
             identifier   = "PRFNoneBracketsA",
             workDisables = WorkTags.Social,
             slot         = BackstorySlot.Adulthood,
             baseDesc     = "NoneBrackets".Translate()
         };
         BackstoryDatabase.AddBackstory(adulthood);
     });
 }
        private static void CheckAllInjected()
        {
            // Thanks to all modders out there for providing help and support.
            // This is just for me.
            Backstory childMe = new Backstory
            {
                bodyTypeMale   = BodyType.Male,
                bodyTypeFemale = BodyType.Female,
                slot           = BackstorySlot.Childhood,
                baseDesc       =
                    "NAME never believed what was common sense and always doubted other people. HECAP later went on inflating toads with HIS sushi stick. It was there HE earned HIS nickname.",
                requiredWorkTags = WorkTags.Violent,
                shuffleable      = false
            };

            childMe.SetTitle("Lost child");
            childMe.SetTitleShort("Seeker");
            childMe.skillGains.Add("Shooting", 4);
            childMe.skillGains.Add("Medicine", 2);
            childMe.skillGains.Add("Social", 1);
            childMe.PostLoad();
            childMe.ResolveReferences();

            Backstory adultMale = new Backstory
            {
                bodyTypeMale   = BodyType.Male,
                bodyTypeFemale = BodyType.Female,
                slot           = BackstorySlot.Adulthood,
                baseDesc       =
                    "HECAP tells no one about his past. HECAP doesn't like doctors, thus HECAP prefers to tend his wounds himself.",
                shuffleable     = false,
                spawnCategories = new List <string>()
            };

            adultMale.spawnCategories.AddRange(new[] { "Civil", "Raider", "Slave", "Trader", "Traveler" });
            adultMale.SetTitle("Lone gunman");
            adultMale.SetTitleShort("Gunman");
            adultMale.skillGains.Add("Shooting", 4);
            adultMale.skillGains.Add("Medicine", 3);
            adultMale.skillGains.Add("Cooking", 2);
            adultMale.skillGains.Add("Social", 1);
            adultMale.PostLoad();
            adultMale.ResolveReferences();

            PawnBio me = new PawnBio
            {
                childhood = childMe,
                adulthood = adultMale,
                gender    = GenderPossibility.Male,
                name      = NameTriple.FromString("Gator 'Killface' Stinkwater")
            };

            me.PostLoad();
            SolidBioDatabase.allBios.Add(me);
            BackstoryDatabase.AddBackstory(childMe);

            BackstoryDatabase.AddBackstory(adultMale);
        }
Beispiel #9
0
        public static void Inject()
        {
            Log.Message("Injecting backstories...");

            if (toSave == null || toSave.Count == 0)
            {
                Log.Message("No custom stories found...");
                return;
            }

            foreach (var story in toSave)
            {
                Backstory bStory = new Backstory()
                {
                    identifier         = story.identifier,
                    title              = story.title,
                    titleShort         = story.titleShort,
                    titleFemale        = story.titleFemale,
                    titleShortFemale   = story.titleShortFemale,
                    skillGainsResolved = story.skillGainsResolved,
                    baseDesc           = story.baseDesc,
                    workDisables       = story.workDisables,
                    requiredWorkTags   = story.requiredWorkTags,
                    forcedTraits       = new List <TraitEntry>(),
                    disallowedTraits   = new List <TraitEntry>()
                };
                if (story.traitData != null)
                {
                    foreach (var t in story.traitData)
                    {
                        if (t.status == 1)
                        {
                            bStory.forcedTraits.Add(new TraitEntry(t.traitDef, t.degreeInt));
                        }
                        if (t.status == 2)
                        {
                            bStory.disallowedTraits.Add(new TraitEntry(t.traitDef, t.degreeInt));
                        }
                    }
                }

                bStory.PostLoad();

                if (BackstoryDatabase.allBackstories.Keys.Contains(bStory.identifier))
                {
                    BackstoryDatabase.allBackstories.Remove(bStory.identifier);
                }

                BackstoryDatabase.AddBackstory(bStory);
            }

            Log.Message($"Loaded {toSave.Count} custom stories");
        }
Beispiel #10
0
        private static bool AddBackstoryToDatabase(Backstory backstory)
        {
            bool keyFound = BackstoryDatabase.allBackstories.ContainsKey(backstory.identifier);

            //Log.Error("Adding Key:" + backstory.identifier + "// keyFound:" + keyFound.ToString());

            if (!keyFound)
            {
                BackstoryDatabase.AddBackstory(backstory);
            }

            return(!keyFound);
        }
Beispiel #11
0
        public override void ResolveReferences()
        {
            Dictionary <SkillDef, int> skills = new Dictionary <SkillDef, int>();

            base.ResolveReferences();
            foreach (skillGains skillGains in this.skillGains)
            {
                if (!skills.ContainsKey(skillGains.skill))
                {
                    skills.Add(skillGains.skill, skillGains.amount);
                }
            }
            foreach (traitList traitItem in forcedTraits)
            {
                traitsToForce.Add(new TraitEntry(traitItem.def, traitItem.degree));
            }
            this.story = new Backstory
            {
                slot               = this.backstorySlot,
                title              = this.title,
                titleFemale        = this.femaleTitle,
                titleShort         = this.shortTitle,
                titleShortFemale   = this.shortFemaleTitle,
                identifier         = this.defName,
                baseDesc           = this.storyDesc,
                spawnCategories    = this.spawnInCategories,
                skillGainsResolved = skills,
                forcedTraits       = this.traitsToForce,
                disallowedTraits   = this.traitsToDisable,

                workDisables = ((Func <WorkTags>) delegate {
                    WorkTags work = WorkTags.None;
                    Enum.GetValues(typeof(WorkTags)).Cast <WorkTags>().Where(tag =>
                                                                             ((!enabledWorkTypes.NullOrEmpty() && !enabledWorkTypes.Contains(tag)) ||
                                                                              disabledWorkTypes.Contains(tag)) &&
                                                                             (!(disabledWorkTypes.Contains(WorkTags.AllWork)) && !(tag == WorkTags.AllWork))
                                                                             ).ToList().ForEach(tag => work |= tag);
                    return(work);
                })(),
                shuffleable = this.shuffable
            };


            BackstoryDatabase.AddBackstory(story);
            //Log.Message("created story: " + this.defName);
        }
Beispiel #12
0
 public static bool Prefix()
 {
     PawnBioAndBacktoryUtility.duplicateCount      = new Dictionary <string, int>();
     PawnBioAndBacktoryUtility.pendingResolveNames = new Dictionary <string, NameTriple>();
     foreach (PawnBio curPawnBio in DirectXmlLoader.LoadXmlDataInResourcesFolder <PawnBio>("Backstories/Solid"))
     {
         string curDefName = curPawnBio.name.ToDefName(curPawnBio.gender);
         if (PawnBioAndBacktoryUtility.duplicateCount.ContainsKey(curDefName))
         {
             PawnBioAndBacktoryUtility.duplicateCount[curDefName]++;
             curDefName += "_" + PawnBioAndBacktoryUtility.duplicateCount[curDefName];
         }
         else
         {
             PawnBioAndBacktoryUtility.duplicateCount.Add(curDefName, 0);
         }
         PawnBioAndBacktoryUtility.pendingResolveNames.Add(curDefName, curPawnBio.name);
         if (curPawnBio.childhood == null || curPawnBio.adulthood == null)
         {
             PawnNameDatabaseSolid.AddPlayerContentName(curPawnBio.name, curPawnBio.gender);
         }
         else
         {
             curPawnBio.PostLoad();
             curPawnBio.ResolveReferences();
             foreach (string curError in curPawnBio.ConfigErrors())
             {
                 Log.Error(curError);
             }
             SolidBioDatabase.allBios.Add(curPawnBio);
             curPawnBio.childhood.shuffleable = false;
             curPawnBio.childhood.slot        = BackstorySlot.Childhood;
             BackstoryDatabase.AddBackstory(curPawnBio.childhood);
             curPawnBio.adulthood.shuffleable = false;
             curPawnBio.adulthood.slot        = BackstorySlot.Adulthood;
             BackstoryDatabase.AddBackstory(curPawnBio.adulthood);
         }
     }
     return(false);
 }
 public static void Add(Backstory b)
 {
     BackstoryDatabase.AddBackstory(b);
 }
        public override void ResolveReferences()
        {
            base.ResolveReferences();

            if (!this.addToDatabase)
            {
                return;
            }
            if (BackstoryDatabase.allBackstories.ContainsKey(this.UniqueSaveKey()))
            {
                return;
            }

            Backstory b = new Backstory();

            if (!this.title.NullOrEmpty())
            {
                b.SetTitle(this.title, this.title);
            }
            else
            {
                return;
            }
            if (!titleShort.NullOrEmpty())
            {
                b.SetTitleShort(titleShort, titleShort);
            }
            else
            {
                b.SetTitleShort(b.title, b.title);
            }

            if (!baseDescription.NullOrEmpty())
            {
                b.baseDesc = baseDescription;
            }
            else
            {
                b.baseDesc = "Empty.";
            }

            // [B19] These are now private variables.
            Traverse.Create(b).Field("bodyTypeGlobal").SetValue(bodyTypeGlobal);
            Traverse.Create(b).Field("bodyTypeMale").SetValue(bodyTypeMale);
            Traverse.Create(b).Field("bodyTypeFemale").SetValue(bodyTypeFemale);

            b.slot = slot;

            b.shuffleable = shuffleable;
            if (spawnCategories.NullOrEmpty())
            {
                return;
            }
            else
            {
                b.spawnCategories = spawnCategories;
            }

            if (workAllows.Count > 0)
            {
                foreach (WorkTags current in Enum.GetValues(typeof(WorkTags)))
                {
                    if (!workAllows.Contains(current))
                    {
                        b.workDisables |= current;
                    }
                }
            }
            else if (workDisables.Count > 0)
            {
                foreach (var tag in workDisables)
                {
                    b.workDisables |= tag;
                }
            }
            else
            {
                b.workDisables = WorkTags.None;
            }
            Dictionary <string, int> skGains = skillGains.ToDictionary(i => i.defName, i => i.amount);

            foreach (KeyValuePair <string, int> current in skGains)
            {
                b.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed(current.Key, true), current.Value);
            }

            if (forcedTraits.Count > 0)
            {
                b.forcedTraits = new List <TraitEntry>();
                foreach (var trait in forcedTraits)
                {
                    var newTrait = new TraitEntry(trait.def, trait.degree);
                    b.forcedTraits.Add(newTrait);
                }
            }

            if (disallowedTraits.Count > 0)
            {
                b.disallowedTraits = new List <TraitEntry>();
                foreach (var trait in disallowedTraits)
                {
                    var newTrait = new TraitEntry(trait.def, trait.degree);
                    b.disallowedTraits.Add(newTrait);
                }
            }

            b.ResolveReferences();
            b.PostLoad();
            b.identifier = this.UniqueSaveKey();

            bool flag = false;

            foreach (var s in b.ConfigErrors(false))
            {
                if (!flag)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                BackstoryDatabase.AddBackstory(b);
                //Log.Message("Added " + this.UniqueSaveKey() + " backstory");
                //CCL_Log.Message("Added " + this.UniqueSaveKey() + " backstory", "Backstories");
            }
        }
Beispiel #15
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();


            if (!this.addToDatabase || BackstoryDatabase.allBackstories.ContainsKey(this.defName) || this.title.NullOrEmpty() || this.spawnCategories.NullOrEmpty())
            {
                return;
            }

            Backstory b = new Backstory()
            {
                baseDesc         = this.baseDescription.NullOrEmpty() ? "Empty." : this.baseDescription,
                bodyTypeGlobal   = this.bodyTypeGlobal,
                bodyTypeFemale   = this.bodyTypeFemale,
                bodyTypeMale     = this.bodyTypeMale,
                slot             = this.slot,
                shuffleable      = this.shuffleable,
                spawnCategories  = this.spawnCategories,
                skillGains       = this.skillGains.ToDictionary(i => i.defName, i => i.amount),
                forcedTraits     = this.forcedTraits.NullOrEmpty() ? null : this.forcedTraits.Where(trait => Rand.Range(0, 100) < trait.chance).ToList().ConvertAll(trait => new TraitEntry(TraitDef.Named(trait.defname), trait.degree)),
                disallowedTraits = this.disallowedTraits.NullOrEmpty() ? null : this.disallowedTraits.Where(trait => Rand.Range(0, 100) < trait.chance).ToList().ConvertAll(trait => new TraitEntry(TraitDef.Named(trait.defname), trait.degree)),
                workDisables     = this.workAllows.NullOrEmpty() ? this.workDisables.NullOrEmpty() ? WorkTags.None : ((Func <WorkTags>) delegate
                {
                    WorkTags wt = WorkTags.None;
                    this.workDisables.ForEach(tag => wt |= tag);
                    return(wt);
                })() : ((Func <WorkTags>) delegate
                {
                    WorkTags wt = WorkTags.None;
                    Enum.GetValues(typeof(WorkTags)).Cast <WorkTags>().ToList().ForEach(tag => { if (this.workAllows.Contains(tag))
                                                                                                 {
                                                                                                     wt |= tag;
                                                                                                 }
                                                                                        });
                    return(wt);
                })(),
                identifier = this.defName
            };

            b.SetTitle(this.title);
            if (!this.titleShort.NullOrEmpty())
            {
                b.SetTitleShort(this.titleShort);
            }
            else
            {
                b.SetTitleShort(b.Title);
            }

            b.ResolveReferences();
            b.PostLoad();

            b.identifier = this.defName;

            IEnumerable <string> errors;

            if (!(errors = b.ConfigErrors(false)).Any())
            {
                BackstoryDatabase.AddBackstory(b);
            }
            else
            {
                Log.Error(this.defName + " has errors: " + string.Join("\n", errors.ToArray()));
            }
        }
Beispiel #16
0
        public static void init()
        {
            {
                Backstory bs = new Backstory();
                bs.identifier = "";                 // identifier will be set by ResolveReferences
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_vatgrown_sex_slave");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Vat-Grown Sex Slave", "Vat-Grown Sex Slave");
                    bs.SetTitleShort("SexSlave", "SexSlave");
                    bs.baseDesc = "NAME is made as a sex machine, rather than a human.During HIS growing period in the factory, HE was taught plenty of social skills and sex skills, just to satisfy various sex demands.";
                }
                // bs.skillGains = new Dictionary<string, int> ();
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Social"), 8);
                // bs.skillGainsResolved = new Dictionary<SkillDef, int> (); // populated by ResolveReferences
                bs.workDisables     = WorkTags.Intellectual;
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Childhood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                //bs.bodyTypeFemale = BodyType.Female;
                //bs.bodyTypeMale = BodyType.Thin;
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                child.vatgrown_sex_slave = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed0");
            }
            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_feisty");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Feisty Nymph", "Feisty Nymph");
                    bs.SetTitleShort("Nymph", "Nymph");
                    bs.baseDesc = "NAME struts around the colony like a conqueror examining a newly annexed territory. You try to focus on your work but HE won't let you.";
                }
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Social"), -3);
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Shooting"), 2);
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Melee"), 9);
                bs.workDisables     = (WorkTags.Cleaning | WorkTags.Animals | WorkTags.Caring | WorkTags.Artistic | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.feisty = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed1");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_curious");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Curious Nymph", "Curious Nymph");
                    bs.SetTitleShort("Nymph", "Nymph");
                    bs.baseDesc = "Hold the covering plate back and place the actuator in slot C. Line the rod up. No, that won't do, it needs to be perfect. Now pop the JC-444 chip in place.";
                }
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Construction"), 2);
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Crafting"), 6);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Artistic | WorkTags.Caring | WorkTags.Cooking | WorkTags.Mining | WorkTags.PlantWork | WorkTags.Violent | WorkTags.ManualDumb);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.curious = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed2");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_tender");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Tender Nymph", "Tender Nymph");
                    bs.SetTitleShort("Nymph", "Nymph");
                    bs.baseDesc = "NAME has a pair of charming eyes, and HIS voice is soft and sweet. Due to HIS previous nurse job, HE tends people quite well.";
                }
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Medicine"), 4);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Artistic | WorkTags.Hauling | WorkTags.Violent | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.tender = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed3");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_chatty");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Chatty Nymph", "Chatty Nymph");
                    bs.SetTitleShort("Nymph", "Nymph");
                    bs.baseDesc = "No one can be more loquacious than NAME. HECAP has a flexible tongue, a sharp mind, and hot lips.";
                }
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Social"), 6);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Caring | WorkTags.Artistic | WorkTags.Violent | WorkTags.ManualDumb | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.chatty = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed4");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_broken");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label, MTdef.label);
                    bs.SetTitleShort(MTdef.stringA, MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Broken Nymph", "Broken Nymph");
                    bs.SetTitleShort("Nymph", "Nymph");
                    bs.baseDesc = "Maybe NAME suffered some terrible Things, HE looks rather emaciated, and no one wants to speak with HIM.\nHECAP only behaves a bit vivaciously while staring at some rod-like stuffs.";
                }
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Social"), -5);
                bs.skillGainsResolved.Add(DefDatabase <SkillDef> .GetNamed("Artistic"), 8);
                bs.workDisables     = (WorkTags.Cleaning | WorkTags.Animals | WorkTags.Caring | WorkTags.Violent | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I Think)
                Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin");
                Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin);
                Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin);
                bs.forcedTraits = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.broken = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed5");
            }
        }
Beispiel #17
0
        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);
            }
        }
Beispiel #18
0
        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);
            }
        }
Beispiel #19
0
        private void SaveBacktoryToWorld()
        {
            WorkTags blockTags = WorkTags.None;
            WorkTags reqTags   = WorkTags.None;

            foreach (var tag in workStatus)
            {
                if (tag.Value == 1)
                {
                    blockTags |= tag.Key;
                }
                else if (tag.Value == 2)
                {
                    reqTags |= tag.Key;
                }
            }
            blockTags ^= WorkTags.None;
            reqTags   ^= WorkTags.None;

            story.workDisables     = blockTags;
            story.requiredWorkTags = reqTags;

            story.forcedTraits     = new List <TraitEntry>();
            story.disallowedTraits = new List <TraitEntry>();

            foreach (var trait in traitEntrys)
            {
                if (trait.status == 1)
                {
                    story.forcedTraits.Add(trait.trait);
                }
                else if (trait.status == 2)
                {
                    story.disallowedTraits.Add(trait.trait);
                }
            }

            if (!edit)
            {
                story.PostLoad();
                int    num = Mathf.Abs(GenText.StableStringHash(story.baseDesc) % 100);
                string s   = story.title.Replace('-', ' ');
                s = GenText.CapitalizedNoSpaces(s);
                story.identifier = GenText.RemoveNonAlphanumeric(s) + num.ToString();

                BackstoryDatabase.AddBackstory(story);

                CustomBacktories.CustomStories.Add(story);

                CreateNew();
            }
            else
            {
                if (!CustomBacktories.CustomStories.Contains(story))
                {
                    CustomBacktories.CustomStories.Add(story);
                }
            }

            if (!onlyCreate)
            {
                PawnMenu.RecacheSkillsData();
            }

            Messages.Message($"Success", MessageTypeDefOf.NeutralEvent);
        }
Beispiel #20
0
        public override void ResolveReferences()
        {
            if (BackstoryDatabase.allBackstories.ContainsKey(this.saveKeyIdentifier))
            {
                Log.Error(this.defName + " contains a saveKeyIdentifier value " + saveKeyIdentifier + " which is used already. It won't be added as a def. Make sure that the identifier is unique.");
                return;
            }

            Backstory backstory = new Backstory();

            if (this.forcedTraits?.Any() ?? false)
            {
                backstory.forcedTraits = new List <TraitEntry>();
                foreach (var trait in this.forcedTraits.Where(x => Rand.RangeInclusive(0, 100) < x.chance))
                {
                    backstory.forcedTraits.Add(new TraitEntry(trait.defName, trait.degree));
                }
            }

            if (this.disallowedTraits?.Any() ?? false)
            {
                backstory.disallowedTraits = new List <TraitEntry>();
                foreach (var trait in this.disallowedTraits.Where(x => Rand.RangeInclusive(0, 100) < x.chance))
                {
                    backstory.disallowedTraits.Add(new TraitEntry(trait.defName, trait.degree));
                }
            }

            backstory.SetTitle(this.title, this.title);
            if (!GenText.NullOrEmpty(this.titleShort))
            {
                backstory.SetTitleShort(this.titleShort, this.titleShort);
            }
            else
            {
                backstory.SetTitleShort(backstory.title, backstory.title);
            }
            if (!GenText.NullOrEmpty(this.baseDescription))
            {
                backstory.baseDesc = this.baseDescription;
            }

            Traverse.Create(backstory).Field("bodyTypeGlobal").SetValue(this.bodyTypeGlobal);
            Traverse.Create(backstory).Field("bodyTypeMale").SetValue(this.bodyTypeMale);
            Traverse.Create(backstory).Field("bodyTypeFemale").SetValue(this.bodyTypeFemale);
            if (skillGains?.Any() ?? false)
            {
                var skillGainsDict = skillGains.ToDictionary(x => x.skill.defName, y => y.minLevel);
                Traverse.Create(backstory).Field("skillGains").SetValue(skillGainsDict);
            }

            backstory.slot            = this.slot;
            backstory.shuffleable     = this.shuffleable;
            backstory.spawnCategories = this.spawnCategories;

            if (this.workDisables.Any())
            {
                foreach (var workTag in this.workDisables)
                {
                    backstory.workDisables |= workTag;
                }
            }
            else
            {
                backstory.workDisables = WorkTags.None;
            }

            backstory.PostLoad();
            backstory.ResolveReferences();
            backstory.identifier = this.saveKeyIdentifier;

            if (!backstory.ConfigErrors(true).Any())
            {
                BackstoryDatabase.AddBackstory(backstory);
            }
            else
            {
                foreach (var err in backstory.ConfigErrors(true))
                {
                    Log.Error(backstory + " - " + err);
                }
            }
        }
Beispiel #21
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();

            WorkTags workDisables = WorkTags.None;

            if (this.workDisables != null)
            {
                this.workDisables.ForEach(x => workDisables |= x);
            }

            WorkTags requiredWorkTags = WorkTags.None;

            if (this.requiredWorkTags != null)
            {
                this.requiredWorkTags.ForEach(x => requiredWorkTags |= x);
            }

            List <TraitEntry> forcedTraits = new List <TraitEntry>();

            if (this.forcedTraits != null)
            {
                this.forcedTraits.ForEach(x => forcedTraits.Add(new TraitEntry(x.traitDef, x.degree)));
            }

            List <TraitEntry> disallowedTraits = new List <TraitEntry>();

            if (this.disallowedTraits != null)
            {
                this.disallowedTraits.ForEach(x => disallowedTraits.Add(new TraitEntry(x.traitDef, x.degree)));
            }

            Dictionary <SkillDef, int> skillGainsResolved = new Dictionary <SkillDef, int>();

            if (skillGains != null)
            {
                skillGains.ForEach(x => skillGainsResolved.Add(x.skill, x.xp));
            }

            backstory = new Backstory
            {
                identifier = defName,

                slot            = slot,
                title           = backstoryTitle,
                titleShort      = backstoryTitleShort,
                baseDesc        = backstoryDescription,
                spawnCategories = spawnCategories,

                workDisables       = workDisables,
                requiredWorkTags   = requiredWorkTags,
                forcedTraits       = forcedTraits,
                disallowedTraits   = disallowedTraits,
                skillGainsResolved = skillGainsResolved
            };
            Traverse.Create(backstory).Field("bodyTypeMaleResolved").SetValue(BodyTypeDefOf.Male);
            Traverse.Create(backstory).Field("bodyTypeFemaleResolved").SetValue(BodyTypeDefOf.Female);
            backstory.ResolveReferences();
            backstory.PostLoad();

            IEnumerable <string> errors;

            if (!(errors = backstory.ConfigErrors(false)).Any())
            {
                BackstoryDatabase.AddBackstory(backstory);
            }
            else
            {
                Log.Error("====================================================================================================");
                Log.Error("[Garam, Race Addon] BackstoryDef has errors : " + defName + string.Join("\n", errors.ToArray()));
                Log.Error("====================================================================================================");
            }
        }
Beispiel #22
0
        public override void ResolveReferences()
        {
            base.ResolveReferences();

            if (!this.addToDatabase)
            {
                return;
            }
            if (BackstoryDatabase.allBackstories.ContainsKey(this.UniqueSaveKey()))
            {
                return;
            }

            Backstory b = new Backstory();

            if (!this.title.NullOrEmpty())
            {
                b.SetTitle(this.title);
            }
            else
            {
                return;
            }
            if (!titleShort.NullOrEmpty())
            {
                b.SetTitleShort(titleShort);
            }
            else
            {
                b.SetTitleShort(b.Title);
            }

            if (!baseDescription.NullOrEmpty())
            {
                b.baseDesc = baseDescription;
            }
            else
            {
                b.baseDesc = "Empty.";
            }

            b.bodyTypeGlobal = bodyTypeGlobal;
            b.bodyTypeMale   = bodyTypeMale;
            b.bodyTypeFemale = bodyTypeFemale;

            b.slot = slot;

            b.shuffleable = shuffleable;
            if (spawnCategories.NullOrEmpty())
            {
                return;
            }
            else
            {
                b.spawnCategories = spawnCategories;
            }

            if (workAllows.Count > 0)
            {
                foreach (WorkTags current in Enum.GetValues(typeof(WorkTags)))
                {
                    if (!workAllows.Contains(current))
                    {
                        b.workDisables |= current;
                    }
                }
            }
            else if (workDisables.Count > 0)
            {
                foreach (var tag in workDisables)
                {
                    b.workDisables |= tag;
                }
            }
            else
            {
                b.workDisables = WorkTags.None;
            }
            b.skillGains = skillGains.ToDictionary(i => i.defName, i => i.amount);

            if (forcedTraits.Count > 0)
            {
                b.forcedTraits = new List <TraitEntry>();
                foreach (var trait in forcedTraits)
                {
                    var newTrait = new TraitEntry(trait.def, trait.degree);
                    b.forcedTraits.Add(newTrait);
                }
            }

            if (disallowedTraits.Count > 0)
            {
                b.disallowedTraits = new List <TraitEntry>();
                foreach (var trait in disallowedTraits)
                {
                    var newTrait = new TraitEntry(trait.def, trait.degree);
                    b.disallowedTraits.Add(newTrait);
                }
            }

            b.ResolveReferences();
            b.PostLoad();

            bool flag = false;

            foreach (var s in b.ConfigErrors(false))
            {
                if (!flag)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                BackstoryDatabase.AddBackstory(b);
                //CCL_Log.Message("Added " + this.UniqueSaveKey() + " backstory", "Backstories");
            }
        }
        public override void ResolveReferences()
        {
            base.ResolveReferences();
            if (!this.addToDatabase)
            {
                return;
            }
            if (BackstoryDatabase.allBackstories.ContainsKey(this.saveKeyIdentifier))
            {
                return;
            }
            Backstory backstory = new Backstory();

            if (GenText.NullOrEmpty(this.title))
            {
                return;
            }
            backstory.SetTitle(this.title, this.title);
            if (!GenText.NullOrEmpty(this.titleShort))
            {
                backstory.SetTitleShort(this.titleShort, this.titleShort);
            }
            else
            {
                backstory.SetTitleShort(backstory.title, backstory.title);
            }
            if (!GenText.NullOrEmpty(this.baseDescription))
            {
                backstory.baseDesc = this.baseDescription;
            }
            else
            {
                backstory.baseDesc = "Empty.";
            }
            Traverse.Create(backstory).Field("bodyTypeGlobal").SetValue(this.bodyTypeGlobal);
            Traverse.Create(backstory).Field("bodyTypeMale").SetValue(this.bodyTypeMale);
            Traverse.Create(backstory).Field("bodyTypeFemale").SetValue(this.bodyTypeFemale);
            backstory.slot        = this.slot;
            backstory.shuffleable = this.shuffleable;
            if (GenList.NullOrEmpty <string>(this.spawnCategories))
            {
                return;
            }
            backstory.spawnCategories = this.spawnCategories;
            if (this.workDisables.Count > 0)
            {
                using (List <WorkTags> .Enumerator enumerator2 = this.workDisables.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        WorkTags workTags2 = enumerator2.Current;
                        backstory.workDisables |= workTags2;
                    }
                    goto IL_1E9;
                }
            }
            backstory.workDisables = 0;
IL_1E9:
            backstory.ResolveReferences();
            backstory.PostLoad();
            backstory.identifier = this.saveKeyIdentifier;
            bool flag = false;

            foreach (string text in backstory.ConfigErrors(false))
            {
                if (!flag)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                BackstoryDatabase.AddBackstory(backstory);
            }
        }
Beispiel #24
0
        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);
            }
        }
Beispiel #25
0
        static PostDefFixer()
        {
            //Add recipes to valid Genome Sequencing targets.
            foreach (ThingDef def in DefDatabase <ThingDef> .AllDefs.Where(def => def.category == ThingCategory.Pawn))
            {
                if (def.GetModExtension <RaceExclusionProperties>() is RaceExclusionProperties props)
                {
                    if (props.excludeThisRace)
                    {
                        GeneralCompatibility.excludedRaces.Add(def);
                    }

                    if (props.excludeTheseHediffs.Count > 0)
                    {
                        GeneralCompatibility.excludedHediffs.AddRange(props.excludeTheseHediffs);
                    }
                }

                if (def.IsValidGenomeSequencingTargetDef())
                {
                    if (def.recipes == null)
                    {
                        def.recipes = new List <RecipeDef>();
                    }
                    if (def.recipes.Count > 0)
                    {
                        def.recipes.Insert(0, QERecipeDefOf.QE_GenomeSequencing);
                    }
                    else
                    {
                        def.recipes.Add(QERecipeDefOf.QE_GenomeSequencing);
                    }
                }

                if (def.IsValidBrainScanningDef())
                {
                    if (def.recipes == null)
                    {
                        def.recipes = new List <RecipeDef>();
                    }
                    if (def.recipes.Count > 0)
                    {
                        def.recipes.Insert(0, QERecipeDefOf.QE_BrainScanning);
                    }
                    else
                    {
                        def.recipes.Add(QERecipeDefOf.QE_BrainScanning);
                    }
                }
            }

            //Inject our own backstories.
            foreach (BackstoryDef def in DefDatabase <BackstoryDef> .AllDefs)
            {
                Backstory backstory = new Backstory();
                backstory.slot             = def.slot;
                backstory.title            = def.title;
                backstory.titleShort       = def.titleShort;
                backstory.titleFemale      = def.titleFemale;
                backstory.titleShortFemale = def.titleShortFemale;
                backstory.baseDesc         = def.baseDesc;
                AccessTools.Field(typeof(Backstory), "bodyTypeFemale").SetValue(backstory, def.bodyTypeFemale);
                AccessTools.Field(typeof(Backstory), "bodyTypeMale").SetValue(backstory, def.bodyTypeMale);
                AccessTools.Field(typeof(Backstory), "bodyTypeGlobal").SetValue(backstory, def.bodyTypeGlobal);
                backstory.spawnCategories.AddRange(def.spawnCategories);
                backstory.PostLoad();
                backstory.ResolveReferences();

                BackstoryDatabase.AddBackstory(backstory);

                def.identifier = backstory.identifier;
                //Log.Message("'" + def.defName + "' identifier is '" + backstory.identifier + "'");
            }

            foreach (HediffDef def in DefDatabase <HediffDef> .AllDefs)
            {
                if (def.GetModExtension <HediffTemplateProperties>() is HediffTemplateProperties props)
                {
                    if (props.includeInBrainTemplate)
                    {
                        QEEMod.TryLog(def.defName + " added to list of Hediffs applied to brain templates");
                        GeneralCompatibility.includedBrainTemplateHediffs.Add(def);
                    }

                    if (props.includeInGenomeTemplate)
                    {
                        QEEMod.TryLog(def.defName + " added to list of Hediffs applied to genome templates");
                        GeneralCompatibility.includedGenomeTemplateHediffs.Add(def);
                    }
                }
            }
        }
Beispiel #26
0
        public static void init()
        {
            {
                Backstory bs = new Backstory();
                bs.identifier = "";                 // identifier will be set by ResolveReferences
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_vatgrown_sex_slave");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Vat-Grown Sex Slave");
                    bs.SetTitleShort("SexSlave");
                    bs.baseDesc = "NAME is made as a sex machine, rather than a human.During HIS growing period in the factory, HE was taught plenty of social skills and sex skills, just to satisfy various sex demands.";
                }
                // bs.skillGains = new Dictionary<string, int> ();
                bs.skillGains.Add("Social", 8);
                // bs.skillGainsResolved = new Dictionary<SkillDef, int> (); // populated by ResolveReferences
                bs.workDisables     = WorkTags.Intellectual;
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Childhood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                child.vatgrown_sex_slave = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed0");
            }
            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_feisty");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Feisty Nymph");
                    bs.SetTitleShort("Nymph");
                    bs.baseDesc = "NAME struts around the colony like a conqueror examining a newly annexed territory. You try to focus on your work but HE won't let you.\n" + "\"I heard what you said about me!\" HE accuses. You didn't say anything about HIM. HECAP knows that. " + "\"Wanna fight?\" HE challenges. You already know what HE means: a few minutes of play wrestling and then you take HIM, or, if you hesitate, HE takes you.\n" + "Though NAME can be hard to get along with you've come to appreciate how HE's more practical than the others.\n" + "You explain to HIM, \"See these things here? They need to be over there\" and \"Those people are trying to kill us, so let's kill them first.\" HECAP listens, and does what is necessary.";
                }
                bs.skillGains.Add("Social", -3);
                bs.skillGains.Add("Shooting", 4);
                bs.skillGains.Add("Melee", 6);
                bs.workDisables     = (WorkTags.Cleaning | WorkTags.Animals | WorkTags.Caring | WorkTags.Artistic | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.feisty = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed1");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_curious");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Curious Nymph");
                    bs.SetTitleShort("Nymph");
                    bs.baseDesc = "Hold the covering plate back and place the actuator in slot C. Line the rod up. No, that won't do, it needs to be perfect. Now pop the JC-444 chip in place. \n" + "Solder the orange wire to pin #16 and the striped wire to pin #5. \n" + "Suddenly, there HE is. You aren't surprised to see NAME, you just didn't hear HIM approach. By now you're used to it. \n" + "You continue your work in silence as HE hovers over you, her large eyes fixated on the rapid, rythmic, deliberate motions of your hands.";
                }
                bs.skillGains.Add("Construction", 2);
                bs.skillGains.Add("Crafting", 6);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Artistic | WorkTags.Caring | WorkTags.Cooking | WorkTags.Mining | WorkTags.PlantWork | WorkTags.Violent | WorkTags.ManualDumb);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.curious = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed2");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_tender");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Tender Nymph");
                    bs.SetTitleShort("Nymph");
                    bs.baseDesc = "NAME has a pair of charming eyes, and HIS voice is soft and sweet. Due to HIS previous nurse job, HE tends people quite well.\n" + "HE's crouched in the corner, hands over HIS ears and tears in HIS eyes." + "You don't understand, then you notice it: the distant sound of the pained squeals of pigs being slaughtered.";
                }
                bs.skillGains.Add("Medicine", 4);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Artistic | WorkTags.Hauling | WorkTags.Violent | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.tender = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed3");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_chatty");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Chatty Nymph");
                    bs.SetTitleShort("Nymph");
                    bs.baseDesc = "No one can be more loquacious than NAME. HECAP has a flexible tongue, a sharp mind, and hot lips.";
                }
                bs.skillGains.Add("Social", 6);
                bs.workDisables     = (WorkTags.Animals | WorkTags.Caring | WorkTags.Artistic | WorkTags.Violent | WorkTags.ManualDumb | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.chatty = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed4");
            }

            {
                Backstory bs = new Backstory();
                bs.identifier = "";
                MiscTranslationDef MTdef = DefDatabase <MiscTranslationDef> .GetNamedSilentFail("rjw_broken");

                if (MTdef != null)
                {
                    bs.SetTitle(MTdef.label);
                    bs.SetTitleShort(MTdef.stringA);
                    bs.baseDesc = MTdef.description;
                }
                else
                {
                    bs.SetTitle("Broken Nymph");
                    bs.SetTitleShort("Nymph");
                    bs.baseDesc = "Maybe NAME suffered some terrible things, HE looks rather emaciated, and no one wants to speak with HIM.\n" + "HECAP only behaves a bit vivaciously while staring at some rod-like stuffs.";
                }
                bs.skillGains.Add("Social", -5);
                bs.skillGains.Add("Artistic", 8);
                bs.workDisables     = (WorkTags.Cleaning | WorkTags.Animals | WorkTags.Caring | WorkTags.Violent | WorkTags.ManualSkilled);
                bs.requiredWorkTags = WorkTags.None;
                bs.slot             = BackstorySlot.Adulthood;
                bs.spawnCategories  = new List <string>()
                {
                    "rjw_nymphsCategory", "Slave"
                };                                                                                         // Not necessary (I think)
                bs.bodyTypeGlobal = BodyType.Thin;
                bs.bodyTypeFemale = BodyType.Female;
                bs.bodyTypeMale   = BodyType.Thin;
                bs.forcedTraits   = new List <TraitEntry>();
                bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0));
                bs.disallowedTraits = new List <TraitEntry>();
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0));
                bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0));
                bs.shuffleable = true;
                bs.ResolveReferences();
                BackstoryDatabase.AddBackstory(bs);
                adult.broken = bs;
                //--Log.Message("[RJW]nymph_backstories::init() succeed5");
            }
        }