public override void PostLoad() { var mod = ( from m in LoadedModManager.RunningMods where m.Name == requiredMod select m ).FirstOrDefault(); if (mod == null) { #if DEBUG Log.Message("Miniaturisation :: Skipping " + requiredMod); #endif return; } Log.Message("Miniaturisation :: Found " + requiredMod + " (" + targetsDefNames.Count + ")"); var things = ( from m in LoadedModManager.RunningMods from def in m.AllDefs where targetsDefNames.Contains(def.defName) && def.GetType() == typeof(ThingDef) select def ); foreach (Def thing in things) { #if DEBUG Log.Message("> " + thing.defName); #endif DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(thing, thingDef_minifiedDef, "MinifiedFurniture"); } }
public IncidentProperties() { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "category", "ThreatSmall"); DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "letterDef", "NeutralEvent"); DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "raidStrategy", "ImmediateAttack"); DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "faction", "Pirate"); DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "arriveMode", "EdgeWalkIn"); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured SkillPair: " + xmlRoot.OuterXml); return; } DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "skill", xmlRoot.Name); value = ParseHelper.FromString <float>(xmlRoot.FirstChild.Value); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured PawnKindDefCountClass: " + xmlRoot.OuterXml); return; } DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "thingDef", xmlRoot.Name); count = ParseHelper.FromString <int>(xmlRoot.FirstChild.Value); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured StartingGoodwillByFaction: " + xmlRoot.OuterXml); return; } DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "factionDef", xmlRoot.Name); startingGoodwill = ParseHelper.FromString <IntRange>(xmlRoot.FirstChild.Value); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured AmmoLink: " + xmlRoot.OuterXml); return; } DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "ammo", xmlRoot.Name); DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "projectile", (string)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(string))); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured MTBByBiome: " + xmlRoot.OuterXml, false); return; } DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "biome", xmlRoot.Name); this.mtbDays = (float)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(float)); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured IngredientAndCostClass: " + xmlRoot.OuterXml, false); return; } DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "thingDef", xmlRoot.Name); this.nutritionCost = ParseHelper.FromString <float>(xmlRoot.FirstChild.Value); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured StuffedSound: " + xmlRoot.OuterXml); return; } DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "stuffCategory", xmlRoot.Name); DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "sound", xmlRoot.FirstChild.Value); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured ThingValue: " + xmlRoot.OuterXml); return; } DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "thingCatDef", xmlRoot.Name); this.value = (float)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(float)); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured HediffPath: " + xmlRoot.OuterXml, false); return; } DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "hediffDef", xmlRoot.Name); this.path = xmlRoot.FirstChild.Value; }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured StuffCategoryCountClass: " + xmlRoot.OuterXml, false); } else { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "stuffCatDef", xmlRoot.Name); this.count = (int)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(int)); } }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured BodyPartGroupMultiplier: " + xmlRoot.OuterXml, false); //TODO: rewrite ULog and call it here } else { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "bpgd", xmlRoot.Name, null, null); multiplier = ParseHelper.FromString <float>(xmlRoot.FirstChild.Value); } }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "recipe", xmlRoot.Name, null, null); if (xmlRoot.Attributes["Effecter"] != null) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "effecter", xmlRoot.Attributes["Effecter"].Value, null, null); } if (xmlRoot.Attributes["Sound"] != null) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "sound", xmlRoot.Attributes["Sound"].Value, null, null); } }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "trait", xmlRoot.Name); if (xmlRoot.HasChildNodes) { this.degree = (int)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(int)); } else { this.degree = 0; } }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "def", xmlRoot.Name, null, null); if (xmlRoot.Attributes["Weight"] != null) { float.TryParse(xmlRoot.Attributes["Weight"].Value, out this.weight); } if (xmlRoot.Attributes["Count"] != null) { int.TryParse(xmlRoot.Attributes["Count"].Value, out this.count); } }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.Name != "li") { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "building", xmlRoot); offset = ParseHelper.FromString <float>(xmlRoot.FirstChild.Value); } else { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "building", xmlRoot.InnerText); offset = float.MinValue; } }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "def", xmlRoot.Name); string Child = Regex.Replace(xmlRoot.FirstChild.Value, @"\s+", ""); string[] array = Child.Split(new char[] { ',' }); DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "skyfaller", array[0]); if (array.Count() == 2) { chance = (float)ParseHelper.FromString(array[1], typeof(float)); } }
public override void PostLoad() { base.PostLoad(); if (this.products == null) { var thingCountClass = new ThingDefCountClass(); DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(thingCountClass, "thingDef", "Mizu_NormalWater"); thingCountClass.count = 1; this.products = new List <ThingDefCountClass>() { thingCountClass, }; } }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "thingDef", xmlRoot.Name); XmlNodeList childNodes = xmlRoot.ChildNodes; if (childNodes.Count >= 1) { foreach (XmlNode node in childNodes) { #if DEBUG Log.Message(xmlRoot.Name + "HybridInfo: " + node.Name + " " + node.InnerText); #endif hybridInfo.Add(node.Name, ParseHelper.FromString <float>(node.InnerText)); } } }
private void ReadThingCondition(string s, out string defName) { defName = null; if (s.Contains(",")) { string[] array = s.Split(','); defName = array[0]; QualityCategory = (QualityCategory)ParseHelper.FromString(array[1], typeof(QualityCategory)); CustomQuality = true; if (s.Where(c => c == ',').Count() == 2) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "Stuff", array[2]); } return; } defName = s; }
// Token: 0x06000012 RID: 18 RVA: 0x00002354 File Offset: 0x00000554 public void LoadDataFromXmlCustom(XmlNode xmlRoot) { if (xmlRoot.ChildNodes.Count != 1) { Log.Error("Misconfigured ThingOrderRequest: " + xmlRoot.OuterXml); return; } if (xmlRoot.Name.ToLower() == "nutrition") { nutrition = true; } else { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "thingDef", xmlRoot.Name); } amount = (float)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(float)); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { XmlAttribute mayRequire = xmlRoot.Attributes[name : "MayRequire"]; int index = mayRequire != null?xmlRoot.Name.LastIndexOf(value : '\"') + 1 : 0; DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, nameof(this.hediff), xmlRoot.Name.Substring(index, xmlRoot.Name.Length - index), mayRequire?.Value.ToLower()); this.path = xmlRoot.FirstChild.Value?.Trim(); Traverse traverse = Traverse.Create(this); foreach (XmlNode xmlRootChildNode in xmlRoot.ChildNodes) { Traverse field = traverse.Field(xmlRootChildNode.Name); if (field.FieldExists()) { field.SetValue(field.GetValueType().IsGenericType ? DirectXmlToObject.GetObjectFromXmlMethod(field.GetValueType())(xmlRootChildNode, arg2: false) : xmlRootChildNode.InnerXml.Trim()); } } }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, nameof(this.bodyType), xmlRoot.Name); this.offset = (Vector2)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(Vector2)); }
// Token: 0x060034E5 RID: 13541 RVA: 0x00121E03 File Offset: 0x00120003 public static IEnumerable <ThingDef> ImpliedCorpseDefs() { foreach (ThingDef thingDef in DefDatabase <ThingDef> .AllDefs.ToList <ThingDef>()) { if (thingDef.category == ThingCategory.Pawn) { ThingDef thingDef2 = new ThingDef(); thingDef2.category = ThingCategory.Item; thingDef2.thingClass = typeof(Corpse); thingDef2.selectable = true; thingDef2.tickerType = TickerType.Rare; thingDef2.altitudeLayer = AltitudeLayer.ItemImportant; thingDef2.scatterableOnMapGen = false; thingDef2.SetStatBaseValue(StatDefOf.Beauty, -50f); thingDef2.SetStatBaseValue(StatDefOf.DeteriorationRate, 1f); thingDef2.SetStatBaseValue(StatDefOf.FoodPoisonChanceFixedHuman, 0.05f); thingDef2.alwaysHaulable = true; thingDef2.soundDrop = SoundDefOf.Corpse_Drop; thingDef2.pathCost = 15; thingDef2.socialPropernessMatters = false; thingDef2.tradeability = Tradeability.None; thingDef2.messageOnDeteriorateInStorage = false; thingDef2.inspectorTabs = new List <Type>(); thingDef2.inspectorTabs.Add(typeof(ITab_Pawn_Health)); thingDef2.inspectorTabs.Add(typeof(ITab_Pawn_Character)); thingDef2.inspectorTabs.Add(typeof(ITab_Pawn_Gear)); thingDef2.inspectorTabs.Add(typeof(ITab_Pawn_Social)); thingDef2.inspectorTabs.Add(typeof(ITab_Pawn_Log)); thingDef2.comps.Add(new CompProperties_Forbiddable()); thingDef2.recipes = new List <RecipeDef>(); if (!thingDef.race.IsMechanoid) { thingDef2.recipes.Add(RecipeDefOf.RemoveBodyPart); } thingDef2.defName = "Corpse_" + thingDef.defName; thingDef2.label = "CorpseLabel".Translate(thingDef.label); thingDef2.description = "CorpseDesc".Translate(thingDef.label); thingDef2.soundImpactDefault = thingDef.soundImpactDefault; thingDef2.SetStatBaseValue(StatDefOf.MarketValue, ThingDefGenerator_Corpses.CalculateMarketValue(thingDef)); thingDef2.SetStatBaseValue(StatDefOf.Flammability, thingDef.GetStatValueAbstract(StatDefOf.Flammability, null)); thingDef2.SetStatBaseValue(StatDefOf.MaxHitPoints, (float)thingDef.BaseMaxHitPoints); thingDef2.SetStatBaseValue(StatDefOf.Mass, thingDef.statBases.GetStatOffsetFromList(StatDefOf.Mass)); thingDef2.SetStatBaseValue(StatDefOf.Nutrition, 5.2f); thingDef2.modContentPack = thingDef.modContentPack; thingDef2.ingestible = new IngestibleProperties(); thingDef2.ingestible.parent = thingDef2; IngestibleProperties ingestible = thingDef2.ingestible; ingestible.foodType = FoodTypeFlags.Corpse; ingestible.sourceDef = thingDef; ingestible.preferability = (thingDef.race.IsFlesh ? FoodPreferability.DesperateOnly : FoodPreferability.NeverForNutrition); DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(ingestible, "tasteThought", ThoughtDefOf.AteCorpse.defName, null, null); ingestible.maxNumToIngestAtOnce = 1; ingestible.ingestEffect = EffecterDefOf.EatMeat; ingestible.ingestSound = SoundDefOf.RawMeat_Eat; ingestible.specialThoughtDirect = thingDef.race.FleshType.ateDirect; if (thingDef.race.IsFlesh) { CompProperties_Rottable compProperties_Rottable = new CompProperties_Rottable(); compProperties_Rottable.daysToRotStart = 2.5f; compProperties_Rottable.daysToDessicated = 5f; compProperties_Rottable.rotDamagePerDay = 2f; compProperties_Rottable.dessicatedDamagePerDay = 0.7f; thingDef2.comps.Add(compProperties_Rottable); CompProperties_SpawnerFilth compProperties_SpawnerFilth = new CompProperties_SpawnerFilth(); compProperties_SpawnerFilth.filthDef = ThingDefOf.Filth_CorpseBile; compProperties_SpawnerFilth.spawnCountOnSpawn = 0; compProperties_SpawnerFilth.spawnMtbHours = 0f; compProperties_SpawnerFilth.spawnRadius = 0.1f; compProperties_SpawnerFilth.spawnEveryDays = 1f; compProperties_SpawnerFilth.requiredRotStage = new RotStage?(RotStage.Rotting); thingDef2.comps.Add(compProperties_SpawnerFilth); } if (thingDef2.thingCategories == null) { thingDef2.thingCategories = new List <ThingCategoryDef>(); } if (thingDef.race.Humanlike) { DirectXmlCrossRefLoader.RegisterListWantsCrossRef <ThingCategoryDef>(thingDef2.thingCategories, ThingCategoryDefOf.CorpsesHumanlike.defName, thingDef2, null); } else { DirectXmlCrossRefLoader.RegisterListWantsCrossRef <ThingCategoryDef>(thingDef2.thingCategories, thingDef.race.FleshType.corpseCategory.defName, thingDef2, null); } thingDef.race.corpseDef = thingDef2; yield return(thingDef2); } } List <ThingDef> .Enumerator enumerator = default(List <ThingDef> .Enumerator); yield break; yield break; }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "skill", xmlRoot.Name); offset = ParseHelper.FromString <int>(xmlRoot.FirstChild.Value); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "animal", xmlRoot.Name); this.commonality = (float)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(float)); }
public static IEnumerable <ThingDef> ImpliedMeatDefs() { foreach (ThingDef item in DefDatabase <ThingDef> .AllDefs.ToList()) { if (item.category == ThingCategory.Pawn && item.race.useMeatFrom == null) { if (item.race.IsFlesh) { ThingDef d = new ThingDef(); d.resourceReadoutPriority = ResourceCountPriority.Middle; d.category = ThingCategory.Item; d.thingClass = typeof(ThingWithComps); d.graphicData = new GraphicData(); d.graphicData.graphicClass = typeof(Graphic_StackCount); d.useHitPoints = true; d.selectable = true; d.SetStatBaseValue(StatDefOf.MaxHitPoints, 100f); d.altitudeLayer = AltitudeLayer.Item; d.stackLimit = 75; d.comps.Add(new CompProperties_Forbiddable()); CompProperties_Rottable rotProps = new CompProperties_Rottable { daysToRotStart = 2f, rotDestroys = true }; d.comps.Add(rotProps); d.tickerType = TickerType.Rare; d.SetStatBaseValue(StatDefOf.Beauty, -4f); d.alwaysHaulable = true; d.rotatable = false; d.pathCost = 15; d.drawGUIOverlay = true; d.socialPropernessMatters = true; d.modContentPack = item.modContentPack; d.category = ThingCategory.Item; if (item.race.Humanlike) { d.description = "MeatHumanDesc".Translate(item.label); } else if (item.race.FleshType == FleshTypeDefOf.Insectoid) { d.description = "MeatInsectDesc".Translate(item.label); } else { d.description = "MeatDesc".Translate(item.label); } d.useHitPoints = true; d.SetStatBaseValue(StatDefOf.MaxHitPoints, 60f); d.SetStatBaseValue(StatDefOf.DeteriorationRate, 6f); d.SetStatBaseValue(StatDefOf.Mass, 0.03f); d.SetStatBaseValue(StatDefOf.Flammability, 0.5f); d.SetStatBaseValue(StatDefOf.Nutrition, 0.05f); d.SetStatBaseValue(StatDefOf.FoodPoisonChanceFixedHuman, 0.02f); d.BaseMarketValue = item.race.meatMarketValue; if (d.thingCategories == null) { d.thingCategories = new List <ThingCategoryDef>(); } DirectXmlCrossRefLoader.RegisterListWantsCrossRef(d.thingCategories, "MeatRaw", d); d.ingestible = new IngestibleProperties(); d.ingestible.parent = d; d.ingestible.foodType = FoodTypeFlags.Meat; d.ingestible.preferability = FoodPreferability.RawBad; DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(d.ingestible, "tasteThought", ThoughtDefOf.AteRawFood.defName); d.ingestible.ingestEffect = EffecterDefOf.EatMeat; d.ingestible.ingestSound = SoundDefOf.RawMeat_Eat; d.ingestible.specialThoughtDirect = item.race.FleshType.ateDirect; d.ingestible.specialThoughtAsIngredient = item.race.FleshType.ateAsIngredient; d.graphicData.color = item.race.meatColor; if (item.race.Humanlike) { d.graphicData.texPath = "Things/Item/Resource/MeatFoodRaw/Meat_Human"; } else if (item.race.FleshType == FleshTypeDefOf.Insectoid) { d.graphicData.texPath = "Things/Item/Resource/MeatFoodRaw/Meat_Insect"; } else if (item.race.baseBodySize < 0.7f) { d.graphicData.texPath = "Things/Item/Resource/MeatFoodRaw/Meat_Small"; } else { d.graphicData.texPath = "Things/Item/Resource/MeatFoodRaw/Meat_Big"; } d.defName = "Meat_" + item.defName; if (item.race.meatLabel.NullOrEmpty()) { d.label = "MeatLabel".Translate(item.label); } else { d.label = item.race.meatLabel; } d.ingestible.sourceDef = item; item.race.meatDef = d; yield return(d); /*Error: Unable to find new state assignment for yield return*/; } DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(item.race, "meatDef", "Steel"); } } yield break; IL_066c: /*Error near IL_066d: Unexpected return in MoveNext()*/; }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; bool flag = false; switch (num) { case 0u: enumerator = DefDatabase <ThingDef> .AllDefs.ToList <ThingDef>().GetEnumerator(); num = 4294967293u; break; case 1u: break; default: return(false); } try { switch (num) { } while (enumerator.MoveNext()) { raceDef = enumerator.Current; if (raceDef.category == ThingCategory.Pawn) { d = new ThingDef(); d.category = ThingCategory.Item; d.thingClass = typeof(Corpse); d.selectable = true; d.tickerType = TickerType.Rare; d.altitudeLayer = AltitudeLayer.ItemImportant; d.scatterableOnMapGen = false; d.SetStatBaseValue(StatDefOf.Beauty, -50f); d.SetStatBaseValue(StatDefOf.DeteriorationRate, 1f); d.SetStatBaseValue(StatDefOf.FoodPoisonChanceFixedHuman, 0.05f); d.alwaysHaulable = true; d.soundDrop = SoundDefOf.Corpse_Drop; d.pathCost = 15; d.socialPropernessMatters = false; d.tradeability = Tradeability.None; d.inspectorTabs = new List <Type>(); d.inspectorTabs.Add(typeof(ITab_Pawn_Health)); d.inspectorTabs.Add(typeof(ITab_Pawn_Character)); d.inspectorTabs.Add(typeof(ITab_Pawn_Gear)); d.inspectorTabs.Add(typeof(ITab_Pawn_Social)); d.inspectorTabs.Add(typeof(ITab_Pawn_Log)); d.comps.Add(new CompProperties_Forbiddable()); d.recipes = new List <RecipeDef>(); if (!raceDef.race.IsMechanoid) { d.recipes.Add(RecipeDefOf.RemoveBodyPart); } d.defName = "Corpse_" + raceDef.defName; d.label = "CorpseLabel".Translate(new object[] { raceDef.label }); d.description = "CorpseDesc".Translate(new object[] { raceDef.label }); d.soundImpactDefault = raceDef.soundImpactDefault; d.SetStatBaseValue(StatDefOf.MarketValue, ThingDefGenerator_Corpses.CalculateMarketValue(raceDef)); d.SetStatBaseValue(StatDefOf.Flammability, raceDef.GetStatValueAbstract(StatDefOf.Flammability, null)); d.SetStatBaseValue(StatDefOf.MaxHitPoints, (float)raceDef.BaseMaxHitPoints); d.SetStatBaseValue(StatDefOf.Mass, raceDef.statBases.GetStatOffsetFromList(StatDefOf.Mass)); d.SetStatBaseValue(StatDefOf.Nutrition, 5.2f); d.modContentPack = raceDef.modContentPack; d.ingestible = new IngestibleProperties(); d.ingestible.parent = d; ing = d.ingestible; ing.foodType = FoodTypeFlags.Corpse; ing.sourceDef = raceDef; ing.preferability = ((!raceDef.race.IsFlesh) ? FoodPreferability.NeverForNutrition : FoodPreferability.DesperateOnly); DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(ing, "tasteThought", ThoughtDefOf.AteCorpse.defName); ing.maxNumToIngestAtOnce = 1; ing.ingestEffect = EffecterDefOf.EatMeat; ing.ingestSound = SoundDefOf.RawMeat_Eat; ing.specialThoughtDirect = raceDef.race.FleshType.ateDirect; if (raceDef.race.IsFlesh) { CompProperties_Rottable compProperties_Rottable = new CompProperties_Rottable(); compProperties_Rottable.daysToRotStart = 2.5f; compProperties_Rottable.daysToDessicated = 5f; compProperties_Rottable.rotDamagePerDay = 2f; compProperties_Rottable.dessicatedDamagePerDay = 0.7f; d.comps.Add(compProperties_Rottable); CompProperties_SpawnerFilth compProperties_SpawnerFilth = new CompProperties_SpawnerFilth(); compProperties_SpawnerFilth.filthDef = ThingDefOf.Filth_CorpseBile; compProperties_SpawnerFilth.spawnCountOnSpawn = 0; compProperties_SpawnerFilth.spawnMtbHours = 0f; compProperties_SpawnerFilth.spawnRadius = 0.1f; compProperties_SpawnerFilth.spawnEveryDays = 1f; compProperties_SpawnerFilth.requiredRotStage = new RotStage?(RotStage.Rotting); d.comps.Add(compProperties_SpawnerFilth); } if (d.thingCategories == null) { d.thingCategories = new List <ThingCategoryDef>(); } if (raceDef.race.Humanlike) { DirectXmlCrossRefLoader.RegisterListWantsCrossRef <ThingCategoryDef>(d.thingCategories, ThingCategoryDefOf.CorpsesHumanlike.defName, d); } else { DirectXmlCrossRefLoader.RegisterListWantsCrossRef <ThingCategoryDef>(d.thingCategories, raceDef.race.FleshType.corpseCategory.defName, d); } raceDef.race.corpseDef = d; this.$current = d; if (!this.$disposing) { this.$PC = 1; } flag = true; return(true); } } } finally { if (!flag) { ((IDisposable)enumerator).Dispose(); } } this.$PC = -1; return(false); }
public void LoadDataFromXmlCustom(XmlNode xmlRoot) { DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "kind", xmlRoot.Name); this.selectionWeight = (float)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(float)); }