示例#1
0
    public GameObject CreatePrefab()
    {
        string         id          = "BeanPlant";
        string         name        = STRINGS.CREATURES.SPECIES.BEAN_PLANT.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.BEAN_PLANT.DESC;
        float          mass        = 2f;
        KAnimFile      anim        = Assets.GetAnim("beanplant_kanim");
        string         initialAnim = "idle_empty";
        EffectorValues tIER        = DECOR.BONUS.TIER1;
        GameObject     gameObject  = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, null, 258.15f);

        EntityTemplates.ExtendEntityToBasicPlant(gameObject, 198.15f, 248.15f, 273.15f, 323.15f, null, true, 0f, 0.15f, "BeanPlantSeed", true, true, true, true, 2400f);
        EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = SimHashes.Ethanol.CreateTag(),
                massConsumptionRate = 0.0333333351f
            }
        });
        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = SimHashes.Dirt.CreateTag(),
                massConsumptionRate = 0.008333334f
            }
        });
        PressureVulnerable pressureVulnerable  = gameObject.AddOrGet <PressureVulnerable>();
        PressureVulnerable pressureVulnerable2 = pressureVulnerable;

        mass = 0.025f;
        float pressureLethalLow = 0f;

        SimHashes[] safeAtmospheres = new SimHashes[1]
        {
            SimHashes.CarbonDioxide
        };
        pressureVulnerable2.Configure(mass, pressureLethalLow, 10f, 30f, safeAtmospheres);
        UprootedMonitor component = gameObject.GetComponent <UprootedMonitor>();

        component.monitorCell = new CellOffset(0, -1);
        gameObject.AddOrGet <StandardCropPlant>();
        GameObject plant = gameObject;

        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Harvest;
        initialAnim = "BeanPlantSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.BEAN_PLANT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.BEAN_PLANT.DESC;
        anim        = Assets.GetAnim("seed_beanplant_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.CropSeed);
        list = list;
        GameObject gameObject2 = EntityTemplates.CreateAndRegisterSeedForPlant(plant, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 4, STRINGS.CREATURES.SPECIES.BEAN_PLANT.DOMESTICATEDDESC, EntityTemplates.CollisionShape.RECTANGLE, 0.6f, 0.3f, null, string.Empty, false);

        EntityTemplates.ExtendEntityToFood(gameObject2, FOOD.FOOD_TYPES.BEAN);
        EntityTemplates.CreateAndRegisterPreviewForPlant(gameObject2, "BeanPlant_preview", Assets.GetAnim("beanplant_kanim"), "place", 1, 2);
        return(gameObject);
    }
    private bool check_pressure(GameObject go)
    {
        PressureVulnerable component = go.GetComponent <PressureVulnerable>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            return(component.ExternalPressureState == PressureVulnerable.PressureState.Normal);
        }
        return(true);
    }
    private bool check_atmosphere(GameObject go)
    {
        PressureVulnerable component = go.GetComponent <PressureVulnerable>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            return(component.IsSafeElement(Grid.Element[Grid.PosToCell(go)]));
        }
        return(true);
    }
    private string GetAtmosphereTooltip(GameObject go)
    {
        PressureVulnerable component = go.GetComponent <PressureVulnerable>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            return(UI.TOOLTIPS.VITALS_CHECKBOX_ATMOSPHERE.text.Replace("{element}", component.ExternalElement.name));
        }
        return(UI.TOOLTIPS.VITALS_CHECKBOX_ATMOSPHERE);
    }
    private string GetAirPressureTooltip(GameObject go)
    {
        PressureVulnerable component = go.GetComponent <PressureVulnerable>();

        if ((UnityEngine.Object)component == (UnityEngine.Object)null)
        {
            return(string.Empty);
        }
        return(UI.TOOLTIPS.VITALS_CHECKBOX_PRESSURE.text.Replace("{pressure}", GameUtil.GetFormattedMass(component.GetExternalPressure(), GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")));
    }
    private string GetAtmosphereLabel(GameObject go)
    {
        PressureVulnerable component = go.GetComponent <PressureVulnerable>();
        string             text      = UI.VITALSSCREEN.ATMOSPHERE_CONDITION;

        foreach (Element safe_atmosphere in component.safe_atmospheres)
        {
            text = text + "\n    • " + safe_atmosphere.name;
        }
        return(text);
    }
示例#7
0
        };                                                                                                                                                                                     //wilt1, grow_seed

        public static void ProcessPlant(GameObject plant)
        {
            PlantData setting = CustomizePlantsState.StateManager.State.PlantSettings?.FirstOrDefault(t => t.id == plant.name);

            if (setting == null)
            {
                return;
            }

            #region decor plant fixes
            if (setting.fruitId != null)    //decor plant fixes
            {
                PrickleGrass grass = plant.GetComponent <PrickleGrass>();
                if (grass != null || plant.name == ColdBreatherConfig.ID || plant.name == EvilFlowerConfig.ID)
                {
                    UnityEngine.Object.DestroyImmediate(grass); //what happens if this is null?
                    plant.AddOrGet <StandardCropPlant>();

                    KPrefabID prefab = plant.GetComponent <KPrefabID>();
                    prefab.prefabInitFn += (inst =>
                    {
                        StandardCropPlant stdcrop2 = inst.GetComponent <StandardCropPlant>();
                        stdcrop2.anims = PlantHelper.DecorAnim;
                    });

                    //KBatchedAnimController kbatchedAnimController = plant.AddOrGet<KBatchedAnimController>();
                    //kbatchedAnimController.AnimFiles = new KAnimFile[1]
                    //{
                    //  Assets.GetAnim("bristleblossom_kanim")
                    //};
                    //kbatchedAnimController.initialAnim = "idle_empty";
                }

                SeedProducer seed = plant.GetComponent <SeedProducer>();
                if (seed != null)
                {
                    seed.seedInfo.productionType   = SeedProducer.ProductionType.Harvest;
                    seed.seedInfo.newSeedsProduced = 1;
                }
            }
            #endregion
            #region fruitId
            if (setting.fruitId != null || setting.fruit_grow_time != null || setting.fruit_amount != null)    //actual setting fruit
            {
                Crop         crop    = plant.AddOrGet <Crop>();
                Crop.CropVal cropval = crop.cropVal;   //this is a copy
                if (setting.fruitId != null)
                {
                    cropval.cropId = setting.fruitId;
                }
                if (cropval.cropId == "")
                {
                    cropval.cropId = "WoodLog";
                }
                if (setting.fruit_grow_time != null)
                {
                    cropval.cropDuration = (float)setting.fruit_grow_time;
                }
                if (cropval.cropDuration < 1f)
                {
                    cropval.cropDuration = 1f;
                }
                if (setting.fruit_amount != null)
                {
                    cropval.numProduced = (int)setting.fruit_amount;
                }
                if (cropval.numProduced < 1)
                {
                    cropval.numProduced = 1;
                }
                crop.Configure(cropval);

                KPrefabID prefab = plant.GetComponent <KPrefabID>();
                GeneratedBuildings.RegisterWithOverlay(OverlayScreen.HarvestableIDs, prefab.PrefabID().ToString());
                Growing growing = plant.AddOrGet <Growing>();
                growing.growthTime = cropval.cropDuration;
                if (setting.id != ForestTreeConfig.ID)  // don't harvest arbor trees directly
                {
                    plant.AddOrGet <Harvestable>();
                }
                plant.AddOrGet <HarvestDesignatable>();
                plant.AddOrGet <StandardCropPlant>();
            }
            #endregion
            #region irrigation
            if (setting.irrigation != null)
            {
                RemoveIrrigation(plant);

                List <PlantElementAbsorber.ConsumeInfo> irrigation    = new List <PlantElementAbsorber.ConsumeInfo>(3);
                List <PlantElementAbsorber.ConsumeInfo> fertilization = new List <PlantElementAbsorber.ConsumeInfo>(3);
                foreach (KeyValuePair <string, float> entry in setting.irrigation)
                {
                    if (GameTags.LiquidElements.Contains(entry.Key))
                    {
                        irrigation.Add(new PlantElementAbsorber.ConsumeInfo(entry.Key, entry.Value / 600f));
                    }
                    else if (GameTags.SolidElements.Contains(entry.Key))
                    {
                        fertilization.Add(new PlantElementAbsorber.ConsumeInfo(entry.Key, entry.Value / 600f));
                    }
                    else
                    {
                        Debug.Log(ToDialog("Irrigation for " + setting.id + " defines bad element: " + entry.Key));
                    }
                }
                if (irrigation.Count > 0)
                {
                    EntityTemplates.ExtendPlantToIrrigated(plant, irrigation.ToArray());
                }
                if (fertilization.Count > 0)
                {
                    EntityTemplates.ExtendPlantToFertilizable(plant, fertilization.ToArray());
                }
            }
            #endregion
            #region illumination
            if (setting.illumination != null)
            {
                IlluminationVulnerable  illumination = plant.GetComponent <IlluminationVulnerable>();
                CropSleepingMonitor.Def cropSleep    = plant.GetDef <CropSleepingMonitor.Def>();

                if (setting.illumination == 0f)
                {
                    if (illumination != null)
                    {
                        UnityEngine.Object.DestroyImmediate(illumination);
                    }
                    if (cropSleep != null)
                    {
                        FumLib.FumTools.RemoveDef(plant, cropSleep);
                    }
                }
                else if (setting.illumination < 0f)
                {
                    if (illumination == null)
                    {
                        illumination = plant.AddOrGet <IlluminationVulnerable>();
                    }
                    if (cropSleep != null)
                    {
                        FumLib.FumTools.RemoveDef(plant, cropSleep);
                    }

                    illumination.SetPrefersDarkness(true);
                }
                else if (setting.illumination == 1f)
                {
                    if (illumination == null)
                    {
                        illumination = plant.AddOrGet <IlluminationVulnerable>();
                    }
                    if (cropSleep != null)
                    {
                        FumLib.FumTools.RemoveDef(plant, cropSleep);
                    }

                    illumination.SetPrefersDarkness(false);
                }
                else
                {
                    if (illumination != null)
                    {
                        UnityEngine.Object.DestroyImmediate(illumination);
                    }
                    if (cropSleep == null)
                    {
                        cropSleep = plant.AddOrGetDef <CropSleepingMonitor.Def>();
                    }

                    cropSleep.lightIntensityThreshold = (float)setting.illumination;
                    cropSleep.prefersDarkness         = false;
                }
            }
            #endregion
            #region safe_elements
            if (setting.safe_elements != null)
            {
                plant.GetComponent <KPrefabID>().prefabInitFn += (inst =>
                {
                    PressureVulnerable pressure = inst.GetComponent <PressureVulnerable>();
                    pressure.safe_atmospheres.Clear();

                    foreach (string safe_element in setting.safe_elements)
                    {
                        pressure.safe_atmospheres.Add(ElementLoader.FindElementByName(safe_element));
                    }
                });
            }
            #endregion
            #region pressure
            if (setting.pressures != null)
            {
                PressureVulnerable pressure = plant.AddOrGet <PressureVulnerable>();
                pressure.pressureLethal_Low   = 0f;
                pressure.pressureWarning_Low  = 0f;
                pressure.pressureWarning_High = float.MaxValue;
                pressure.pressureLethal_High  = float.MaxValue;
                pressure.pressure_sensitive   = false;

                for (int i = 0; i < setting.pressures.Length; i++)
                {
                    switch (i)
                    {
                    case 0: pressure.pressureLethal_Low = setting.pressures[i]; pressure.pressure_sensitive = true; break;

                    case 1: pressure.pressureWarning_Low = setting.pressures[i]; break;

                    case 2: pressure.pressureWarning_High = setting.pressures[i]; break;

                    case 3: pressure.pressureLethal_High = setting.pressures[i]; break;
                    }
                }
            }
            #endregion
            #region decor
            try {
                if (setting.decor_value != null)
                {
                    plant.GetComponent <DecorProvider>().baseDecor = (float)setting.decor_value;
                }

                if (setting.decor_radius != null)
                {
                    plant.GetComponent <DecorProvider>().baseRadius = (float)setting.decor_radius;
                }
            } catch (Exception) {
                Debug.LogWarning("[CustomizePlants] For some weird reason " + plant.name + " has no DecorProvider.");
            }
            #endregion
            #region temperatures
            if (setting.temperatures != null)
            {
                TemperatureVulnerable temperature = plant.AddOrGet <TemperatureVulnerable>();

                for (int i = 0; i < setting.temperatures.Length; i++)
                {
                    switch (i)
                    {
                    case 0: temperature.internalTemperatureLethal_Low = setting.temperatures[i]; break;

                    case 1: temperature.internalTemperatureWarning_Low = setting.temperatures[i]; break;

                    case 2: temperature.internalTemperatureWarning_High = setting.temperatures[i]; break;

                    case 3: temperature.internalTemperatureLethal_High = setting.temperatures[i]; break;
                    }
                }
            }
            #endregion
            #region submerged_threshold
            if (setting.submerged_threshold != null)
            {
                DrowningMonitor drowning = plant.AddOrGet <DrowningMonitor>();

                if (setting.submerged_threshold == 0f)   //doesn't care about water
                {
                    UnityEngine.Object.DestroyImmediate(drowning);
                }
                else if (setting.submerged_threshold < 0f)   //needs water
                {
                    drowning.livesUnderWater = true;
                    drowning.canDrownToDeath = false;
                }
                else    //if(setting.submerged_threshold > 0f)  //hates water
                {
                    drowning.livesUnderWater = false;
                    drowning.canDrownToDeath = false;
                }
            }
            #endregion
            #region can_tinker
            if (setting.can_tinker != null)
            {
                if (setting.can_tinker == true)
                {
                    Tinkerable.MakeFarmTinkerable(plant);
                }
            }
            #endregion
            #region require_solid_tile
            if (setting.require_solid_tile != null)
            {
                UprootedMonitor uproot = plant.AddOrGet <UprootedMonitor>();
                if (setting.require_solid_tile == false)
                {
                    UnityEngine.Object.DestroyImmediate(uproot);
                }
            }
            #endregion
            #region max_age
            if (setting.max_age != null && plant.GetComponent <StandardCropPlant>() != null) //only if plant has fruit
            {
                Growing growing = plant.AddOrGet <Growing>();
                if (setting.max_age <= 0)
                {
                    growing.shouldGrowOld = false;
                }
                else
                {
                    growing.shouldGrowOld = true;
                    growing.maxAge        = (float)setting.max_age;
                }
            }
            #endregion
            #region disease
            if (setting.disease != null || setting.disease_amount != null)
            {
                DiseaseDropper.Def def = plant.AddOrGetDef <DiseaseDropper.Def>();
                if (setting.disease != null)
                {
                    def.diseaseIdx = Db.Get().Diseases.GetIndex(setting.disease);
                }
                if (setting.disease_amount != null)
                {
                    def.singleEmitQuantity = (int)setting.disease_amount;
                }

                if (def.diseaseIdx == byte.MaxValue || def.singleEmitQuantity == 0)
                {
                    FumLib.FumTools.RemoveDef(plant, def);
                }
            }
            #endregion
            #region input_element
            if (setting.input_element != null)
            {
                ElementConsumer consumer = plant.AddOrGet <ElementConsumer>();
                Element         element  = ElementLoader.FindElementByName(setting.input_element);

                if (element == null || element.IsSolid)                //invalid element
                {
                    Debug.Log(ToDialog("input_element is bad element: " + setting.input_element));
                    UnityEngine.Object.DestroyImmediate(consumer);
                }
                else if (setting.input_rate <= 0f)   //delete consumer
                {
                    UnityEngine.Object.DestroyImmediate(consumer);
                }
                else
                {
                    consumer.configuration     = ElementConsumer.Configuration.Element;
                    consumer.consumptionRadius = 2;
                    consumer.sampleCellOffset  = new Vector3(0f, 0f);
                    consumer.EnableConsumption(true);
                    consumer.showInStatusPanel = true;
                    consumer.storeOnConsume    = false; //consumer deletes elements; output_element might overrides this
                    consumer.consumptionRate   = (float)setting.input_rate;
                    consumer.elementToConsume  = element.id;
                    consumer.capacityKG        = (float)setting.input_rate * 10;

                    plant.AddOrGet <Storage>().capacityKg = consumer.capacityKG;
                    plant.AddOrGet <SaltPlant>();
                }
            }
            #endregion
            #region output_element
            if (setting.output_element != null)
            {
                ElementConsumer  consumer  = plant.GetComponent <ElementConsumer>();
                ElementConverter converter = plant.AddOrGet <ElementConverter>();
                Element          element   = ElementLoader.FindElementByName(setting.output_element);

                if (element == null)                //invalid element
                {
                    Debug.Log(ToDialog("output_element is bad element: " + setting.output_element));
                    UnityEngine.Object.DestroyImmediate(converter);
                }
                else if (setting.output_rate <= 0f)  //delete converter
                {
                    UnityEngine.Object.DestroyImmediate(converter);
                    if (consumer != null)
                    {
                        consumer.storeOnConsume = false;
                    }
                }
                else
                {
                    if (consumer != null)   //transform elements
                    {
                        consumer.storeOnConsume    = true;
                        converter.consumedElements = new ElementConverter.ConsumedElement[1] {
                            new ElementConverter.ConsumedElement(consumer.elementToConsume.CreateTag(), consumer.consumptionRate)
                        };
                        converter.OutputMultiplier = (float)setting.output_rate / consumer.consumptionRate;
                        //Debug.Log("TAG is: " + consumer.elementToConsume.CreateTag().Name + " SimHash is: " + consumer.elementToConsume.ToString());
                    }
                    else    //create from nothing
                    {
                        converter.consumedElements = new ElementConverter.ConsumedElement[0];
                        converter.OutputMultiplier = 1f;
                    }
                    converter.outputElements = new ElementConverter.OutputElement[1] {
                        new ElementConverter.OutputElement((float)setting.output_rate, element.id, 0f, true, false, 0f, 1f)
                    };

                    plant.AddOrGet <Storage>();
                    plant.AddOrGet <SaltPlant>();
                }
            }
            #endregion
        }
    public GameObject CreatePrefab()
    {
        string         id          = "SaltPlant";
        string         name        = STRINGS.CREATURES.SPECIES.SALTPLANT.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.SALTPLANT.DESC;
        float          mass        = 2f;
        KAnimFile      anim        = Assets.GetAnim("saltplant_kanim");
        string         initialAnim = "idle_empty";
        EffectorValues tIER        = DECOR.PENALTY.TIER1;
        List <Tag>     list        = new List <Tag>();

        list.Add(GameTags.Hanging);
        list = list;
        GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, list, 258.15f);

        EntityTemplates.MakeHangingOffsets(gameObject, 1, 2);
        GameObject template = gameObject;

        mass = 198.15f;
        float temperature_warning_low  = 248.15f;
        float temperature_warning_high = 323.15f;
        float temperature_lethal_high  = 393.15f;

        initialAnim = 381665462.ToString();
        EntityTemplates.ExtendEntityToBasicPlant(template, mass, temperature_warning_low, temperature_warning_high, temperature_lethal_high, null, true, 0f, 0.15f, initialAnim, true, true, true, true, 2400f);
        gameObject.AddOrGet <SaltPlant>();
        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = SimHashes.Sand.CreateTag(),
                massConsumptionRate = 0.0116666667f
            }
        });
        PressureVulnerable pressureVulnerable  = gameObject.AddOrGet <PressureVulnerable>();
        PressureVulnerable pressureVulnerable2 = pressureVulnerable;

        temperature_lethal_high  = 0.025f;
        temperature_warning_high = 0f;
        SimHashes[] safeAtmospheres = new SimHashes[1]
        {
            SimHashes.ChlorineGas
        };
        pressureVulnerable2.Configure(temperature_lethal_high, temperature_warning_high, 10f, 30f, safeAtmospheres);
        KPrefabID component = gameObject.GetComponent <KPrefabID>();

        component.prefabInitFn += delegate(GameObject inst)
        {
            PressureVulnerable component3 = inst.GetComponent <PressureVulnerable>();
            component3.safe_atmospheres.Add(ElementLoader.FindElementByHash(SimHashes.ChlorineGas));
        };
        Storage storage = gameObject.AddOrGet <Storage>();

        storage.showInUI   = false;
        storage.capacityKg = 1f;
        ElementConsumer elementConsumer = gameObject.AddOrGet <ElementConsumer>();

        elementConsumer.showInStatusPanel = true;
        elementConsumer.showDescriptor    = true;
        elementConsumer.storeOnConsume    = false;
        elementConsumer.elementToConsume  = SimHashes.ChlorineGas;
        elementConsumer.configuration     = ElementConsumer.Configuration.Element;
        elementConsumer.consumptionRadius = 4;
        elementConsumer.sampleCellOffset  = new Vector3(0f, -1f);
        elementConsumer.consumptionRate   = 0.006f;
        UprootedMonitor component2 = gameObject.GetComponent <UprootedMonitor>();

        component2.monitorCell = new CellOffset(0, 1);
        gameObject.AddOrGet <StandardCropPlant>();
        template = gameObject;
        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Harvest;
        initialAnim = "SaltPlantSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.SALTPLANT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.SALTPLANT.DESC;
        anim        = Assets.GetAnim("seed_saltplant_kanim");
        list        = new List <Tag>();
        list.Add(GameTags.CropSeed);
        list = list;
        GameObject seed      = EntityTemplates.CreateAndRegisterSeedForPlant(template, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Bottom, default(Tag), 4, STRINGS.CREATURES.SPECIES.SALTPLANT.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.35f, 0.35f, null, string.Empty, false);
        GameObject template2 = EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "SaltPlant_preview", Assets.GetAnim("saltplant_kanim"), "place", 1, 2);

        EntityTemplates.MakeHangingOffsets(template2, 1, 2);
        return(gameObject);
    }
示例#9
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);
            };
        }
示例#10
0
    public GameObject CreatePrefab()
    {
        string         id          = "Oxyfern";
        string         name        = STRINGS.CREATURES.SPECIES.OXYFERN.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.OXYFERN.DESC;
        float          mass        = 1f;
        KAnimFile      anim        = Assets.GetAnim("oxy_fern_kanim");
        string         initialAnim = "idle_full";
        EffectorValues tIER        = DECOR.PENALTY.TIER1;
        GameObject     gameObject  = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingBack, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, null, 293f);

        gameObject.AddOrGet <ReceptacleMonitor>();
        gameObject.AddOrGet <EntombVulnerable>();
        gameObject.AddOrGet <WiltCondition>();
        gameObject.AddOrGet <Prioritizable>();
        gameObject.AddOrGet <Uprootable>();
        gameObject.AddOrGet <UprootedMonitor>();
        gameObject.AddOrGet <DrowningMonitor>();
        TemperatureVulnerable temperatureVulnerable = gameObject.AddOrGet <TemperatureVulnerable>();

        temperatureVulnerable.Configure(273.15f, 253.15f, 313.15f, 373.15f);
        Tag tag = ElementLoader.FindElementByHash(SimHashes.Water).tag;

        EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = tag,
                massConsumptionRate = 0.0316666663f
            }
        });
        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.Dirt,
                massConsumptionRate = 0.006666667f
            }
        });
        gameObject.AddOrGet <Oxyfern>();
        gameObject.AddOrGet <OccupyArea>().objectLayers = new ObjectLayer[1]
        {
            ObjectLayer.Building
        };
        gameObject.AddOrGet <KBatchedAnimController>().randomiseLoopedOffset = true;
        PressureVulnerable pressureVulnerable  = gameObject.AddOrGet <PressureVulnerable>();
        PressureVulnerable pressureVulnerable2 = pressureVulnerable;

        mass = 0.025f;
        float pressureLethalLow = 0f;

        SimHashes[] safeAtmospheres = new SimHashes[1]
        {
            SimHashes.CarbonDioxide
        };
        pressureVulnerable2.Configure(mass, pressureLethalLow, 10f, 30f, safeAtmospheres);
        KPrefabID component = gameObject.GetComponent <KPrefabID>();

        component.prefabInitFn += delegate(GameObject inst)
        {
            PressureVulnerable component2 = inst.GetComponent <PressureVulnerable>();
            component2.safe_atmospheres.Add(ElementLoader.FindElementByHash(SimHashes.CarbonDioxide));
        };
        gameObject.AddOrGet <LoopingSounds>();
        Storage storage = gameObject.AddOrGet <Storage>();

        storage.showInUI   = false;
        storage.capacityKg = 1f;
        ElementConsumer elementConsumer = gameObject.AddOrGet <ElementConsumer>();

        elementConsumer.showInStatusPanel = false;
        elementConsumer.storeOnConsume    = true;
        elementConsumer.storage           = storage;
        elementConsumer.elementToConsume  = SimHashes.CarbonDioxide;
        elementConsumer.configuration     = ElementConsumer.Configuration.Element;
        elementConsumer.consumptionRadius = 2;
        elementConsumer.EnableConsumption(true);
        elementConsumer.sampleCellOffset = new Vector3(0f, 0f);
        elementConsumer.consumptionRate  = 0.000156250011f;
        ElementConverter elementConverter = gameObject.AddOrGet <ElementConverter>();

        elementConverter.OutputMultiplier = 50f;
        elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
        {
            new ElementConverter.ConsumedElement(1960575215.ToString().ToTag(), 0.000625000044f)
        };
        elementConverter.outputElements = new ElementConverter.OutputElement[1]
        {
            new ElementConverter.OutputElement(0.0312500037f, SimHashes.Oxygen, 0f, true, false, 0f, 1f, 0.75f, byte.MaxValue, 0)
        };
        GameObject plant = gameObject;

        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Hidden;
        initialAnim = "OxyfernSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.OXYFERN.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.OXYFERN.DESC;
        anim        = Assets.GetAnim("seed_oxyfern_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.CropSeed);
        list = list;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(plant, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 2, STRINGS.CREATURES.SPECIES.OXYFERN.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.3f, 0.3f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "Oxyfern_preview", Assets.GetAnim("oxy_fern_kanim"), "place", 1, 2);
        SoundEventVolumeCache.instance.AddVolume("oxy_fern_kanim", "MealLice_harvest", NOISE_POLLUTION.CREATURES.TIER3);
        SoundEventVolumeCache.instance.AddVolume("oxy_fern_kanim", "MealLice_LP", NOISE_POLLUTION.CREATURES.TIER4);
        return(gameObject);
    }
    private string GetAirPressureLabel(GameObject go)
    {
        PressureVulnerable component = go.GetComponent <PressureVulnerable>();

        return(Db.Get().Amounts.AirPressure.Name + "\n    • " + GameUtil.GetFormattedMass(component.pressureWarning_Low, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.Gram, false, "{0:0.#}") + " - " + GameUtil.GetFormattedMass(component.pressureWarning_High, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.Gram, true, "{0:0.#}"));
    }
示例#12
0
    public static GameObject ExtendEntityToBasicPlant(GameObject template, float temperature_lethal_low = 218.15f, float temperature_warning_low = 283.15f, float temperature_warning_high = 303.15f, float temperature_lethal_high = 398.15f, SimHashes[] safe_elements = null, bool pressure_sensitive = true, float pressure_lethal_low = 0f, float pressure_warning_low = 0.15f, string crop_id = null, bool can_drown = true, bool can_tinker = true, bool require_solid_tile = true, bool should_grow_old = true, float max_age = 2400f)
    {
        template.AddOrGet <EntombVulnerable>();
        PressureVulnerable pressureVulnerable = template.AddOrGet <PressureVulnerable>();

        if (pressure_sensitive)
        {
            PressureVulnerable pressureVulnerable2 = pressureVulnerable;
            SimHashes[]        safeAtmospheres     = safe_elements;
            pressureVulnerable2.Configure(pressure_warning_low, pressure_lethal_low, 10f, 30f, safeAtmospheres);
        }
        else
        {
            pressureVulnerable.Configure(safe_elements);
        }
        template.AddOrGet <WiltCondition>();
        template.AddOrGet <Prioritizable>();
        template.AddOrGet <Uprootable>();
        if (require_solid_tile)
        {
            template.AddOrGet <UprootedMonitor>();
        }
        template.AddOrGet <ReceptacleMonitor>();
        template.AddOrGet <Notifier>();
        if (can_drown)
        {
            template.AddOrGet <DrowningMonitor>();
        }
        TemperatureVulnerable temperatureVulnerable = template.AddOrGet <TemperatureVulnerable>();

        temperatureVulnerable.Configure(temperature_warning_low, temperature_lethal_low, temperature_warning_high, temperature_lethal_high);
        template.AddOrGet <OccupyArea>().objectLayers = new ObjectLayer[1]
        {
            ObjectLayer.Building
        };
        KPrefabID component = template.GetComponent <KPrefabID>();

        if (crop_id != null)
        {
            GeneratedBuildings.RegisterWithOverlay(OverlayScreen.HarvestableIDs, component.PrefabID().ToString());
            Crop.CropVal cropval = CROPS.CROP_TYPES.Find((Crop.CropVal m) => m.cropId == crop_id);
            Crop         crop    = template.AddOrGet <Crop>();
            crop.Configure(cropval);
            Growing growing = template.AddOrGet <Growing>();
            growing.growthTime    = cropval.cropDuration;
            growing.shouldGrowOld = should_grow_old;
            growing.maxAge        = max_age;
            template.AddOrGet <Harvestable>();
            template.AddOrGet <HarvestDesignatable>();
        }
        component.prefabInitFn += delegate(GameObject inst)
        {
            PressureVulnerable component2 = inst.GetComponent <PressureVulnerable>();
            if (safe_elements != null)
            {
                SimHashes[] array = safe_elements;
                foreach (SimHashes hash in array)
                {
                    component2.safe_atmospheres.Add(ElementLoader.FindElementByHash(hash));
                }
            }
        };
        if (can_tinker)
        {
            Tinkerable.MakeFarmTinkerable(template);
        }
        return(template);
    }