Ejemplo n.º 1
0
 public static IEnumerable <ThingDef> ImpliedCorpseDefs()
 {
     foreach (ThingDef raceDef in DefDatabase <ThingDef> .AllDefs.ToList <ThingDef>())
     {
         if (raceDef.category == ThingCategory.Pawn)
         {
             ThingDef 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, -150f);
             d.SetStatBaseValue(StatDefOf.DeteriorationRate, 2f);
             d.alwaysHaulable          = true;
             d.soundDrop               = SoundDef.Named("Corpse_Drop");
             d.pathCost                = 15;
             d.socialPropernessMatters = false;
             d.tradeability            = Tradeability.Never;
             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_Combat));
             d.comps.Add(new CompProperties_Forbiddable());
             d.recipes = new List <RecipeDef>();
             if (raceDef.race.IsMechanoid)
             {
                 d.recipes.Add(RecipeDefOf.RemoveMechanoidBodyPart);
             }
             else
             {
                 d.recipes.Add(RecipeDefOf.RemoveBodyPart);
             }
             d.defName = raceDef.defName + "_Corpse";
             d.label   = "CorpseLabel".Translate(new object[]
             {
                 raceDef.label
             });
             d.description = "CorpseDesc".Translate(new object[]
             {
                 raceDef.label
             });
             d.soundImpactDefault = raceDef.soundImpactDefault;
             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.ingestible = new IngestibleProperties();
             IngestibleProperties ing = d.ingestible;
             ing.foodType      = FoodTypeFlags.Corpse;
             ing.sourceDef     = raceDef;
             ing.preferability = FoodPreferability.DesperateOnly;
             DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(ing, "tasteThought", ThoughtDefOf.AteCorpse.defName);
             ing.nutrition            = 1f;
             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.FilthCorpseBile;
                 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);
             }
             else
             {
                 DirectXmlCrossRefLoader.RegisterListWantsCrossRef <ThingCategoryDef>(d.thingCategories, raceDef.race.FleshType.corpseCategory.defName);
             }
             raceDef.race.corpseDef = d;
             yield return(d);
         }
     }
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
        public static IEnumerable <ThingDef> ImpliedCorpseDefs()
        {
            foreach (ThingDef item in DefDatabase <ThingDef> .AllDefs.ToList())
            {
                if (item.category == ThingCategory.Pawn)
                {
                    ThingDef d = new ThingDef
                    {
                        category            = ThingCategory.Item,
                        thingClass          = typeof(Corpse),
                        selectable          = true,
                        tickerType          = TickerType.Rare,
                        altitudeLayer       = AltitudeLayer.ItemImportant,
                        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 (!item.race.IsMechanoid)
                    {
                        d.recipes.Add(RecipeDefOf.RemoveBodyPart);
                    }
                    d.defName            = "Corpse_" + item.defName;
                    d.label              = "CorpseLabel".Translate(item.label);
                    d.description        = "CorpseDesc".Translate(item.label);
                    d.soundImpactDefault = item.soundImpactDefault;
                    d.SetStatBaseValue(StatDefOf.MarketValue, CalculateMarketValue(item));
                    d.SetStatBaseValue(StatDefOf.Flammability, item.GetStatValueAbstract(StatDefOf.Flammability));
                    d.SetStatBaseValue(StatDefOf.MaxHitPoints, (float)item.BaseMaxHitPoints);
                    d.SetStatBaseValue(StatDefOf.Mass, item.statBases.GetStatOffsetFromList(StatDefOf.Mass));
                    d.SetStatBaseValue(StatDefOf.Nutrition, 5.2f);
                    d.modContentPack    = item.modContentPack;
                    d.ingestible        = new IngestibleProperties();
                    d.ingestible.parent = d;
                    IngestibleProperties ing = d.ingestible;
                    ing.foodType      = FoodTypeFlags.Corpse;
                    ing.sourceDef     = item;
                    ing.preferability = ((!item.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 = item.race.FleshType.ateDirect;
                    if (item.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  = RotStage.Rotting;
                        d.comps.Add(compProperties_SpawnerFilth);
                    }
                    if (d.thingCategories == null)
                    {
                        d.thingCategories = new List <ThingCategoryDef>();
                    }
                    if (item.race.Humanlike)
                    {
                        DirectXmlCrossRefLoader.RegisterListWantsCrossRef(d.thingCategories, ThingCategoryDefOf.CorpsesHumanlike.defName, d);
                    }
                    else
                    {
                        DirectXmlCrossRefLoader.RegisterListWantsCrossRef(d.thingCategories, item.race.FleshType.corpseCategory.defName, d);
                    }
                    item.race.corpseDef = d;
                    yield return(d);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_05de:
            /*Error near IL_05df: Unexpected return in MoveNext()*/;
        }