public static GameObject CreateMole(string id, string name, string desc, string anim_file, bool is_baby = false)
    {
        GameObject gameObject = BaseMoleConfig.BaseMole(id, name, STRINGS.CREATURES.SPECIES.MOLE.DESC, "MoleBaseTrait", anim_file, is_baby);

        gameObject.AddTag(GameTags.Creatures.Digger);
        EntityTemplates.ExtendEntityToWildCreature(gameObject, MoleTuning.PEN_SIZE_PER_CREATURE, 100f);
        Trait trait = Db.Get().CreateTrait("MoleBaseTrait", name, name, null, false, null, true, true);

        trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, MoleTuning.STANDARD_STOMACH_SIZE, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (0f - MoleTuning.STANDARD_CALORIES_PER_CYCLE) / 600f, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 25f, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, 100f, name, false, false, true));
        List <Tag> list = new List <Tag>();

        list.Add(SimHashes.Regolith.CreateTag());
        list.Add(SimHashes.Dirt.CreateTag());
        list.Add(SimHashes.IronOre.CreateTag());
        List <Diet.Info> list2 = BaseMoleConfig.SimpleOreDiet(list, CALORIES_PER_KG_OF_DIRT, TUNING.CREATURES.CONVERSION_EFFICIENCY.NORMAL);
        Diet             diet  = new Diet(list2.ToArray());

        CreatureCalorieMonitor.Def def = gameObject.AddOrGetDef <CreatureCalorieMonitor.Def>();
        def.diet = diet;
        def.minPoopSizeInCalories = MIN_POOP_SIZE_IN_CALORIES;
        SolidConsumerMonitor.Def def2 = gameObject.AddOrGetDef <SolidConsumerMonitor.Def>();
        def2.diet = diet;
        OvercrowdingMonitor.Def def3 = gameObject.AddOrGetDef <OvercrowdingMonitor.Def>();
        def3.spaceRequiredPerCreature = 0;
        gameObject.AddOrGet <LoopingSounds>();
        return(gameObject);
    }
Beispiel #2
0
        public static void Postfix(GameObject __result)
        {
            if (!Patches.Settings.DisableLonghairSlicksters)
            {
                // Patch the diet
                Diet diet = new Diet(new Diet.Info[]
                {
                    new Diet.Info(new HashSet <Tag>
                    {
                        SimHashes.Oxygen.CreateTag()
                    }, ((SimHashes)Patches.Settings.LonghairElement).CreateTag(), Traverse.Create <OilFloaterDecorConfig>().GetField <float>("CALORIES_PER_KG_OF_ORE"), TUNING.CREATURES.CONVERSION_EFFICIENCY.GOOD_1, null, 0, false, false)
                });
                CreatureCalorieMonitor.Def def = __result.AddOrGetDef <CreatureCalorieMonitor.Def>();
                def.diet = diet;
                __result.AddOrGetDef <GasAndLiquidConsumerMonitor.Def>().diet = diet;


                // Patch the dead drop
                string[] loot = new string[4];
                loot[0] = BasicFabricConfig.ID;
                loot[1] = BasicFabricConfig.ID;
                loot[2] = MeatConfig.ID;
                loot[3] = MeatConfig.ID;

                __result.AddOrGet <Butcherable>().SetDrops(loot);
            }
        }
Beispiel #3
0
        public static GameObject CreateCritter(
            string id,
            string name,
            string desc,
            string anim_file,
            bool is_baby)
        {
            GameObject wildCreature = EntityTemplates.ExtendEntityToWildCreature(BaseDreckoConfig.BaseDrecko(id, name, desc, anim_file, BASE_TRAIT_ID, is_baby, (string)null, 308.15f, 363.15f), DreckoTuning.PEN_SIZE_PER_CREATURE);

            CreateTrait(name);

            Diet diet = new Diet(new Diet.Info[1]
            {
                new Diet.Info(new HashSet <Tag>()
                {
                    (Tag)SeaLettuceConfig.ID
                }, AlgaeDrecko.POOP_ELEMENT, AlgaeDrecko.CALORIES_PER_DAY_OF_PLANT_EATEN, AlgaeDrecko.KG_POOP_PER_DAY_OF_PLANT, (string)null, 0.0f, false, true)
            });

            CreatureCalorieMonitor.Def def1 = wildCreature.AddOrGetDef <CreatureCalorieMonitor.Def>();
            def1.diet = diet;
            def1.minPoopSizeInCalories = AlgaeDrecko.MIN_POOP_SIZE_IN_CALORIES;
            wildCreature.AddOrGetDef <SolidConsumerMonitor.Def>().diet = diet;
            ScaleGrowthMonitor.Def def2 = wildCreature.AddOrGetDef <ScaleGrowthMonitor.Def>();
            def2.defaultGrowthRate  = (float)(1.0 / (double)AlgaeDrecko.SCALE_GROWTH_TIME_IN_CYCLES / 600.0);
            def2.dropMass           = AlgaeDrecko.FIBER_PER_CYCLE * AlgaeDrecko.SCALE_GROWTH_TIME_IN_CYCLES;
            def2.itemDroppedOnShear = AlgaeDrecko.EMIT_ELEMENT;
            def2.levelCount         = 6;
            def2.targetAtmosphere   = SimHashes.CarbonDioxide;
            return(wildCreature);
        }
    public static GameObject CreateDrecko(string id, string name, string desc, string anim_file, bool is_baby)
    {
        GameObject prefab = BaseDreckoConfig.BaseDrecko(id, name, desc, anim_file, "DreckoBaseTrait", is_baby, "fbr_", 308.15f, 363.15f);

        prefab = EntityTemplates.ExtendEntityToWildCreature(prefab, DreckoTuning.PEN_SIZE_PER_CREATURE, 150f);
        Trait trait = Db.Get().CreateTrait("DreckoBaseTrait", name, name, null, false, null, true, true);

        trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, DreckoTuning.STANDARD_STOMACH_SIZE, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (0f - DreckoTuning.STANDARD_CALORIES_PER_CYCLE) / 600f, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 25f, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, 150f, name, false, false, true));
        HashSet <Tag> hashSet = new HashSet <Tag>();

        hashSet.Add("SpiceVine".ToTag());
        hashSet.Add(SwampLilyConfig.ID.ToTag());
        hashSet.Add("BasicSingleHarvestPlant".ToTag());
        Diet.Info[] infos = new Diet.Info[1]
        {
            new Diet.Info(hashSet, POOP_ELEMENT, CALORIES_PER_DAY_OF_PLANT_EATEN, KG_POOP_PER_DAY_OF_PLANT, null, 0f, false, true)
        };
        Diet diet = new Diet(infos);

        CreatureCalorieMonitor.Def def = prefab.AddOrGetDef <CreatureCalorieMonitor.Def>();
        def.diet = diet;
        def.minPoopSizeInCalories = MIN_POOP_SIZE_IN_CALORIES;
        SolidConsumerMonitor.Def def2 = prefab.AddOrGetDef <SolidConsumerMonitor.Def>();
        def2.diet = diet;
        ScaleGrowthMonitor.Def def3 = prefab.AddOrGetDef <ScaleGrowthMonitor.Def>();
        def3.defaultGrowthRate  = 1f / SCALE_GROWTH_TIME_IN_CYCLES / 600f;
        def3.dropMass           = FIBER_PER_CYCLE * SCALE_GROWTH_TIME_IN_CYCLES;
        def3.itemDroppedOnShear = EMIT_ELEMENT;
        def3.levelCount         = 6;
        def3.targetAtmosphere   = SimHashes.Hydrogen;
        return(prefab);
    }
    public static GameObject CreateMoo(string id, string name, string desc, string anim_file, bool is_baby)
    {
        GameObject gameObject = BaseMooConfig.BaseMoo(id, name, CREATURES.SPECIES.MOO.DESC, "MooBaseTrait", anim_file, is_baby, null);

        EntityTemplates.ExtendEntityToWildCreature(gameObject, MooTuning.PEN_SIZE_PER_CREATURE, 75f);
        Trait trait = Db.Get().CreateTrait("MooBaseTrait", name, name, null, false, null, true, true);

        trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, MooTuning.STANDARD_STOMACH_SIZE, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (0f - MooTuning.STANDARD_CALORIES_PER_CYCLE) / 600f, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 25f, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, 75f, name, false, false, true));
        HashSet <Tag> hashSet = new HashSet <Tag>();

        hashSet.Add("GasGrass".ToTag());
        Diet.Info[] infos = new Diet.Info[1]
        {
            new Diet.Info(hashSet, POOP_ELEMENT, CALORIES_PER_DAY_OF_PLANT_EATEN, KG_POOP_PER_DAY_OF_PLANT, null, 0f, false, false)
        };
        Diet diet = new Diet(infos);

        CreatureCalorieMonitor.Def def = gameObject.AddOrGetDef <CreatureCalorieMonitor.Def>();
        def.diet = diet;
        def.minPoopSizeInCalories = MIN_POOP_SIZE_IN_CALORIES;
        SolidConsumerMonitor.Def def2 = gameObject.AddOrGetDef <SolidConsumerMonitor.Def>();
        def2.diet = diet;
        return(gameObject);
    }
Beispiel #6
0
        public static GameObject SetupDiet(GameObject prefab, List <Diet.Info> diet_infos, float referenceCaloriesPerKg, float minPoopSizeInKg)
        {
            Diet diet = new Diet(diet_infos.ToArray());

            CreatureCalorieMonitor.Def def = prefab.AddOrGetDef <CreatureCalorieMonitor.Def>();
            def.diet = diet;
            def.minPoopSizeInCalories = referenceCaloriesPerKg * minPoopSizeInKg;
            prefab.AddOrGetDef <SolidConsumerMonitor.Def>().diet = diet;
            return(prefab);
        }
Beispiel #7
0
    public static GameObject SetupDiet(GameObject prefab, Diet.Info[] diet_infos, float caloriesPerKg, float minPoopSizeInKg)
    {
        Diet diet = new Diet(diet_infos);

        CreatureCalorieMonitor.Def def = prefab.AddOrGetDef <CreatureCalorieMonitor.Def>();
        def.diet = diet;
        def.minPoopSizeInCalories = minPoopSizeInKg * caloriesPerKg;
        GasAndLiquidConsumerMonitor.Def def2 = prefab.AddOrGetDef <GasAndLiquidConsumerMonitor.Def>();
        def2.diet = diet;
        return(prefab);
    }
Beispiel #8
0
        public static GameObject SetupDiet(GameObject prefab, List <Diet.Info> diet_infos, float CALORIES_PER_KG_OF_ORE, float minPoopSizeInKg, float consumptionRate = 5f)
        {
            Diet diet = new Diet(diet_infos.ToArray());

            CreatureCalorieMonitor.Def def = prefab.AddOrGetDef <CreatureCalorieMonitor.Def>();
            def.diet = diet;
            def.minPoopSizeInCalories = CALORIES_PER_KG_OF_ORE * minPoopSizeInKg;
            GasAndLiquidConsumerMonitor.Def def2 = prefab.AddOrGetDef <GasAndLiquidConsumerMonitor.Def>();
            def2.diet            = diet;
            def2.consumptionRate = consumptionRate;
            return(prefab);
        }
    public static GameObject SetupDiet(GameObject prefab, HashSet <Tag> consumed_tags, Tag producedTag, float caloriesPerKg)
    {
        Diet.Info[] infos = new Diet.Info[1]
        {
            new Diet.Info(consumed_tags, producedTag, caloriesPerKg, 1f, null, 0f, false, false)
        };
        Diet diet = new Diet(infos);

        CreatureCalorieMonitor.Def def = prefab.AddOrGetDef <CreatureCalorieMonitor.Def>();
        def.diet = diet;
        SolidConsumerMonitor.Def def2 = prefab.AddOrGetDef <SolidConsumerMonitor.Def>();
        def2.diet = diet;
        return(prefab);
    }
Beispiel #10
0
    public static Dictionary <Tag, Diet> CollectDiets(Tag[] target_species)
    {
        Dictionary <Tag, Diet> dictionary = new Dictionary <Tag, Diet>();

        foreach (KPrefabID prefab in Assets.Prefabs)
        {
            CreatureCalorieMonitor.Def def = prefab.GetDef <CreatureCalorieMonitor.Def>();
            if (def != null && (target_species == null || Array.IndexOf(target_species, prefab.GetComponent <CreatureBrain>().species) >= 0))
            {
                dictionary[prefab.PrefabTag] = def.diet;
            }
        }
        return(dictionary);
    }
    public static GameObject SetupDiet(GameObject prefab, Tag consumed_tag, Tag producedTag, float caloriesPerKg, float producedConversionRate, string diseaseId, float diseasePerKgProduced, float minPoopSizeInKg)
    {
        HashSet <Tag> hashSet = new HashSet <Tag>();

        hashSet.Add(consumed_tag);
        Diet.Info[] infos = new Diet.Info[1]
        {
            new Diet.Info(hashSet, producedTag, caloriesPerKg, producedConversionRate, diseaseId, diseasePerKgProduced, false, false)
        };
        Diet diet = new Diet(infos);

        CreatureCalorieMonitor.Def def = prefab.AddOrGetDef <CreatureCalorieMonitor.Def>();
        def.diet = diet;
        def.minPoopSizeInCalories = minPoopSizeInKg * caloriesPerKg;
        GasAndLiquidConsumerMonitor.Def def2 = prefab.AddOrGetDef <GasAndLiquidConsumerMonitor.Def>();
        def2.diet = diet;
        return(prefab);
    }
Beispiel #12
0
        public static void Postfix(GameObject __result)
        {
            Diet diet = new Diet(
                new Diet.Info(new HashSet <Tag>()
            {
                SimHashes.Water.CreateTag()
            }, SimHashes.ToxicSand.CreateTag(), 50, 1, Db.Get().Diseases.FoodPoisoning.Id, 0f),
                new Diet.Info(new HashSet <Tag>()
            {
                SimHashes.DirtyWater.CreateTag()
            }, SimHashes.SlimeMold.CreateTag(), 50, 1, Db.Get().Diseases.FoodPoisoning.Id, 0f)
                );

            CreatureCalorieMonitor.Def cmon = __result.AddOrGetDef <CreatureCalorieMonitor.Def>();
            cmon.diet = diet;
            cmon.minPoopSizeInCalories = 30;
            __result.AddOrGetDef <SolidConsumerMonitor.Def>().diet = diet;
        }
Beispiel #13
0
        public static GameObject CreateLivingCrystal()
        {
            GameObject placedEntity = GeneratePlacedEntity();

            EntityTemplates.ExtendEntityToWildCreature(placedEntity, PenSizePerCreature, Lifespan);
            Diet diet = new Diet(new Diet.Info[1]
            {
                new Diet.Info(new HashSet <Tag>()
                {
                    ElementLoader.FindElementByHash(Elements.MineralWaterElement.SimHash).tag
                }, ElementLoader.FindElementByHash(Elements.MineralWaterElement.SimHash).tag, CaloriesPerKg, ProducedConversionRate, null, 0.0f, false)
            });

            CreatureCalorieMonitor.Def calorieMonitor = placedEntity.AddOrGetDef <CreatureCalorieMonitor.Def>();
            calorieMonitor.diet = diet;
            calorieMonitor.minPoopSizeInCalories = MinPoopSizeInKg * CaloriesPerKg;
            GasAndLiquidConsumerMonitor.Def consumerMonitor = placedEntity.AddOrGetDef <GasAndLiquidConsumerMonitor.Def>();
            consumerMonitor.diet            = diet;
            consumerMonitor.consumptionRate = KgEatenPerCycle / EatTimesPerCycle;
            placedEntity.AddOrGet <LivingCrystal>().Initialize();
            return(placedEntity);
        }
Beispiel #14
0
    public static GameObject CreatePrefab(string id, string base_trait_id, string name, string description, string anim_file, bool is_baby, string symbol_prefix, float warnLowTemp, float warnHighTemp)
    {
        float          mass               = 200f;
        KAnimFile      anim               = Assets.GetAnim(anim_file);
        string         initialAnim        = "idle_loop";
        EffectorValues tIER               = DECOR.BONUS.TIER0;
        float          defaultTemperature = (warnLowTemp + warnHighTemp) / 2f;
        GameObject     gameObject         = EntityTemplates.CreatePlacedEntity(id, name, description, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 1, 1, tIER, default(EffectorValues), SimHashes.Creature, null, defaultTemperature);
        KPrefabID      component          = gameObject.GetComponent <KPrefabID>();

        component.AddTag(GameTags.SwimmingCreature, false);
        component.AddTag(GameTags.Creatures.Swimmer, false);
        Trait trait = Db.Get().CreateTrait(base_trait_id, name, name, null, false, null, true, true);

        trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, PacuTuning.STANDARD_STOMACH_SIZE, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (0f - PacuTuning.STANDARD_CALORIES_PER_CYCLE) / 600f, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 25f, name, false, false, true));
        trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, 25f, name, false, false, true));
        EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, false, false, true);
        EntityTemplates.ExtendEntityToBasicCreature(gameObject, FactionManager.FactionID.Prey, base_trait_id, "SwimmerNavGrid", NavType.Swim, 32, 2f, "FishMeat", 1, false, false, warnLowTemp, warnHighTemp, warnLowTemp - 20f, warnHighTemp + 20f);
        if (is_baby)
        {
            KBatchedAnimController component2 = gameObject.GetComponent <KBatchedAnimController>();
            component2.animWidth  = 0.5f;
            component2.animHeight = 0.5f;
        }
        ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new GrowUpStates.Def(), true)
                                         .Add(new TrappedStates.Def(), true)
                                         .Add(new IncubatingStates.Def(), true)
                                         .Add(new BaggedStates.Def(), true)
                                         .Add(new FallStates.Def
        {
            getLandAnim = new Func <FallStates.Instance, string>(GetLandAnim)
        }, true)
                                         .Add(new DebugGoToStates.Def(), true)
                                         .Add(new FlopStates.Def(), true)
                                         .PushInterruptGroup()
                                         .Add(new FixedCaptureStates.Def(), true)
                                         .Add(new LayEggStates.Def(), true)
                                         .Add(new EatStates.Def(), true)
                                         .Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "lay_egg_pre", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true)
                                         .Add(new MoveToLureStates.Def(), true)
                                         .PopInterruptGroup()
                                         .Add(new IdleStates.Def(), true);
        CreatureFallMonitor.Def def = gameObject.AddOrGetDef <CreatureFallMonitor.Def>();
        def.canSwim = true;
        gameObject.AddOrGetDef <FlopMonitor.Def>();
        gameObject.AddOrGetDef <FishOvercrowdingMonitor.Def>();
        gameObject.AddOrGet <Trappable>();
        gameObject.AddOrGet <LoopingSounds>();
        EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.PacuSpecies, symbol_prefix);
        HashSet <Tag> hashSet = new HashSet <Tag>();

        hashSet.Add(SimHashes.Algae.CreateTag());
        Diet.Info[] infos = new Diet.Info[1]
        {
            new Diet.Info(hashSet, SimHashes.ToxicSand.CreateTag(), CALORIES_PER_KG_OF_ORE, TUNING.CREATURES.CONVERSION_EFFICIENCY.NORMAL, null, 0f, false, false)
        };
        Diet diet = new Diet(infos);

        CreatureCalorieMonitor.Def def2 = gameObject.AddOrGetDef <CreatureCalorieMonitor.Def>();
        def2.diet = diet;
        def2.minPoopSizeInCalories = CALORIES_PER_KG_OF_ORE * MIN_POOP_SIZE_IN_KG;
        SolidConsumerMonitor.Def def3 = gameObject.AddOrGetDef <SolidConsumerMonitor.Def>();
        def3.diet = diet;
        LureableMonitor.Def def4 = gameObject.AddOrGetDef <LureableMonitor.Def>();
        def4.lures = new Tag[1]
        {
            GameTags.Creatures.FishTrapLure
        };
        if (!string.IsNullOrEmpty(symbol_prefix))
        {
            gameObject.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim("pacu_kanim"), symbol_prefix, null, 0);
        }
        return(gameObject);
    }
    /// Creates new critters which were not already loaded by EntityLoad ...
    public static void CreateNewCritters()
    {
        foreach (var setting in CustomizeCritterState.StateManager.State.critter_settings)
        {
            if (setting?.id == null)
            {
                continue;
            }

            if (Assets.Prefabs.Find(a => a.gameObject?.name == setting.id) == null)
            {
                // configurations
                string             id                = setting.id;
                string             name              = setting.name ?? "Stone Hatch";
                string             desc              = setting.desc ?? "Stone Hatches excrete solid Coal as waste and enjoy burrowing into the ground.";
                string             anim_file         = setting.anim_file ?? "hatch_kanim";
                bool               is_baby           = setting.is_baby ?? false;
                string             traitId           = setting.traitId ?? "HatchHardBaseTrait";
                string             override_prefix   = setting.override_prefix;
                int                space_requirement = setting.space_requirement ?? HatchTuning.PEN_SIZE_PER_CREATURE;
                float              lifespan          = setting.lifespan ?? 100f;
                float              mass              = setting.mass ?? 100f;
                float              width             = setting.width ?? 1f;
                float              height            = setting.height ?? 1f;
                EffectorValues     decor             = setting.decor ?? TUNING.DECOR.BONUS.TIER0;
                string             navGridName       = setting.navGridName ?? (!is_baby ? "WalkerNavGrid1x1" : "WalkerBabyNavGrid");
                NavType            navi; Enum.TryParse(setting.navi, out navi);// ?? NavType.Floor;
                float              moveSpeed            = setting.moveSpeed ?? 2f;
                string[]           dropOnDeath          = setting.dropOnDeath ?? new string[] { "Meat", "Meat" };
                bool               canDrown             = setting.canDrown ?? true;
                bool               canCrushed           = setting.canCrushed ?? false;
                float              tempLowDeath         = setting.tempLowDeath ?? 243.15f;
                float              tempLowWarning       = setting.tempLowWarning ?? 283.15f;
                float              tempBorn             = setting.tempBorn ?? 293f;
                float              tempHighWarning      = setting.tempHighWarning ?? 293.15f;
                float              tempHighDeath        = setting.tempHighDeath ?? 343.15f;
                bool               pickup_only_from_top = setting.pickup_only_from_top ?? true;
                bool               pickup_allow_mark    = setting.pickup_allow_mark ?? true;
                bool               pickup_use_gun       = setting.pickup_use_gun ?? false;
                string[]           tags        = setting.tags ?? new string[] { GameTags.Creatures.Walker.ToString() };
                Tag                species     = setting.species ?? GameTags.Creatures.Species.HatchSpecies;
                float              attackValue = setting.attackValue ?? 1f;
                ChoreTable.Builder chore_table = setting.chore_table ?? new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new ExitBurrowStates.Def(), !is_baby).Add(new PlayAnimsStates.Def(GameTags.Creatures.Burrowed, true, "idle_mound", STRINGS.CREATURES.STATUSITEMS.BURROWED.NAME, STRINGS.CREATURES.STATUSITEMS.BURROWED.TOOLTIP), !is_baby).Add(new GrowUpStates.Def(), true).Add(new TrappedStates.Def(), true).Add(new IncubatingStates.Def(), true).Add(new BaggedStates.Def(), true).Add(new FallStates.Def(), true).Add(new StunnedStates.Def(), true).Add(new DrowningStates.Def(), true).Add(new DebugGoToStates.Def(), true).Add(new FleeStates.Def(), true).Add(new AttackStates.Def(), !is_baby).PushInterruptGroup().Add(new CreatureSleepStates.Def(), true).Add(new FixedCaptureStates.Def(), true).Add(new RanchedStates.Def(), true).Add(new PlayAnimsStates.Def(GameTags.Creatures.WantsToEnterBurrow, false, "hide", STRINGS.CREATURES.STATUSITEMS.BURROWING.NAME, STRINGS.CREATURES.STATUSITEMS.BURROWING.TOOLTIP), !is_baby).Add(new LayEggStates.Def(), true).Add(new EatStates.Def(), true).Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true).Add(new CallAdultStates.Def(), true).PopInterruptGroup().Add(new IdleStates.Def(), true);

                string adultId          = setting.adultId ?? "HatchHard";
                string eggId            = setting.eggId ?? "HatchHardEgg";
                string babyId           = setting.babyId ?? "HatchHardBaby";
                string dropOnMature     = setting.dropOnMature ?? null;
                float  fertility_cycles = setting.fertility_cycles ?? 60f;
                List <FertilityMonitor.BreedingChance> egg_chances = new List <FertilityMonitor.BreedingChance>();
                egg_chances.Add(BreedingChance("HatchHardEgg", 1f));
                bool is_ranchable = setting.is_ranchable ?? true;

                float            calories_per_KG = setting.calories_per_KG ?? (700000f / 140f);
                float            min_poop_KG     = setting.min_poop_KG ?? 25f;
                List <Diet.Info> diet_list       = setting.diet_list ?? BaseHatchConfig.HardRockDiet(SimHashes.Carbon.CreateTag(), calories_per_KG, TUNING.CREATURES.CONVERSION_EFFICIENCY.NORMAL, null, 0f);
                // end of configurations

                GameObject critter;
                critter = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, Assets.GetAnim(anim_file), "idle_loop", Grid.SceneLayer.Creatures, (int)width, (int)height, decor, default(EffectorValues), SimHashes.Creature, null, tempBorn);
                EntityTemplates.ExtendEntityToBasicCreature(critter, FactionManager.FactionID.Pest, traitId, navGridName, navi, 32, moveSpeed, "Meat", 2, canDrown, canCrushed, tempLowWarning, tempHighWarning, tempLowDeath, tempHighDeath);
                critter.AddOrGet <Butcherable>().SetDrops(dropOnDeath);
                if (override_prefix != null)
                {
                    critter.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), override_prefix, null, 0);
                }
                critter.AddOrGet <Trappable>();
                critter.AddOrGetDef <CreatureFallMonitor.Def>();
                critter.AddOrGetDef <BurrowMonitor.Def>();
                critter.AddOrGetDef <WorldSpawnableMonitor.Def>().adjustSpawnLocationCb = (int cell) => { return(cell); };//new Func<int, int>(BaseHatchConfig.AdjustSpawnLocationCB);
                critter.AddOrGetDef <ThreatMonitor.Def>().fleethresholdState            = Health.HealthState.Dead;
                if (attackValue > 0f)
                {
                    critter.AddWeapon(attackValue, attackValue, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0f);
                }
                EntityTemplates.CreateAndRegisterBaggedCreature(critter, pickup_only_from_top, pickup_allow_mark, pickup_use_gun);
                KPrefabID prefabID = critter.GetComponent <KPrefabID>();
                prefabID.ProcessTags(tags);
                prefabID.prefabInitFn += delegate(GameObject inst) { inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost); };
                EntityTemplates.AddCreatureBrain(critter, chore_table, species, override_prefix);

                EntityTemplates.ExtendEntityToWildCreature(critter, space_requirement, lifespan);

                Diet diet = new Diet(diet_list.ToArray());
                CreatureCalorieMonitor.Def calorieMonitor = critter.AddOrGetDef <CreatureCalorieMonitor.Def>();
                calorieMonitor.diet = diet;
                calorieMonitor.minPoopSizeInCalories = calories_per_KG * min_poop_KG;
                critter.AddOrGetDef <SolidConsumerMonitor.Def>().diet = diet;

                if (is_baby)
                {
                    EntityTemplates.ExtendEntityToBeingABaby(critter, adultId, dropOnMature);
                }
                else
                {
                    FertilityMonitor.Def def = critter.AddOrGetDef <FertilityMonitor.Def>();
                    def.baseFertileCycles      = fertility_cycles;
                    def.eggPrefab              = new Tag(eggId);
                    def.initialBreedingWeights = egg_chances;
                    KPrefabID creature_prefab_id = critter.GetComponent <KPrefabID>();
                    creature_prefab_id.prefabSpawnFn += delegate(GameObject inst)
                    {
                        WorldInventory.Instance.Discover(eggId.ToTag(), WorldInventory.GetCategoryForTags(egg_tags));
                        WorldInventory.Instance.Discover(babyId.ToTag(), WorldInventory.GetCategoryForTags(creature_prefab_id.Tags));
                    };
                    if (is_ranchable)
                    {
                        critter.AddOrGetDef <RanchableMonitor.Def>();
                    }
                    critter.AddOrGetDef <FixedCapturableMonitor.Def>();
                }

                if (setting.scales != null)
                {
                    ScaleGrowthMonitor.Def def_scale = critter.AddOrGetDef <ScaleGrowthMonitor.Def>();
                    def_scale.defaultGrowthRate  = setting.scales.growthRate ?? (setting.scales.growthRate ?? (1f / DreckoConfig.SCALE_GROWTH_TIME_IN_CYCLES / 600f));
                    def_scale.dropMass           = setting.scales.mass ?? (DreckoConfig.FIBER_PER_CYCLE * DreckoConfig.SCALE_GROWTH_TIME_IN_CYCLES);
                    def_scale.itemDroppedOnShear = setting.scales.drop ?? "Dirt";
                    def_scale.levelCount         = setting.scales.levelCount ?? 6;
                    def_scale.targetAtmosphere   = (setting.scales.atmosphere ?? "Void").ToSimHash();
                }

                if (setting.expulsion != null)
                {
                    ElementDropperMonitor.Def def_morb = critter.AddOrGetDef <ElementDropperMonitor.Def>();
                    def_morb.dirtyEmitElement        = (setting.expulsion.element ?? "Dirt").ToSimHash();
                    def_morb.dirtyProbabilityPercent = setting.expulsion.probability ?? 25f;
                    def_morb.dirtyCellToTargetMass   = setting.expulsion.cellTargetMass ?? 1f;
                    def_morb.dirtyMassPerDirty       = setting.expulsion.massPerDirt ?? 0.2f;
                    def_morb.dirtyMassReleaseOnDeath = setting.expulsion.onDeath ?? 3f;
                    def_morb.emitDiseaseIdx          = Db.Get().Diseases.GetIndex(setting.expulsion.diseaseId ?? "");
                    def_morb.emitDiseasePerKg        = setting.expulsion.diseaseAmount ?? 0f;
                }

                if (setting.light != null)
                {
                    if (setting.light.color != Color.black)
                    {
                        Light2D light2D = critter.AddOrGet <Light2D>();
                        light2D.Color         = setting.light.color ?? Color.white;
                        light2D.overlayColour = TUNING.LIGHT2D.LIGHTBUG_OVERLAYCOLOR;
                        light2D.Range         = setting.light.range ?? 5f;
                        light2D.Angle         = 0f;
                        light2D.Direction     = TUNING.LIGHT2D.LIGHTBUG_DIRECTION;
                        light2D.Offset        = TUNING.LIGHT2D.LIGHTBUG_OFFSET;
                        light2D.shape         = LightShape.Circle;
                        light2D.drawOverlay   = true;
                        light2D.Lux           = setting.light.lux ?? 1800;
                        critter.AddOrGet <LightSymbolTracker>().targetSymbol = "snapTo_light_locator";
                        critter.AddOrGetDef <CreatureLightToggleController.Def>();
                    }
                }
            }
        }
    }
    public void test()
    {
        // configurations
        string         id                   = "HatchHard";
        string         name                 = "Stone Hatch";
        string         desc                 = "Stone Hatches excrete solid Coal as waste and enjoy burrowing into the ground.";
        string         anim_file            = "hatch_kanim";
        bool           is_baby              = false;
        string         traitId              = "HatchHardBaseTrait";
        string         override_prefix      = "hvy_";
        int            space_requirement    = HatchTuning.PEN_SIZE_PER_CREATURE;
        float          lifespan             = 100f;
        float          mass                 = 100f;
        int            width                = 1;
        int            height               = 1;
        EffectorValues decor                = TUNING.DECOR.BONUS.TIER0;
        string         navGridName          = !is_baby ? "WalkerNavGrid1x1" : "WalkerBabyNavGrid";
        NavType        navi                 = NavType.Floor;
        float          moveSpeed            = 2f;
        string         dropOnDeath          = "Meat";
        int            dropCount            = 2;
        bool           canDrown             = true;
        bool           canCrushed           = false;
        float          tempLowDeath         = 243.15f;
        float          tempLowWarning       = 283.15f;
        float          tempBorn             = 293f;
        float          tempHighWarning      = 293.15f;
        float          tempHighDeath        = 343.15f;
        bool           pickup_only_from_top = true;
        bool           pickup_allow_mark    = true;
        bool           pickup_use_gun       = false;
        Tag            tag                  = GameTags.Creatures.Walker;
        Tag            species              = GameTags.Creatures.Species.HatchSpecies;
        float          attackValue          = 1f;

        ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new ExitBurrowStates.Def(), !is_baby).Add(new PlayAnimsStates.Def(GameTags.Creatures.Burrowed, true, "idle_mound", STRINGS.CREATURES.STATUSITEMS.BURROWED.NAME, STRINGS.CREATURES.STATUSITEMS.BURROWED.TOOLTIP), !is_baby).Add(new GrowUpStates.Def(), true).Add(new TrappedStates.Def(), true).Add(new IncubatingStates.Def(), true).Add(new BaggedStates.Def(), true).Add(new FallStates.Def(), true).Add(new StunnedStates.Def(), true).Add(new DrowningStates.Def(), true).Add(new DebugGoToStates.Def(), true).Add(new FleeStates.Def(), true).Add(new AttackStates.Def(), !is_baby).PushInterruptGroup().Add(new CreatureSleepStates.Def(), true).Add(new FixedCaptureStates.Def(), true).Add(new RanchedStates.Def(), true).Add(new PlayAnimsStates.Def(GameTags.Creatures.WantsToEnterBurrow, false, "hide", STRINGS.CREATURES.STATUSITEMS.BURROWING.NAME, STRINGS.CREATURES.STATUSITEMS.BURROWING.TOOLTIP), !is_baby).Add(new LayEggStates.Def(), true).Add(new EatStates.Def(), true).Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true).Add(new CallAdultStates.Def(), true).PopInterruptGroup().Add(new IdleStates.Def(), true);

        string adultId           = "HatchHard";
        string eggId             = "HatchHardBaby";
        string eggName           = "Stone Hatchling Egg";
        string anim_egg          = "egg_hatch_kanim";
        float  egg_mass          = 2f;
        string dropOnMature      = null;
        float  fertility_cycles  = 60f;
        float  incubation_cycles = 20f;
        int    egg_sortorder     = 2;
        List <FertilityMonitor.BreedingChance> egg_chances = new List <FertilityMonitor.BreedingChance>();

        egg_chances.Add(BreedingChance("HatchHardEgg", 1f));
        bool  is_ranchable = true;
        bool  is_fish      = false;
        float egg_scale    = 1f;

        float            calories_per_KG = 700000f / 140f;
        float            min_poop_KG     = 25;
        List <Diet.Info> diet_list       = BaseHatchConfig.HardRockDiet(SimHashes.Carbon.CreateTag(), calories_per_KG, TUNING.CREATURES.CONVERSION_EFFICIENCY.NORMAL, null, 0f);
        // end of configurations

        // basic generation
        object    obj           = Activator.CreateInstance(typeof(HatchHardConfig));
        KPrefabID obj_kPrefabID = (obj as HatchHardConfig).CreatePrefab().GetComponent <KPrefabID>();

        obj_kPrefabID.prefabInitFn  += (obj as HatchHardConfig).OnPrefabInit;
        obj_kPrefabID.prefabSpawnFn += (obj as HatchHardConfig).OnSpawn;
        Assets.AddPrefab(obj_kPrefabID);

        // advanced generation
        // critter = BaseHatchConfig.BaseHatch(id, name, desc, anim_file, traitId, is_baby, override_prefix);
        GameObject critter;

        critter = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, Assets.GetAnim(anim_file), "idle_loop", Grid.SceneLayer.Creatures, width, height, decor, default(EffectorValues), SimHashes.Creature, null, tempBorn);
        EntityTemplates.ExtendEntityToBasicCreature(critter, FactionManager.FactionID.Pest, traitId, navGridName, navi, 32, moveSpeed, dropOnDeath, dropCount, canDrown, canCrushed, tempLowWarning, tempHighWarning, tempLowDeath, tempHighDeath);
        if (override_prefix != null)
        {
            critter.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), override_prefix, null, 0);
        }
        critter.AddOrGet <Trappable>();
        critter.AddOrGetDef <CreatureFallMonitor.Def>();
        critter.AddOrGetDef <BurrowMonitor.Def>();
        critter.AddOrGetDef <WorldSpawnableMonitor.Def>().adjustSpawnLocationCb = (int cell) => { return(cell); };//new Func<int, int>(BaseHatchConfig.AdjustSpawnLocationCB);
        critter.AddOrGetDef <ThreatMonitor.Def>().fleethresholdState            = Health.HealthState.Dead;
        critter.AddWeapon(attackValue, attackValue, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0f);
        EntityTemplates.CreateAndRegisterBaggedCreature(critter, pickup_only_from_top, pickup_allow_mark, pickup_use_gun);
        KPrefabID prefabID = critter.GetComponent <KPrefabID>();

        prefabID.AddTag(tag, false);
        prefabID.prefabInitFn += delegate(GameObject inst) { inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost); };
        EntityTemplates.AddCreatureBrain(critter, chore_table, species, override_prefix);

        EntityTemplates.ExtendEntityToWildCreature(critter, space_requirement, lifespan);

        Diet diet = new Diet(diet_list.ToArray());

        CreatureCalorieMonitor.Def calorieMonitor = critter.AddOrGetDef <CreatureCalorieMonitor.Def>();
        calorieMonitor.diet = diet;
        calorieMonitor.minPoopSizeInCalories = calories_per_KG * min_poop_KG;
        critter.AddOrGetDef <SolidConsumerMonitor.Def>().diet = diet;

        if (is_baby)
        {
            EntityTemplates.ExtendEntityToBeingABaby(critter, adultId, dropOnMature);
        }
        else
        {
            EntityTemplates.ExtendEntityToFertileCreature(critter, eggId, eggName, desc, anim_egg,
                                                          egg_mass, eggId, fertility_cycles,
                                                          incubation_cycles, egg_chances,
                                                          egg_sortorder, is_ranchable, is_fish, true, egg_scale);
        }
    }
Beispiel #17
0
        private void CreateStatusItems()
        {
            Hot = new StatusItem("Hot", "CREATURES", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            Hot.resolveStringCallback = delegate(string str, object data)
            {
                TemperatureVulnerable temperatureVulnerable4 = (TemperatureVulnerable)data;
                return(string.Format(str, GameUtil.GetFormattedTemperature(temperatureVulnerable4.internalTemperatureWarning_Low, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false), GameUtil.GetFormattedTemperature(temperatureVulnerable4.internalTemperatureWarning_High, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)));
            };
            Hot_Crop = new StatusItem("Hot_Crop", "CREATURES", "status_item_plant_temperature", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            Hot_Crop.resolveStringCallback = delegate(string str, object data)
            {
                TemperatureVulnerable temperatureVulnerable3 = (TemperatureVulnerable)data;
                str = str.Replace("{low_temperature}", GameUtil.GetFormattedTemperature(temperatureVulnerable3.internalTemperatureWarning_Low, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                str = str.Replace("{high_temperature}", GameUtil.GetFormattedTemperature(temperatureVulnerable3.internalTemperatureWarning_High, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                return(str);
            };
            Scalding = new StatusItem("Scalding", "CREATURES", string.Empty, StatusItem.IconType.Exclamation, NotificationType.DuplicantThreatening, true, OverlayModes.None.ID, true, 129022);
            Scalding.resolveTooltipCallback = delegate(string str, object data)
            {
                float averageExternalTemperature = ((ExternalTemperatureMonitor.Instance)data).AverageExternalTemperature;
                float scaldingThreshold          = ((ExternalTemperatureMonitor.Instance)data).GetScaldingThreshold();
                str = str.Replace("{ExternalTemperature}", GameUtil.GetFormattedTemperature(averageExternalTemperature, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                str = str.Replace("{TargetTemperature}", GameUtil.GetFormattedTemperature(scaldingThreshold, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                return(str);
            };
            Scalding.AddNotification(null, null, null, 0f);
            Cold = new StatusItem("Cold", "CREATURES", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            Cold.resolveStringCallback = delegate(string str, object data)
            {
                TemperatureVulnerable temperatureVulnerable2 = (TemperatureVulnerable)data;
                return(string.Format(str, GameUtil.GetFormattedTemperature(temperatureVulnerable2.internalTemperatureWarning_Low, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false), GameUtil.GetFormattedTemperature(temperatureVulnerable2.internalTemperatureWarning_High, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)));
            };
            Cold_Crop = new StatusItem("Cold_Crop", "CREATURES", "status_item_plant_temperature", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            Cold_Crop.resolveStringCallback = delegate(string str, object data)
            {
                TemperatureVulnerable temperatureVulnerable = (TemperatureVulnerable)data;
                str = str.Replace("low_temperature", GameUtil.GetFormattedTemperature(temperatureVulnerable.internalTemperatureWarning_Low, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                str = str.Replace("high_temperature", GameUtil.GetFormattedTemperature(temperatureVulnerable.internalTemperatureWarning_High, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                return(str);
            };
            Crop_Too_Dark = new StatusItem("Crop_Too_Dark", "CREATURES", "status_item_plant_light", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            Crop_Too_Dark.resolveStringCallback = ((string str, object data) => str);
            Crop_Too_Bright = new StatusItem("Crop_Too_Bright", "CREATURES", "status_item_plant_light", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            Crop_Too_Bright.resolveStringCallback = ((string str, object data) => str);
            Hyperthermia = new StatusItem("Hyperthermia", "CREATURES", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 129022);
            Hyperthermia.resolveTooltipCallback = delegate(string str, object data)
            {
                float value2 = ((TemperatureMonitor.Instance)data).temperature.value;
                float hyperthermiaThreshold = ((TemperatureMonitor.Instance)data).HyperthermiaThreshold;
                str = str.Replace("{InternalTemperature}", GameUtil.GetFormattedTemperature(value2, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                str = str.Replace("{TargetTemperature}", GameUtil.GetFormattedTemperature(hyperthermiaThreshold, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                return(str);
            };
            Hypothermia = new StatusItem("Hypothermia", "CREATURES", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 129022);
            Hypothermia.resolveTooltipCallback = delegate(string str, object data)
            {
                float value = ((TemperatureMonitor.Instance)data).temperature.value;
                float hypothermiaThreshold = ((TemperatureMonitor.Instance)data).HypothermiaThreshold;
                str = str.Replace("{InternalTemperature}", GameUtil.GetFormattedTemperature(value, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                str = str.Replace("{TargetTemperature}", GameUtil.GetFormattedTemperature(hypothermiaThreshold, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                return(str);
            };
            Suffocating = new StatusItem("Suffocating", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            Hatching    = new StatusItem("Hatching", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            Incubating  = new StatusItem("Incubating", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            Drowning    = new StatusItem("Drowning", "CREATURES", "status_item_flooded", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            Drowning.resolveStringCallback = ((string str, object data) => str);
            Saturated = new StatusItem("Saturated", "CREATURES", "status_item_flooded", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            Saturated.resolveStringCallback = ((string str, object data) => str);
            DryingOut = new StatusItem("DryingOut", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 1026);
            DryingOut.resolveStringCallback = ((string str, object data) => str);
            ReadyForHarvest = new StatusItem("ReadyForHarvest", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 1026);
            Growing         = new StatusItem("Growing", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 1026);
            Growing.resolveStringCallback = delegate(string str, object data)
            {
                Crop component = ((Growing)data).GetComponent <Crop>();
                if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                {
                    float seconds = ((Growing)data).TimeUntilNextHarvest();
                    str = str.Replace("{TimeUntilNextHarvest}", GameUtil.GetFormattedCycles(seconds, "F1"));
                }
                float val = 100f * ((Growing)data).PercentGrown();
                str = str.Replace("{PercentGrow}", Math.Floor((double)Math.Max(val, 0f)).ToString("F0"));
                return(str);
            };
            CropSleeping = new StatusItem("Crop_Sleeping", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 1026);
            CropSleeping.resolveStringCallback = delegate(string str, object data)
            {
                CropSleepingMonitor.Instance instance8 = (CropSleepingMonitor.Instance)data;
                return(str.Replace("{REASON}", (!instance8.def.prefersDarkness) ? CREATURES.STATUSITEMS.CROP_SLEEPING.REASON_TOO_DARK : CREATURES.STATUSITEMS.CROP_SLEEPING.REASON_TOO_BRIGHT));
            };
            CropSleeping.resolveTooltipCallback = delegate(string str, object data)
            {
                CropSleepingMonitor.Instance instance7 = (CropSleepingMonitor.Instance)data;
                string newValue4 = string.Format(CREATURES.STATUSITEMS.CROP_SLEEPING.REQUIREMENT_LUMINANCE, instance7.def.lightIntensityThreshold);
                return(str.Replace("{REQUIREMENTS}", newValue4));
            };
            EnvironmentTooWarm = new StatusItem("EnvironmentTooWarm", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            EnvironmentTooWarm.resolveStringCallback = delegate(string str, object data)
            {
                float temp3 = Grid.Temperature[Grid.PosToCell(((TemperatureVulnerable)data).gameObject)];
                float temp4 = ((TemperatureVulnerable)data).internalTemperatureLethal_High - 1f;
                str = str.Replace("{ExternalTemperature}", GameUtil.GetFormattedTemperature(temp3, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                str = str.Replace("{TargetTemperature}", GameUtil.GetFormattedTemperature(temp4, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                return(str);
            };
            EnvironmentTooCold = new StatusItem("EnvironmentTooCold", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            EnvironmentTooCold.resolveStringCallback = delegate(string str, object data)
            {
                float temp  = Grid.Temperature[Grid.PosToCell(((TemperatureVulnerable)data).gameObject)];
                float temp2 = ((TemperatureVulnerable)data).internalTemperatureLethal_Low + 1f;
                str = str.Replace("{ExternalTemperature}", GameUtil.GetFormattedTemperature(temp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                str = str.Replace("{TargetTemperature}", GameUtil.GetFormattedTemperature(temp2, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false));
                return(str);
            };
            Entombed = new StatusItem("Entombed", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            Entombed.resolveStringCallback  = ((string str, object go) => str);
            Entombed.resolveTooltipCallback = delegate(string str, object go)
            {
                GameObject go2 = go as GameObject;
                return(string.Format(str, GameUtil.GetIdentityDescriptor(go2)));
            };
            Wilting = new StatusItem("Wilting", "CREATURES", "status_item_need_plant", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 1026);
            Wilting.resolveStringCallback = delegate(string str, object data)
            {
                if (data is Growing && data != null)
                {
                    str = str.Replace("{TimeUntilNextHarvest}", GameUtil.GetFormattedCycles(Mathf.Min(((Growing)data).growthTime, ((Growing)data).TimeUntilNextHarvest()), "F1"));
                }
                str = str.Replace("{Reasons}", (data as KMonoBehaviour).GetComponent <WiltCondition>().WiltCausesString());
                return(str);
            };
            WiltingDomestic = new StatusItem("WiltingDomestic", "CREATURES", "status_item_need_plant", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 1026);
            WiltingDomestic.resolveStringCallback = delegate(string str, object data)
            {
                if (data is Growing && data != null)
                {
                    str = str.Replace("{TimeUntilNextHarvest}", GameUtil.GetFormattedCycles(Mathf.Min(((Growing)data).growthTime, ((Growing)data).TimeUntilNextHarvest()), "F1"));
                }
                str = str.Replace("{Reasons}", (data as KMonoBehaviour).GetComponent <WiltCondition>().WiltCausesString());
                return(str);
            };
            WiltingNonGrowing = new StatusItem("WiltingNonGrowing", "CREATURES", "status_item_need_plant", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 1026);
            WiltingNonGrowing.resolveStringCallback = delegate(string str, object data)
            {
                str = CREATURES.STATUSITEMS.WILTING_NON_GROWING_PLANT.NAME;
                str = str.Replace("{Reasons}", (data as WiltCondition).WiltCausesString());
                return(str);
            };
            WiltingNonGrowingDomestic = new StatusItem("WiltingNonGrowing", "CREATURES", "status_item_need_plant", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 1026);
            WiltingNonGrowingDomestic.resolveStringCallback = delegate(string str, object data)
            {
                str = CREATURES.STATUSITEMS.WILTING_NON_GROWING_PLANT.NAME;
                str = str.Replace("{Reasons}", (data as WiltCondition).WiltCausesString());
                return(str);
            };
            WrongAtmosphere = new StatusItem("WrongAtmosphere", "CREATURES", "status_item_plant_atmosphere", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            WrongAtmosphere.resolveStringCallback = delegate(string str, object data)
            {
                string text = string.Empty;
                foreach (Element safe_atmosphere in (data as PressureVulnerable).safe_atmospheres)
                {
                    text = text + "\n    •  " + safe_atmosphere.name;
                }
                str = str.Replace("{elements}", text);
                return(str);
            };
            AtmosphericPressureTooLow = new StatusItem("AtmosphericPressureTooLow", "CREATURES", "status_item_plant_atmosphere", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            AtmosphericPressureTooLow.resolveStringCallback = delegate(string str, object data)
            {
                PressureVulnerable pressureVulnerable2 = (PressureVulnerable)data;
                str = str.Replace("{low_mass}", GameUtil.GetFormattedMass(pressureVulnerable2.pressureWarning_Low, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                str = str.Replace("{high_mass}", GameUtil.GetFormattedMass(pressureVulnerable2.pressureWarning_High, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                return(str);
            };
            AtmosphericPressureTooHigh = new StatusItem("AtmosphericPressureTooHigh", "CREATURES", "status_item_plant_atmosphere", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            AtmosphericPressureTooHigh.resolveStringCallback = delegate(string str, object data)
            {
                PressureVulnerable pressureVulnerable = (PressureVulnerable)data;
                str = str.Replace("{low_mass}", GameUtil.GetFormattedMass(pressureVulnerable.pressureWarning_Low, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                str = str.Replace("{high_mass}", GameUtil.GetFormattedMass(pressureVulnerable.pressureWarning_High, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                return(str);
            };
            HealthStatus = new StatusItem("HealthStatus", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            HealthStatus.resolveStringCallback = delegate(string str, object data)
            {
                string newValue3 = string.Empty;
                switch ((Health.HealthState)data)
                {
                case Health.HealthState.Perfect:
                    newValue3 = MISC.STATUSITEMS.HEALTHSTATUS.PERFECT.NAME;
                    break;

                case Health.HealthState.Scuffed:
                    newValue3 = MISC.STATUSITEMS.HEALTHSTATUS.SCUFFED.NAME;
                    break;

                case Health.HealthState.Injured:
                    newValue3 = MISC.STATUSITEMS.HEALTHSTATUS.INJURED.NAME;
                    break;

                case Health.HealthState.Critical:
                    newValue3 = MISC.STATUSITEMS.HEALTHSTATUS.CRITICAL.NAME;
                    break;

                case Health.HealthState.Incapacitated:
                    newValue3 = MISC.STATUSITEMS.HEALTHSTATUS.INCAPACITATED.NAME;
                    break;

                case Health.HealthState.Dead:
                    newValue3 = MISC.STATUSITEMS.HEALTHSTATUS.DEAD.NAME;
                    break;
                }
                str = str.Replace("{healthState}", newValue3);
                return(str);
            };
            HealthStatus.resolveTooltipCallback = delegate(string str, object data)
            {
                string newValue2 = string.Empty;
                switch ((Health.HealthState)data)
                {
                case Health.HealthState.Perfect:
                    newValue2 = MISC.STATUSITEMS.HEALTHSTATUS.PERFECT.TOOLTIP;
                    break;

                case Health.HealthState.Scuffed:
                    newValue2 = MISC.STATUSITEMS.HEALTHSTATUS.SCUFFED.TOOLTIP;
                    break;

                case Health.HealthState.Injured:
                    newValue2 = MISC.STATUSITEMS.HEALTHSTATUS.INJURED.TOOLTIP;
                    break;

                case Health.HealthState.Critical:
                    newValue2 = MISC.STATUSITEMS.HEALTHSTATUS.CRITICAL.TOOLTIP;
                    break;

                case Health.HealthState.Incapacitated:
                    newValue2 = MISC.STATUSITEMS.HEALTHSTATUS.INCAPACITATED.TOOLTIP;
                    break;

                case Health.HealthState.Dead:
                    newValue2 = MISC.STATUSITEMS.HEALTHSTATUS.DEAD.TOOLTIP;
                    break;
                }
                str = str.Replace("{healthState}", newValue2);
                return(str);
            };
            Barren          = new StatusItem("Barren", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            NeedsFertilizer = new StatusItem("NeedsFertilizer", "CREATURES", "status_item_plant_solid", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            Func <string, object, string> resolveStringCallback = (string str, object data) => str;

            NeedsFertilizer.resolveStringCallback = resolveStringCallback;
            NeedsIrrigation = new StatusItem("NeedsIrrigation", "CREATURES", "status_item_plant_liquid", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, false, 129022);
            Func <string, object, string> resolveStringCallback2 = (string str, object data) => str;

            NeedsIrrigation.resolveStringCallback = resolveStringCallback2;
            WrongFertilizer = new StatusItem("WrongFertilizer", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            Func <string, object, string> resolveStringCallback3 = (string str, object data) => str;

            WrongFertilizer.resolveStringCallback = resolveStringCallback3;
            WrongFertilizerMajor = new StatusItem("WrongFertilizerMajor", "CREATURES", "status_item_fabricator_empty", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            WrongFertilizerMajor.resolveStringCallback = resolveStringCallback3;
            WrongIrrigation = new StatusItem("WrongIrrigation", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            Func <string, object, string> resolveStringCallback4 = (string str, object data) => str;

            WrongIrrigation.resolveStringCallback = resolveStringCallback4;
            WrongIrrigationMajor = new StatusItem("WrongIrrigationMajor", "CREATURES", "status_item_fabricator_empty", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            WrongIrrigationMajor.resolveStringCallback = resolveStringCallback4;
            CantAcceptFertilizer = new StatusItem("CantAcceptFertilizer", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            Rotting = new StatusItem("Rotting", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            Rotting.resolveStringCallback = ((string str, object data) => str.Replace("{RotTemperature}", GameUtil.GetFormattedTemperature(277.15f, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)));
            Fresh = new StatusItem("Fresh", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            Fresh.resolveStringCallback = delegate(string str, object data)
            {
                Rottable.Instance instance6 = (Rottable.Instance)data;
                return(str.Replace("{RotPercentage}", "(" + Util.FormatWholeNumber(instance6.RotConstitutionPercentage * 100f) + "%)"));
            };
            Fresh.resolveTooltipCallback = delegate(string str, object data)
            {
                Rottable.Instance instance5 = (Rottable.Instance)data;
                return(str.Replace("{RotTooltip}", instance5.GetToolTip()));
            };
            Stale = new StatusItem("Stale", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            Stale.resolveStringCallback = delegate(string str, object data)
            {
                Rottable.Instance instance4 = (Rottable.Instance)data;
                return(str.Replace("{RotPercentage}", "(" + Util.FormatWholeNumber(instance4.RotConstitutionPercentage * 100f) + "%)"));
            };
            Stale.resolveTooltipCallback = delegate(string str, object data)
            {
                Rottable.Instance instance3 = (Rottable.Instance)data;
                return(str.Replace("{RotTooltip}", instance3.GetToolTip()));
            };
            Spoiled        = new StatusItem("Spoiled", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            Refrigerated   = new StatusItem("Refrigerated", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            Unrefrigerated = new StatusItem("Unrefrigerated", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            Unrefrigerated.resolveStringCallback = ((string str, object data) => str.Replace("{RotTemperature}", GameUtil.GetFormattedTemperature(277.15f, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)));
            SterilizingAtmosphere  = new StatusItem("SterilizingAtmosphere", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            ContaminatedAtmosphere = new StatusItem("ContaminatedAtmosphere", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            Old = new StatusItem("Old", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            Old.resolveTooltipCallback = delegate(string str, object data)
            {
                AgeMonitor.Instance instance2 = (AgeMonitor.Instance)data;
                return(str.Replace("{TimeUntilDeath}", GameUtil.GetFormattedCycles(instance2.CyclesUntilDeath * 600f, "F1")));
            };
            ExchangingElementConsume = new StatusItem("ExchangingElementConsume", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            ExchangingElementConsume.resolveStringCallback = delegate(string str, object data)
            {
                EntityElementExchanger.StatesInstance statesInstance4 = (EntityElementExchanger.StatesInstance)data;
                str = str.Replace("{ConsumeElement}", ElementLoader.FindElementByHash(statesInstance4.master.consumedElement).tag.ProperName());
                str = str.Replace("{ConsumeRate}", GameUtil.GetFormattedMass(statesInstance4.master.consumeRate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                return(str);
            };
            ExchangingElementConsume.resolveTooltipCallback = delegate(string str, object data)
            {
                EntityElementExchanger.StatesInstance statesInstance3 = (EntityElementExchanger.StatesInstance)data;
                str = str.Replace("{ConsumeElement}", ElementLoader.FindElementByHash(statesInstance3.master.consumedElement).tag.ProperName());
                str = str.Replace("{ConsumeRate}", GameUtil.GetFormattedMass(statesInstance3.master.consumeRate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                return(str);
            };
            ExchangingElementOutput = new StatusItem("ExchangingElementOutput", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            ExchangingElementOutput.resolveStringCallback = delegate(string str, object data)
            {
                EntityElementExchanger.StatesInstance statesInstance2 = (EntityElementExchanger.StatesInstance)data;
                str = str.Replace("{OutputElement}", ElementLoader.FindElementByHash(statesInstance2.master.emittedElement).tag.ProperName());
                str = str.Replace("{OutputRate}", GameUtil.GetFormattedMass(statesInstance2.master.consumeRate * statesInstance2.master.exchangeRatio, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                return(str);
            };
            ExchangingElementOutput.resolveTooltipCallback = delegate(string str, object data)
            {
                EntityElementExchanger.StatesInstance statesInstance = (EntityElementExchanger.StatesInstance)data;
                str = str.Replace("{OutputElement}", ElementLoader.FindElementByHash(statesInstance.master.emittedElement).tag.ProperName());
                str = str.Replace("{OutputRate}", GameUtil.GetFormattedMass(statesInstance.master.consumeRate * statesInstance.master.exchangeRatio, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                return(str);
            };
            Hungry = new StatusItem("Hungry", "CREATURES", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            Hungry.resolveTooltipCallback = delegate(string str, object data)
            {
                CreatureCalorieMonitor.Instance instance = (CreatureCalorieMonitor.Instance)data;
                CreatureCalorieMonitor.Def      def      = instance.master.gameObject.GetDef <CreatureCalorieMonitor.Def>();
                Diet diet = def.diet;
                if (diet.consumedTags.Count > 0)
                {
                    string[] array = (from t in diet.consumedTags
                                      select t.Key.ProperName()).ToArray();
                    if (array.Length > 3)
                    {
                        string[] array2 = new string[4]
                        {
                            array[0],
                            array[1],
                            array[2],
                            "..."
                        };
                        array = array2;
                    }
                    string newValue = string.Join(", ", array);
                    return(str + "\n" + UI.BUILDINGEFFECTS.DIET_CONSUMED.text.Replace("{Foodlist}", newValue));
                }
                return(str);
            };
        }