public void ReadXML() { Thingdef_AlienRace thingdef_alienrace = this.def as Thingdef_AlienRace; if (thingdef_alienrace == null) { Log.Message("Could not read Alien ThingDef."); } if (!FirstSpawn) { if (thingdef_alienrace.CustomSkinColors == true) { alienskincolor = thingdef_alienrace.alienskincolorgen.NewRandomizedColor(); } else { alienskincolor = this.story.SkinColor; } if (thingdef_alienrace.NakedBodyGraphicLocation.NullOrEmpty()) { nakedbodytexpath = "Things/Pawn/Humanlike/Bodies/"; } else { nakedbodytexpath = thingdef_alienrace.NakedBodyGraphicLocation; } if (thingdef_alienrace.DesiccatedGraphicLocation.NullOrEmpty()) { dessicatedgraphicpath = "Things/Pawn/Humanlike/HumanoidDessicated"; } else { dessicatedgraphicpath = thingdef_alienrace.DesiccatedGraphicLocation; } if (thingdef_alienrace.SkullGraphicLocation.NullOrEmpty()) { skullgraphicpath = "Things/Pawn/Humanlike/Heads/None_Average_Skull"; } else { skullgraphicpath = thingdef_alienrace.SkullGraphicLocation; } switch (thingdef_alienrace.HasHair) { case AlienHairTypes.None: { HColor = Color.white; this.story.hairDef = DefDatabase <HairDef> .GetNamed("Shaved", true); TexPathHair = this.story.hairDef.texPath; break; } case AlienHairTypes.Custom: { TexPathHair = this.story.hairDef.texPath; if (thingdef_alienrace.alienhaircolorgen == null) { HColor = PawnHairColorsAlien.RandomHairColor(alienskincolor, this.ageTracker.AgeBiologicalYears, thingdef_alienrace.GetsGreyAt); } else { HColor = thingdef_alienrace.alienhaircolorgen.NewRandomizedColor(); } break; } case AlienHairTypes.Vanilla: { TexPathHair = this.story.hairDef.texPath; HColor = this.story.hairColor; break; } } if (thingdef_alienrace.NakedHeadGraphicLocation.NullOrEmpty()) { Log.Message(this.story.HeadGraphicPath); headtexpath = this.story.HeadGraphicPath; } else { headtexpath = thingdef_alienrace.alienpartgenerator.RandomAlienHead(thingdef_alienrace.NakedHeadGraphicLocation); } if (thingdef_alienrace.CustomDrawSize == null) { DrawSize = Vector2.one; } else { DrawSize = thingdef_alienrace.CustomDrawSize; } if (thingdef_alienrace.CustomGenderDistribution) { if (Rand.Range(0.1f, 0.9f) < thingdef_alienrace.MaleGenderProbability) { this.gender = Gender.Male; } else { this.gender = Gender.Female; } } if (thingdef_alienrace.PawnsSpecificBackstories) { backstoryflag = true; } } if (thingdef_alienrace.ForcedRaceTraitEntries != null) { fTraits = thingdef_alienrace.ForcedRaceTraitEntries; List <TraitDef> tlist = DefDatabase <TraitDef> .AllDefsListForReading; if (this.story.childhood.forcedTraits == null) { this.story.childhood.forcedTraits = new List <TraitEntry>(); } for (int i = 0; i < fTraits.Count; i++) { foreach (TraitDef tdef in tlist) { if (tdef.defName == fTraits[i].defname) { this.story.childhood.forcedTraits.Add(new TraitEntry(tdef, fTraits[i].degree)); } } } } this.def = thingdef_alienrace; FirstSpawn = true; MainThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId; }
public AlienKey(Thingdef_AlienRace race, List<Color> hairColors, List<Color> skinColors) { this.Race = race; this.AlienSkinColors = skinColors; this.AlienHairColors = hairColors; }