public static GameObject CreateOilfloater(string id, string name, string desc, string anim_file, bool is_baby)
        {
            GameObject prefab = BaseOilFloaterConfig.BaseOilFloater(id, name, desc, anim_file, BASE_TRAIT_ID, 523.15f, 743.15f, is_baby, variantSprite);

            EntityTemplates.ExtendEntityToWildCreature(prefab, OilFloaterTuning.PEN_SIZE_PER_CREATURE);
            int count = (int)prefab.AddOrGet <PrimaryElement>().Mass;

            string[] loot = new string[count];
            for (int i = 0; i < count; i++)
            {
                loot[i] = "Steel";
            }
            prefab.AddOrGet <Butcherable>().SetDrops(loot);

            DiseaseDropper.Def def = prefab.AddOrGetDef <DiseaseDropper.Def>();
            def.diseaseIdx           = Db.Get().Diseases.GetIndex(Db.Get().Diseases.ZombieSpores.id);
            def.emitFrequency        = 1f;
            def.averageEmitPerSecond = 200;
            def.singleEmitQuantity   = 10000;


            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, OilFloaterTuning.STANDARD_STOMACH_SIZE, name, false, false, true));
            trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, -OilFloaterTuning.STANDARD_CALORIES_PER_CYCLE / 600f, name, false, false, true));
            trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, HITPOINTS.TIER1, name, false, false, true));
            trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, LIFESPAN.TIER3, name, false, false, true));
            List <Diet.Info> diet_infos = DietInfo(GameTags.Steel, CALORIES_PER_KG_OF_ORE, CONVERSION_EFFICIENCY.GOOD_1, null, 0f);

            return(OilFloaters.SetupDiet(prefab, diet_infos, CALORIES_PER_KG_OF_ORE, MIN_POOP_SIZE_IN_KG, 5 * Patches.Settings.ConsumptionMultiplier));
        }
Пример #2
0
    public GameObject CreatePrefab()
    {
        string         id          = "PrickleFlower";
        string         name        = STRINGS.CREATURES.SPECIES.PRICKLEFLOWER.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.PRICKLEFLOWER.DESC;
        float          mass        = 1f;
        KAnimFile      anim        = Assets.GetAnim("bristleblossom_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, 293f);
        GameObject     template    = gameObject;

        mass = 218.15f;
        float temperature_warning_low  = 278.15f;
        float temperature_warning_high = 303.15f;
        float temperature_lethal_high  = 398.15f;

        SimHashes[] safe_elements = new SimHashes[3]
        {
            SimHashes.Oxygen,
            SimHashes.ContaminatedOxygen,
            SimHashes.CarbonDioxide
        };
        initialAnim = PrickleFruitConfig.ID;
        EntityTemplates.ExtendEntityToBasicPlant(template, mass, temperature_warning_low, temperature_warning_high, temperature_lethal_high, safe_elements, true, 0f, 0.15f, initialAnim, true, true, true, true, 2400f);
        EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.Water,
                massConsumptionRate = 0.0333333351f
            }
        });
        gameObject.AddOrGet <StandardCropPlant>();
        DiseaseDropper.Def def = gameObject.AddOrGetDef <DiseaseDropper.Def>();
        def.diseaseIdx         = Db.Get().Diseases.GetIndex(Db.Get().Diseases.PollenGerms.id);
        def.singleEmitQuantity = 1000000;
        IlluminationVulnerable illuminationVulnerable = gameObject.AddOrGet <IlluminationVulnerable>();

        illuminationVulnerable.SetPrefersDarkness(false);
        template = gameObject;
        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Harvest;
        initialAnim = "PrickleFlowerSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.PRICKLEFLOWER.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.PRICKLEFLOWER.DESC;
        anim        = Assets.GetAnim("seed_bristleblossom_kanim");
        int        numberOfSeeds = 0;
        List <Tag> list          = new List <Tag>();

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

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "PrickleFlower_preview", Assets.GetAnim("bristleblossom_kanim"), "place", 1, 2);
        SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER3);
        SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_grow", NOISE_POLLUTION.CREATURES.TIER3);
        return(gameObject);
    }
Пример #3
0
    public GameObject CreatePrefab()
    {
        string         id                    = "BulbPlant";
        string         name                  = STRINGS.CREATURES.SPECIES.BULBPLANT.NAME;
        string         desc                  = STRINGS.CREATURES.SPECIES.BULBPLANT.DESC;
        float          mass                  = 1f;
        KAnimFile      anim                  = Assets.GetAnim("potted_bulb_kanim");
        string         initialAnim           = "grow_seed";
        EffectorValues pOSITIVE_DECOR_EFFECT = POSITIVE_DECOR_EFFECT;
        GameObject     gameObject            = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 1, pOSITIVE_DECOR_EFFECT, default(EffectorValues), SimHashes.Creature, null, 293f);
        GameObject     template              = gameObject;

        SimHashes[] safe_elements = new SimHashes[3]
        {
            SimHashes.Oxygen,
            SimHashes.ContaminatedOxygen,
            SimHashes.CarbonDioxide
        };
        EntityTemplates.ExtendEntityToBasicPlant(template, 288f, 293.15f, 313.15f, 333.15f, safe_elements, true, 0f, 0.15f, null, true, false, true, true, 2400f);
        PrickleGrass prickleGrass = gameObject.AddOrGet <PrickleGrass>();

        prickleGrass.positive_decor_effect = POSITIVE_DECOR_EFFECT;
        prickleGrass.negative_decor_effect = NEGATIVE_DECOR_EFFECT;
        template = gameObject;
        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Hidden;
        initialAnim = "BulbPlantSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.BULBPLANT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.BULBPLANT.DESC;
        anim        = Assets.GetAnim("seed_potted_bulb_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.DecorSeed);
        list = list;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(template, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 6, STRINGS.CREATURES.SPECIES.BULBPLANT.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.4f, 0.4f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "BulbPlant_preview", Assets.GetAnim("potted_bulb_kanim"), "place", 1, 1);
        gameObject.AddOrGet <KBatchedAnimController>().randomiseLoopedOffset = true;
        DiseaseDropper.Def def = gameObject.AddOrGetDef <DiseaseDropper.Def>();
        def.diseaseIdx           = Db.Get().Diseases.GetIndex(Db.Get().Diseases.PollenGerms.id);
        def.singleEmitQuantity   = 0;
        def.averageEmitPerSecond = 5000;
        def.emitFrequency        = 5f;
        return(gameObject);
    }
Пример #4
0
        public static GameObject CreateHatch(
            string id,
            string name,
            string desc,
            string anim_file,
            bool is_baby)
        {
            GameObject wildCreature = EntityTemplates.ExtendEntityToWildCreature(
                BaseHatchConfig.BaseHatch(
                    id,
                    name,
                    desc,
                    anim_file,
                    BaseTraitId,
                    is_baby,
                    SymbolOverride
                    ),
                HatchTuning.PEN_SIZE_PER_CREATURE);

            CreateTrait(name);

            List <Diet.Info> diet_infos = FloralDiet(
                poopTag: GameTags.Edible,
                caloriesPerKg: CaloriesPerKgOfFood,
                producedConversionRate: TUNING.CREATURES.CONVERSION_EFFICIENCY.GOOD_1);//

            wildCreature.AddOrGet <DecorProvider>()?.SetValues(tier);

            DiseaseDropper.Def def = wildCreature.AddOrGetDef <DiseaseDropper.Def>();
            def.diseaseIdx           = Db.Get().Diseases.GetIndex(PollenGerms.ID);
            def.emitFrequency        = 1f;
            def.averageEmitPerSecond = 1000 * 40;
            def.singleEmitQuantity   = 0;



            IlluminationVulnerable illuminationVulnerable = wildCreature.AddOrGet <IlluminationVulnerable>();

            illuminationVulnerable.SetPrefersDarkness(false);

            wildCreature.AddOrGetDef <CreatureLightMonitor.Def>();
            return(BaseHatchConfig.SetupDiet(wildCreature, diet_infos, CaloriesPerKgOfFood, MinPoopSizeKg));
        }
Пример #5
0
 protected override void ApplyTrait(GameObject go)
 {
     if (//go.GetComponent<GeneticTraitComponent>().IsBaby() ||
         go.GetComponent <GeneticTraitComponent>().IsAdult()
         // ||go.GetComponent<GeneticTraitComponent>().IsEgg()
         )
     {
         Util.Shuffle(germs);
         var reduction_factor = 4;
         var germ             = Db.Get().Diseases.Get(germs.First());
         var string_holder    = go.AddComponent <StringHolderComponent>();
         string_holder.text = "This critter skin produces small quantities of " + germ.Name + "";
         string_holder.id   = ID;
         DiseaseDropper.Def def = go.AddOrGetDef <DiseaseDropper.Def>();
         def.diseaseIdx           = Db.Get().Diseases.GetIndex(germs.First());;
         def.singleEmitQuantity   = 0;
         def.averageEmitPerSecond = 5000 / reduction_factor;
         def.emitFrequency        = 5f;
     }
 }
    public GameObject CreatePrefab()
    {
        string         id                    = "EvilFlower";
        string         name                  = STRINGS.CREATURES.SPECIES.EVILFLOWER.NAME;
        string         desc                  = STRINGS.CREATURES.SPECIES.EVILFLOWER.DESC;
        float          mass                  = 1f;
        KAnimFile      anim                  = Assets.GetAnim("potted_evilflower_kanim");
        string         initialAnim           = "grow_seed";
        EffectorValues pOSITIVE_DECOR_EFFECT = POSITIVE_DECOR_EFFECT;
        GameObject     gameObject            = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 1, pOSITIVE_DECOR_EFFECT, default(EffectorValues), SimHashes.Creature, null, 293f);

        EntityTemplates.ExtendEntityToBasicPlant(gameObject, 168.15f, 258.15f, 513.15f, 563.15f, new SimHashes[1]
        {
            SimHashes.CarbonDioxide
        }, true, 0f, 0.15f, null, true, false, true, true, 2400f);
        EvilFlower evilFlower = gameObject.AddOrGet <EvilFlower>();

        evilFlower.positive_decor_effect = POSITIVE_DECOR_EFFECT;
        evilFlower.negative_decor_effect = NEGATIVE_DECOR_EFFECT;
        GameObject plant = gameObject;

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

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

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "EvilFlower_preview", Assets.GetAnim("potted_evilflower_kanim"), "place", 1, 1);
        gameObject.AddOrGet <KBatchedAnimController>().randomiseLoopedOffset = true;
        DiseaseDropper.Def def = gameObject.AddOrGetDef <DiseaseDropper.Def>();
        def.diseaseIdx           = Db.Get().Diseases.GetIndex("ZombieSpores");
        def.emitFrequency        = 1f;
        def.averageEmitPerSecond = 1000;
        def.singleEmitQuantity   = 100000;
        return(gameObject);
    }
Пример #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
        }