public static void GenerateImpliedDefs_PreResolve()
 {
     foreach (ThingDef item in ThingDefGenerator_Buildings.ImpliedBlueprintAndFrameDefs().Concat(ThingDefGenerator_Meat.ImpliedMeatDefs()).Concat(ThingDefGenerator_Techprints.ImpliedTechprintDefs())
              .Concat(ThingDefGenerator_Corpses.ImpliedCorpseDefs()))
     {
         AddImpliedDef(item);
     }
     DirectXmlCrossRefLoader.ResolveAllWantedCrossReferences(FailMode.Silent);
     foreach (TerrainDef item2 in TerrainDefGenerator_Stone.ImpliedTerrainDefs())
     {
         AddImpliedDef(item2);
     }
     foreach (RecipeDef item3 in RecipeDefGenerator.ImpliedRecipeDefs())
     {
         AddImpliedDef(item3);
     }
     foreach (PawnColumnDef item4 in PawnColumnDefgenerator.ImpliedPawnColumnDefs())
     {
         AddImpliedDef(item4);
     }
     foreach (ThingDef item5 in NeurotrainerDefGenerator.ImpliedThingDefs())
     {
         AddImpliedDef(item5);
     }
 }
示例#2
0
 // 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 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);
            }
示例#4
0
        public static void GenerateImpliedDefs_PreResolve()
        {
            IEnumerable <ThingDef> enumerable = ThingDefGenerator_Buildings.ImpliedBlueprintAndFrameDefs().Concat(ThingDefGenerator_Meat.ImpliedMeatDefs()).Concat(ThingDefGenerator_Corpses.ImpliedCorpseDefs());

            foreach (ThingDef current in enumerable)
            {
                DefGenerator.AddImpliedDef <ThingDef>(current);
            }
            DirectXmlCrossRefLoader.ResolveAllWantedCrossReferences(FailMode.Silent);
            foreach (TerrainDef current2 in TerrainDefGenerator_Stone.ImpliedTerrainDefs())
            {
                DefGenerator.AddImpliedDef <TerrainDef>(current2);
            }
            foreach (RecipeDef current3 in RecipeDefGenerator.ImpliedRecipeDefs())
            {
                DefGenerator.AddImpliedDef <RecipeDef>(current3);
            }
            foreach (PawnColumnDef current4 in PawnColumnDefgenerator.ImpliedPawnColumnDefs())
            {
                DefGenerator.AddImpliedDef <PawnColumnDef>(current4);
            }
        }
        public static void GenerateImpliedDefs_PreResolve()
        {
            IEnumerable <ThingDef> enumerable = ThingDefGenerator_Buildings.ImpliedBlueprintAndFrameDefs().Concat(ThingDefGenerator_Meat.ImpliedMeatDefs()).Concat(ThingDefGenerator_Corpses.ImpliedCorpseDefs())
                                                .Concat(ThingDefGenerator_Leather.ImpliedLeatherDefs());

            foreach (ThingDef item in enumerable)
            {
                item.PostLoad();
                DefDatabase <ThingDef> .Add(item);
            }
            DirectXmlCrossRefLoader.ResolveAllWantedCrossReferences(FailMode.Silent);
            foreach (TerrainDef item2 in TerrainDefGenerator_Stone.ImpliedTerrainDefs())
            {
                item2.PostLoad();
                DefDatabase <TerrainDef> .Add(item2);
            }
            foreach (RecipeDef item3 in RecipeDefGenerator.ImpliedRecipeDefs())
            {
                item3.PostLoad();
                DefDatabase <RecipeDef> .Add(item3);
            }
            foreach (PawnColumnDef item4 in PawnColumnDefgenerator.ImpliedPawnColumnDefs())
            {
                item4.PostLoad();
                DefDatabase <PawnColumnDef> .Add(item4);
            }
        }