Пример #1
0
        public static void RestorePlantBlock(Type type, Vector3i position, IWorldEditBlockData blockData)
        {
            if (blockData == null)
            {
                return;
            }
            WorldEditPlantBlockData plantBlockData = (WorldEditPlantBlockData)blockData;
            PlantSpecies            plantSpecies   = null;

            try { plantSpecies = EcoSim.AllSpecies.OfType <PlantSpecies>().First(species => species.GetType() == plantBlockData.PlantType); }
            catch (InvalidOperationException)
            {
                //TODO: Temporary support for the old serialized format! Should be done with migration!
                plantSpecies = EcoSim.AllSpecies.OfType <PlantSpecies>().First(species => species.Name == plantBlockData.PlantType.Name);
            }
            if (plantSpecies == null)
            {
                return;
            }
            Plant plant = EcoSim.PlantSim.SpawnPlant(plantSpecies, position, true);

            plant.YieldPercent  = plantBlockData.YieldPercent;
            plant.Dead          = plantBlockData.Dead;
            plant.DeadType      = plantBlockData.DeadType;
            plant.GrowthPercent = plantBlockData.GrowthPercent;
            plant.DeathTime     = plantBlockData.DeathTime;
            plant.Tended        = plantBlockData.Tended;
        }
Пример #2
0
        public static Plant ValidPlant(PlantSpecies plantSpecies)
        {
            var name =
                $"{NameList.FirstNames[rnd.Next(NameList.FirstNames.Length)]} {NameList.Names[rnd.Next(NameList.Names.Length)]}";

            return(new Plant
            {
                Id = Guid.NewGuid(), Name = name, PlantSpeciesId = plantSpecies.Id, PlantState = PlantState.Active
            });
        }
        public async Task <ActionResult <PlantSpecies> > Get(Guid speciesId)
        {
            var query = new GetPlantSpeciesByIdQuery {
                Id = speciesId
            };
            var response = await mediator.Send(query);

            if (!response.Success)
            {
                return(BadRequest(response.ErrorMessages));
            }

            return(Ok(PlantSpecies.FromCore(response.Data)));
        }
Пример #4
0
        public PlantLogQueryTests(PlantLogQueryTestsFixture fixture)
        {
            logType1     = fixture.logType1;
            logType2     = fixture.logType2;
            plantSpecies = fixture.plantSpecies;
            plant1       = fixture.plant1;
            plant2       = fixture.plant2;

            plantLog1    = fixture.plantLog1;
            plantLog2    = fixture.plantLog2;
            plantLog3    = fixture.plantLog3;
            plantLog4    = fixture.plantLog4;
            plantLog5    = fixture.plantLog5;
            queryHandler = new GetAllPlantLogsQueryHandler(fixture.context);
        }
Пример #5
0
 public IActionResult AddPlant([FromBody] PlantSpecies plantSpeciesRequest)
 {
     if (plantSpeciesRequest.name == null)
     {
         return(BadRequest());
     }
     else
     {
         PlantSpecies plantSpecies = PlantSpecies.AddPlantSpecies(plantSpeciesRequest.name);
         if (plantSpecies.name.Equals(plantSpeciesRequest.name))
         {
             return(CreatedAtRoute("GetPlant", new { plantSpecies.id }, plantSpecies));
         }
     }
     return(BadRequest());
 }
Пример #6
0
        public IActionResult PrepareDataBase(bool prepare)
        {
            ClearDataBase();

            if (prepare)
            {
                Random gen = new Random();

                List <string> plantsNames = new List <string>();
                plantsNames.Add("Awokado");
                plantsNames.Add("Lychee");
                plantsNames.Add("Cytryna");
                plantsNames.Add("Pomarańcza");
                plantsNames.Add("Mango");

                foreach (string plantName in plantsNames)
                {
                    int newPlantId = Plant.CreatePlant(plantName).id;

                    for (int i = 0; i < 5; i++)
                    {
                        Variety.CreateVariety(PlantSpecies.GetPlantSpeciesByName(plantName).id, $"Odmiana {i}");
                    }
                }

                for (int i = 0; i < 4; i++)
                {
                    int id = Tunnel.CreateTunnel($"Tunnel {i}").id;
                    AvrDevice.CreateAvrDevice($"localhost/espSim/{i + 10}", id);

                    for (int j = 0; j < gen.Next(1, 6); j++)
                    {
                        List <Plant> plants          = Plant.GetPlants();
                        int          plantTableIndex = gen.Next(0, plants.Count - 1);


                        int breedingId = Cultivation.CreateCultivation($"Hodowla {i}/{j}", plants[plantTableIndex].id, i + i * j + 1, id, DateTime.Now).id;
                        for (int k = 0; k < gen.Next(0, 10); k++)
                        {
                            CultivationComment.AddCultivationComents($"Komentarz do hodowli { i + i * j * k}", breedingId);
                        }
                    }
                }
            }

            return(new NoContentResult());
        }
Пример #7
0
        public PlantLogQueryTestsFixture()
        {
            context      = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(PlantLogQueryTests));
            logType1     = ValidObjectHelper.ValidPlantLogType();
            logType2     = ValidObjectHelper.ValidPlantLogType();
            plantSpecies = ValidObjectHelper.ValidPlantSpecies();
            plant1       = ValidObjectHelper.ValidPlant(plantSpecies);
            plant2       = ValidObjectHelper.ValidPlant(plantSpecies);

            var id1 = Guid.NewGuid();
            var id2 = Guid.NewGuid();
            var id3 = Guid.NewGuid();
            var id4 = Guid.NewGuid();
            var id5 = Guid.NewGuid();

            var log1 = "Hello";
            var log2 = "World";
            var log3 = "ab";
            var log4 = "world Hello abcdefgh";
            var log5 = "Töster";

            var dt1 = new DateTime(2020, 01, 01, 00, 00, 00);
            var dt2 = new DateTime(2020, 01, 01, 18, 00, 00);
            var dt3 = new DateTime(2020, 01, 02, 12, 00, 00);
            var dt4 = new DateTime(2020, 02, 01, 12, 00, 00);
            var dt5 = new DateTime(2019, 01, 01, 12, 00, 00);

            plantLog1 = new PlantLog {
                Id = id1, DateTime = dt1, Log = log1, Plant = plant1, PlantLogType = logType1
            };
            plantLog2 = new PlantLog {
                Id = id2, DateTime = dt2, Log = log2, Plant = plant1, PlantLogType = logType1
            };
            plantLog3 = new PlantLog {
                Id = id3, DateTime = dt3, Log = log3, Plant = plant2, PlantLogType = logType2
            };
            plantLog4 = new PlantLog {
                Id = id4, DateTime = dt4, Log = log4, Plant = plant2, PlantLogType = logType2
            };
            plantLog5 = new PlantLog {
                Id = id5, DateTime = dt5, Log = log5, Plant = plant2, PlantLogType = logType1
            };

            context.AddRange(logType1, logType2, plantSpecies, plant1, plant2, plantLog1, plantLog2, plantLog3, plantLog4, plantLog5);
            context.SaveChanges();
        }
Пример #8
0
    public int GetAllStartingPlantsAndSeeds()
    {
        int count = 0;

        for (int i = 0; i < transform.childCount; i++)
        {
            PlantSpecies plantSpecies = transform.GetChild(i).GetComponent <PlantSpecies>();
            if (plantSpecies != null)
            {
                count += plantSpecies.startingPopulation;
                PlantSpeciesSeeds speciesSeeds = plantSpecies.GetComponent <PlantSpeciesSeeds>();
                if (speciesSeeds != null)
                {
                    count += speciesSeeds.startingSeedCount;
                }
            }
        }
        return(count);
    }
        public async Task <ActionResult <PlantSpecies> > Update(Guid speciesId, UpdatePlantSpeciesRequest request)
        {
            var command = new UpdatePlantSpeciesCommand {
                Id = speciesId, Name = request.Name
            };
            var response = await mediator.Send(command);

            if (!response.Success)
            {
                return(BadRequest(response.ErrorMessages));
            }

            var updatedQuery = new GetPlantSpeciesByIdQuery {
                Id = command.Id
            };
            var updatedResult = await mediator.Send(updatedQuery);

            var updatedObj = PlantSpecies.FromCore(updatedResult.Data);

            return(Ok(updatedObj));
        }
        public async Task <ActionResult <PlantSpecies> > Create(CreatePlantSpeciesRequest request)
        {
            var command = new CreatePlantSpeciesCommand {
                Id = Guid.NewGuid(), Name = request.Name
            };
            var response = await mediator.Send(command);

            if (!response.Success)
            {
                return(BadRequest(response.ErrorMessages));
            }

            var createdQuery = new GetPlantSpeciesByIdQuery {
                Id = command.Id
            };
            var createdResult = await mediator.Send(createdQuery);

            var createdObj = PlantSpecies.FromCore(createdResult.Data);

            return(CreatedAtRoute(nameof(PlantSpeciesController) + "/" + nameof(Get), new { speciesId = command.Id }, createdObj));
        }
        public async Task QueryAllPlantSpecies()
        {
            await using var context = DatabaseHelper.CreateInMemoryDatabaseContext(nameof(QueryAllPlantSpecies));

            var id1 = Guid.NewGuid();
            var id2 = Guid.NewGuid();
            var id3 = Guid.NewGuid();
            var id4 = Guid.NewGuid();
            var id5 = Guid.NewGuid();

            var name1 = "Hello";
            var name2 = "World";
            var name3 = "ab";
            var name4 = "world Hello abcdefgh";
            var name5 = "Töster";

            var plantSpecies1 = new PlantSpecies {
                Id = id1, Name = name1
            };
            var plantSpecies2 = new PlantSpecies {
                Id = id2, Name = name2
            };
            var plantSpecies3 = new PlantSpecies {
                Id = id3, Name = name3
            };
            var plantSpecies4 = new PlantSpecies {
                Id = id4, Name = name4
            };
            var plantSpecies5 = new PlantSpecies {
                Id = id5, Name = name5
            };

            await context.PlantSpecies.AddRangeAsync(plantSpecies1, plantSpecies2, plantSpecies3, plantSpecies4,
                                                     plantSpecies5);

            await context.SaveChangesAsync();

            var queryAll     = new GetAllPlantSpeciesQuery();
            var queryHandler = new GetAllPlantSpeciesQueryHandler(context);
            var result       = await queryHandler.Handle(queryAll, CancellationToken.None);

            Assert.True(result.Success);
            Assert.Equal(5, result.Data.Count());
            Assert.Contains(result.Data, dto => dto.Id.Equals(id1) && dto.Name.Equals(name1));
            Assert.Contains(result.Data, dto => dto.Id.Equals(id2) && dto.Name.Equals(name2));
            Assert.Contains(result.Data, dto => dto.Id.Equals(id3) && dto.Name.Equals(name3));
            Assert.Contains(result.Data, dto => dto.Id.Equals(id4) && dto.Name.Equals(name4));
            Assert.Contains(result.Data, dto => dto.Id.Equals(id5) && dto.Name.Equals(name5));

            var queryAllHello = new GetAllPlantSpeciesQuery {
                NameFilter = "Hello"
            };
            var resultAllHello = await queryHandler.Handle(queryAllHello, CancellationToken.None);

            Assert.True(resultAllHello.Success);
            Assert.Equal(2, resultAllHello.Data.Count());
            Assert.Contains(resultAllHello.Data, dto => dto.Id.Equals(id1) && dto.Name.Equals(name1));
            Assert.Contains(resultAllHello.Data, dto => dto.Id.Equals(id4) && dto.Name.Equals(name4));

            var queryAllWorld = new GetAllPlantSpeciesQuery {
                NameFilter = "World"
            };
            var resultAllWorld = await queryHandler.Handle(queryAllWorld, CancellationToken.None);

            Assert.True(resultAllWorld.Success);
            Assert.Single(resultAllWorld.Data);
            Assert.Contains(resultAllWorld.Data, dto => dto.Id.Equals(id2) && dto.Name.Equals(name2));

            var queryAllHelloLc = new GetAllPlantSpeciesQuery {
                NameFilter = "hello"
            };
            var resultAllHelloLc = await queryHandler.Handle(queryAllHelloLc, CancellationToken.None);

            Assert.True(resultAllHelloLc.Success);
            Assert.Empty(resultAllHelloLc.Data);

            var querySpecialChar = new GetAllPlantSpeciesQuery {
                NameFilter = "ö"
            };
            var resultSpecialChar = await queryHandler.Handle(querySpecialChar, CancellationToken.None);

            Assert.True(resultSpecialChar.Success);
            Assert.Single(resultSpecialChar.Data);
            Assert.Contains(resultSpecialChar.Data, dto => dto.Id.Equals(id5) && dto.Name.Equals(name5));
        }
Пример #12
0
 public void PluginConfigPostLoadEvent(PluginConfigPostLoadEvent evt)
 {
     if (evt.PluginConfig is EcoSim && (evt.PluginConfig as EcoSim).EcoDef.Species.Where(x => x.Name == "ColorPlant").Count() == 0)
     {
         PlantSpecies ColorPlant = new PlantSpecies();
         ColorPlant.CaloriesPerVoxelColumnPerDensity = 10f;
         ColorPlant.ResourceConstraintsByLayer       = new Lazy <Dictionary <string, PlantSpecies.ResourceConstraint> >();
         ColorPlant.CapacityConstraintsByLayer       = new Lazy <Dictionary <string, PlantSpecies.CapacityConstraint> >();
         ColorPlant.PlantType = new PlantType()
         {
             Type = typeof(PlantEntity)
         };
         ColorPlant.SeedDropChance      = 0.5f;
         ColorPlant.SeedsAtGrowth       = 0.6f;
         ColorPlant.SeedsBonusAtGrowth  = 0.9f;
         ColorPlant.SeedRange           = new Range(1, 3);
         ColorPlant.SeedItem            = new ItemType(typeof(ColorPlantSeedItem));
         ColorPlant.BlockType           = new BlockType(typeof(ColorPlantBlock));
         ColorPlant.MaxGrowthRate       = 0.01f;
         ColorPlant.MaxDeathRate        = 0.005f;
         ColorPlant.SpreadRate          = 0.001f;
         ColorPlant.ResourceConstraints = new SerializedSynchronizedCollection <PlantSpecies.ResourceConstraint>()
         {
             new PlantSpecies.ResourceConstraint()
             {
                 LayerName = LayerNames.Nitrogen,
                 HalfSpeedConcentration = 0.4f,
                 MaxResourceContent     = 0.4f
             },
             new PlantSpecies.ResourceConstraint()
             {
                 LayerName = LayerNames.Phosphorus,
                 HalfSpeedConcentration = 0.4f,
                 MaxResourceContent     = 0.4f
             },
             new PlantSpecies.ResourceConstraint()
             {
                 LayerName = LayerNames.Potassium,
                 HalfSpeedConcentration = 0.1f,
                 MaxResourceContent     = 0.1f
             },
             new PlantSpecies.ResourceConstraint()
             {
                 LayerName = LayerNames.SoilMoisture,
                 HalfSpeedConcentration = 0.1f,
                 MaxResourceContent     = 0.1f
             }
         };
         ColorPlant.CapacityConstraints = new SerializedSynchronizedCollection <PlantSpecies.CapacityConstraint>()
         {
             new PlantSpecies.CapacityConstraint()
             {
                 CapacityLayerName      = LayerNames.FertileGround,
                 ConsumedCapacityPerPop = 1f
             },
             new PlantSpecies.CapacityConstraint()
             {
                 CapacityLayerName      = LayerNames.ShrubSpace,
                 ConsumedCapacityPerPop = 3f
             }
         };
         ColorPlant.IdealTemperatureRange     = new Range(14.7f, 15f);
         ColorPlant.IdealMoistureRange        = new Range(0.29f, 0.33f);
         ColorPlant.TemperatureExtremes       = new Range(12.5f, 16.9f);
         ColorPlant.MoistureExtremes          = new Range(0.2f, 0.49f);
         ColorPlant.MaxPollutionDensity       = 0.7f;
         ColorPlant.PollutionDensityTolerance = 0.1f;
         ColorPlant.VoxelsPerEntry            = 5;
         ColorPlant.Name                  = "ColorPlant";
         ColorPlant.DisplayName           = "Color plant";
         ColorPlant.MaturityAgeDays       = 0.8f;
         ColorPlant.CalorieValue          = 4.0f;
         ColorPlant.ResourceItem          = new ItemType(typeof(ColorPlantItem));
         ColorPlant.ResourceRange         = new Range(1f, 6f);
         ColorPlant.ResourceBonusAtGrowth = 0.9f;
         ColorPlant.ReleasesCO2ppmPerDay  = -0.001f;
         (evt.PluginConfig as EcoSim).EcoDef.Species.Add(ColorPlant);
     }
 }
Пример #13
0
 internal override void SetUpSpecificJobController(BasicSpeciesScript speciesScript)
 {
     plantSpecies = (PlantSpecies)speciesScript;
 }
Пример #14
0
 internal static PlantSpeciesDto FromDao(PlantSpecies plantSpecies)
 {
     return(new PlantSpeciesDto(plantSpecies.Id, plantSpecies.Name));
 }
Пример #15
0
 public void SetUpPlantOrganism(PlantSpecies plantSpecies)
 {
     SetUpOrganism(plantSpecies);
     this.plantSpecies = plantSpecies;
     gameObject.name   = plantSpecies + "Organism";
 }
        public static void SetBlock(Type pType, Vector3i pPosition, UserSession pSession = null, Vector3i?pSourcePosition = null, Block pSourceBlock = null, byte[] pData = null)
        {
            if (pType == null || pType.DerivesFrom <PickupableBlock>())
            {
                pType = typeof(EmptyBlock);
            }

            WorldObjectBlock worldObjectBlock = Eco.World.World.GetBlock(pPosition) as WorldObjectBlock;

            if (worldObjectBlock != null)
            {
                if (worldObjectBlock.WorldObjectHandle.Object.Position3i == pPosition)
                {
                    worldObjectBlock.WorldObjectHandle.Object.Destroy();
                }
            }

            if (pType == typeof(EmptyBlock))
            {
                Eco.World.World.DeleteBlock(pPosition);
                return;
            }

            var constuctor = pType.GetConstructor(Type.EmptyTypes);

            if (constuctor != null)
            {
                Eco.World.World.SetBlock(pType, pPosition);
                return;
            }

            Type[] types = new Type[1];
            types[0] = typeof(WorldPosition3i);

            constuctor = pType.GetConstructor(types);

            if (constuctor != null)
            {
                object obj = null;

                if (pData != null)
                {
                    MemoryStream ms = new MemoryStream(pData);
                    obj = EcoSerializer.Deserialize(ms);
                }

                if (pType.DerivesFrom <PlantBlock>())
                {
                    PlantSpecies ps = null;
                    Plant        pb = null;

                    if (obj != null)
                    {
                        pb = (Plant)obj;
                        ps = pb.Species;
                    }
                    else
                    {
                        ps = WorldUtils.GetPlantSpecies(pType);

                        if (pSourceBlock != null)
                        {
                            pb = PlantBlock.GetPlant(pPosition);
                        }
                    }

                    Plant newplant = EcoSim.PlantSim.SpawnPlant(ps, pPosition);

                    if (pb != null)
                    {
                        newplant.YieldPercent  = pb.YieldPercent;
                        newplant.Dead          = pb.Dead;
                        newplant.DeadType      = pb.DeadType;
                        newplant.GrowthPercent = pb.GrowthPercent;
                        newplant.DeathTime     = pb.DeathTime;
                        newplant.Tended        = pb.Tended;
                    }

                    return;
                }

                AsphaltLog.WriteLine("Unknown Type: " + pType);
            }

            types[0]   = typeof(WorldObject);
            constuctor = pType.GetConstructor(types);

            if (constuctor != null)
            {
                WorldObject wObject = null;

                if (pSourceBlock != null)
                {
                    wObject = ((WorldObjectBlock)pSourceBlock).WorldObjectHandle.Object;

                    //if this is not the "main block" of an object do nothing
                    if (wObject.Position3i != pSourcePosition.Value)
                    {
                        return;
                    }
                }
                else if (pData != null)
                {
                    MemoryStream ms  = new MemoryStream(pData);
                    var          obj = EcoSerializer.Deserialize(ms);

                    if (obj is WorldObject)
                    {
                        wObject = obj as WorldObject;
                    }
                    else
                    {
                        throw new InvalidOperationException("obj is not WorldObjectBlock");
                    }
                }

                if (wObject == null)
                {
                    return;
                }


                //    WorldObject newObject = WorldObjectUtil.Spawn(wObject.GetType().Name, wObject.Creator.User, pPosition);
                //    newObject.Rotation = wObject.Rotation;


                WorldObject newObject = (WorldObject)Activator.CreateInstance(wObject.GetType(), true);
                newObject = WorldObjectManager.Add(newObject, wObject.Creator.User, pPosition, wObject.Rotation);


                {
                    StorageComponent newSC = newObject.GetComponent <StorageComponent>();

                    if (newSC != null)
                    {
                        StorageComponent oldPSC = wObject.GetComponent <StorageComponent>();
                        newSC.Inventory.AddItems(oldPSC.Inventory.Stacks);
                        //    newSC.Inventory.OnChanged.Invoke(null);
                    }
                }

                {
                    CustomTextComponent newTC = newObject.GetComponent <CustomTextComponent>();

                    if (newTC != null)
                    {
                        CustomTextComponent oldTC = wObject.GetComponent <CustomTextComponent>();

                        typeof(CustomTextComponent).GetProperty("Text", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).SetValue(newTC, oldTC.Text);
                    }
                }

                return;
            }

            AsphaltLog.WriteLine("Unknown Type: " + pType);
        }
        public static void PlantDetails()
        {
            // dictionary of plant properties
            Dictionary <string, string> plantDetails = new Dictionary <string, string>()
            {
                // INFO
                { "untranslated", "nil" },
                { "isDecorative", "nil" }, // Is the plant considered decorative. Not simulated after spawn.
                { "doesSpread", "nil" },   // The plant will spawn others like it nearby given enough time not dying and not harvested

                // LIFETIME
                { "maturity", "nil" }, // Age for full maturity and reproduction.

                // GENERATION
                { "isWater", "nil" }, // Does the species live underwater.
                { "height", "nil" },  // Plant height in meters.

                // FOOD
                { "calorieValue", "nil" }, // The base calories this species provides to it's consumers.

                // RESOURCES
                { "requireHarvestable", "nil" },   // Does this plant require to have reached a harvestable stage before you can harvest it, you will get no resources for this if its not at a harvestable stage.
                { "pickableAtPercent", "nil" },    // This plant will be pickable at this percent and you will get some resources.
                { "experiencePerHarvest", "nil" }, // Base experience you get per harvest.
                { "harvestTool", "nil" },          // The tool required to harvest this plant, nil means hands.
                { "killOnHarvest", "nil" },        // Does the plant die on harvest.
                { "postHarvestGrowth", "nil" },    // What % growth does the plant return to after harvest.
                { "scytheKills", "nil" },          // Will using a Scythe/Sickle on this plant kill it.
                { "resourceItem", "nil" },         // The item you get from harvesting this plant.
                { "resourceMin", "nil" },          // The minimum number of items returned.
                { "resourceMax", "nil" },          // The maximum number of items returned.
                { "resourceBonus", "nil" },        // The bonus items returned for allowing it to grow.

                // WORLD LAYERS
                { "carbonRelease", "nil" },                   // The amount of carbon dioxide released by this species. (Plants & Trees are negative values)
                { "idealGrowthRate", "nil" },                 // In ideal conditions, what is the rate of growth. (%)
                { "idealDeathRate", "nil" },                  // In ideal conditions what is the rate of death. (%)
                { "spreadRate", "nil" },                      // In ideal conditions what is the rate of spread, if it does spread.
                { "nitrogenHalfSpeed", "nil" },               // At what nitrogen value will the growth speed reduce to half.
                { "nitrogenContent", "nil" },                 // What nitrogen content is ideal.
                { "phosphorusHalfSpeed", "nil" },             // At what phosphorus value will the growth speed reduce to half.
                { "phosphorusContent", "nil" },               // What phosphorus content is ideal.
                { "potassiumHalfSpeed", "nil" },              // At what potassium value will the growth speed reduce to half.
                { "potassiumContent", "nil" },                // What potassium content is ideal.
                { "soilMoistureHalfSpeed", "nil" },           // At what moisture value will the growth speed reduce to half.
                { "soilMoistureContent", "nil" },             // What moisture content is ideal.
                { "consumedFertileGround", "nil" },           // How much of the area deemed Fertile Ground does this plant take up, this is almost always more than the in game physical space.
                { "consumedCanopySpace", "nil" },             // How much of the area deemed Canopy Space does this plant take up, this is almost always more than the in game physical space.
                { "consumedUnderwaterFertileGround", "nil" }, // How much of the area deemed Underwater Fertile Ground does this plant take up, this is almost always more than the in game physical space.
                { "consumedShrubSpace", "nil" },              // How much of the area deemed Shrub Space does this plant take up, this is almost always more than the in game physical space.
                { "extremeTempMin", "nil" },                  // The lowest temperature before this plant stops growth.
                { "idealTempMin", "nil" },                    // The lowest temperature of the ideal growth range (max growth).
                { "idealTempMax", "nil" },                    // The highest temperature of the ideal growth range (max growth).
                { "extremeTempMax", "nil" },                  // The highest temperature before this plant stops growth.
                { "extremeMoistureMin", "nil" },              // The lowest moisture content before this plant stops growth.
                { "idealMoistureMin", "nil" },                // The lowest moisture content of the ideal growth range (max growth).
                { "idealMoistureMax", "nil" },                // The highest moisture content of the ideal growth range (max growth).
                { "extremeMoistureMax", "nil" },              // The highest moisture content before this plant stops growth.
                { "extremeSaltMin", "nil" },                  // The lowest salt content before this plant stops growth.
                { "idealSaltMin", "nil" },                    // The lowest salt contente of the ideal growth range (max growth).
                { "idealSaltMax", "nil" },                    // The highest salt content of the ideal growth range (max growth).
                { "extremeSaltMax", "nil" },                  // The highest Sslt content before this plant stops growth.
                { "maxPollutionDensity", "nil" },             // The highest pollution density before this plant stops growing.
                { "pollutionTolerance", "nil" } // The pollution density at which this plant slows growth, spread and carbon dioxide absorbtion.
            };

            IEnumerable <Species> species = EcoSim.AllSpecies;

            foreach (Species s in species)
            {
                if (s is PlantSpecies && !(s is TreeSpecies))
                {
                    PlantSpecies plant = s as PlantSpecies;
                    if (!EveryPlant.ContainsKey(plant.DisplayName))
                    {
                        string plantName = plant.DisplayName;
                        EveryPlant.Add(plantName, new Dictionary <string, string>(plantDetails));

                        #region INFO
                        EveryPlant[plantName]["untranslated"] = $"'{plant.DisplayName.NotTranslated}'";
                        EveryPlant[plantName]["isDecorative"] = plant.Decorative ? $"'{Localizer.DoStr("Decorative")}'" : "nil";
                        EveryPlant[plantName]["doesSpread"]   = plant.NoSpread ? $"'{Localizer.DoStr("No")}'" : $"'{Localizer.DoStr("Yes")}'";
                        #endregion

                        #region LIFETIME

                        EveryPlant[plantName]["maturity"] = "'" + plant.MaturityAgeDays.ToString("F1") + "'";
                        #endregion

                        #region GENERATION
                        EveryPlant[plantName]["isWater"] = plant.Water ? $"'{Localizer.DoStr("Underwater")}'" : "nil";
                        EveryPlant[plantName]["height"]  = "'" + plant.Height.ToString("F1") + "'";
                        #endregion

                        #region FOOD
                        EveryPlant[plantName]["calorieValue"] = "'" + plant.CalorieValue.ToString("F1") + "'";
                        #endregion

                        #region RESOURCES
                        EveryPlant[plantName]["requireHarvestable"] = plant.RequireHarvestable ? $"'{Localizer.DoStr("Yes")}'" : "nil";

                        EveryPlant[plantName]["pickableAtPercent"] = "'" + (plant.PickableAtPercent * 100).ToString("F0") + "'";

                        EveryPlant[plantName]["experiencePerHarvest"] = "'" + (plant.ExperiencePerHarvest).ToString("F1") + "'";

                        if (Block.Is <Reapable>(plant.BlockType))
                        {
                            EveryPlant[plantName]["harvestTool"] = $"'{Localizer.DoStr("Scythe")}'";
                        }
                        else if (Block.Is <Diggable>(plant.BlockType))
                        {
                            EveryPlant[plantName]["harvestTool"] = $"'{Localizer.DoStr("Shovel")}'";
                        }

                        if (plant.PostHarvestingGrowth == 0)
                        {
                            EveryPlant[plantName]["killOnHarvest"] = $"'{Localizer.DoStr("Yes")}'";
                        }
                        else
                        {
                            EveryPlant[plantName]["killOnHarvest"] = $"'{Localizer.DoStr("No")}'";
                        }

                        if (plant.PostHarvestingGrowth != 0)
                        {
                            EveryPlant[plantName]["postHarvestGrowth"] = "'" + (plant.PostHarvestingGrowth * 100).ToString("F0") + "'";
                        }

                        EveryPlant[plantName]["scytheKills"] = plant.ScythingKills ? $"'{Localizer.DoStr("Yes")}'" : "nil";

                        if (plant.ResourceItemType != null)
                        {
                            EveryPlant[plantName]["resourceItem"] = "'[[" + Localizer.DoStr(SplitName(RemoveItemTag(plant.ResourceItemType.Name))) + "]]'";
                        }

                        EveryPlant[plantName]["resourceMin"]   = "'" + plant.ResourceRange.Min.ToString("F1") + "'";
                        EveryPlant[plantName]["resourceMax"]   = "'" + plant.ResourceRange.Max.ToString("F1") + "'";
                        EveryPlant[plantName]["resourceBonus"] = "'" + (plant.ResourceBonusAtGrowth * 100).ToString("F0") + "'";

                        #endregion

                        #region VISUALS

                        #endregion

                        #region WORLDLAYERS
                        EveryPlant[plantName]["carbonRelease"] = "'" + plant.ReleasesCO2TonsPerDay.ToString("F4") + "'";

                        EveryPlant[plantName]["idealGrowthRate"] = "'" + plant.MaxGrowthRate.ToString("F4") + "'";

                        EveryPlant[plantName]["idealDeathRate"] = "'" + plant.MaxDeathRate.ToString("F4") + "'";

                        EveryPlant[plantName]["spreadRate"] = "'" + plant.SpreadRate.ToString("F4") + "'";

                        #region Resource Constraints
                        if (plant.ResourceConstraints != null)
                        {
                            foreach (ResourceConstraint r in plant.ResourceConstraints)
                            {
                                if (r.LayerName == "Nitrogen")
                                {
                                    EveryPlant[plantName]["nitrogenHalfSpeed"] = "'" + (r.HalfSpeedConcentration * 100).ToString("F0") + "'";
                                    EveryPlant[plantName]["nitrogenContent"]   = "'" + (r.MaxResourceContent * 100).ToString("F0") + "'";
                                }
                                if (r.LayerName == "Phosphorus")
                                {
                                    EveryPlant[plantName]["phosphorusHalfSpeed"] = "'" + (r.HalfSpeedConcentration * 100).ToString("F0") + "'";
                                    EveryPlant[plantName]["phosphorusContent"]   = "'" + (r.MaxResourceContent * 100).ToString("F0") + "'";
                                }
                                if (r.LayerName == "Potassium")
                                {
                                    EveryPlant[plantName]["potassiumHalfSpeed"] = "'" + (r.HalfSpeedConcentration * 100).ToString("F0") + "'";
                                    EveryPlant[plantName]["potassiumContent"]   = "'" + (r.MaxResourceContent * 100).ToString("F0") + "'";
                                }
                                if (r.LayerName == "SoilMoisture")
                                {
                                    EveryPlant[plantName]["soilMoistureHalfSpeed"] = "'" + (r.HalfSpeedConcentration * 100).ToString("F0") + "'";
                                    EveryPlant[plantName]["soilMoistureContent"]   = "'" + (r.MaxResourceContent * 100).ToString("F0") + "'";
                                }
                            }
                        }
                        #endregion

                        #region Capacity Constraints
                        if (plant.CapacityConstraints != null)
                        {
                            foreach (CapacityConstraint c in plant.CapacityConstraints)
                            {
                                if (c.CapacityLayerName == "FertileGorund")
                                {
                                    EveryPlant[plantName]["consumedFertileGround"] = "'" + (c.ConsumedCapacityPerPop).ToString("F1") + "'";
                                }
                                if (c.CapacityLayerName == "CanopySpace")
                                {
                                    EveryPlant[plantName]["consumedCanopySpace"] = "'" + (c.ConsumedCapacityPerPop).ToString("F1") + "'";
                                }
                                if (c.CapacityLayerName == "UnderwaterFertileGorund")
                                {
                                    EveryPlant[plantName]["consumedUnderwaterFertileGround"] = "'" + (c.ConsumedCapacityPerPop).ToString("F1") + "'";
                                }
                                if (c.CapacityLayerName == "ShrubSpace")
                                {
                                    EveryPlant[plantName]["consumedShrubSpace"] = "'" + (c.ConsumedCapacityPerPop).ToString("F1") + "'";
                                }
                            }
                        }
                        #endregion

                        #region Environment Ranges

                        // Temperature
                        EveryPlant[plantName]["extremeTempMin"] = "'" + plant.TemperatureExtremes.Min.ToString("F1") + "'";
                        EveryPlant[plantName]["idealTempMin"]   = "'" + plant.IdealTemperatureRange.Min.ToString("F1") + "'";
                        EveryPlant[plantName]["idealTempMax"]   = "'" + plant.IdealTemperatureRange.Max.ToString("F1") + "'";
                        EveryPlant[plantName]["extremeTempMax"] = "'" + plant.TemperatureExtremes.Max.ToString("F1") + "'";

                        // Moisture
                        EveryPlant[plantName]["extremeMoistureMin"] = "'" + plant.MoistureExtremes.Min.ToString("F1") + "'";
                        EveryPlant[plantName]["idealMoistureMin"]   = "'" + plant.IdealMoistureRange.Min.ToString("F1") + "'";
                        EveryPlant[plantName]["idealMoistureMax"]   = "'" + plant.IdealMoistureRange.Max.ToString("F1") + "'";
                        EveryPlant[plantName]["extremeMoistureMax"] = "'" + plant.MoistureExtremes.Max.ToString("F1") + "'";

                        // Salt Content
                        EveryPlant[plantName]["extremeSaltMin"] = "'" + plant.WaterExtremes.Min.ToString("F1") + "'";
                        EveryPlant[plantName]["idealSaltMin"]   = "'" + plant.IdealWaterRange.Min.ToString("F1") + "'";
                        EveryPlant[plantName]["idealSaltMax"]   = "'" + plant.IdealWaterRange.Max.ToString("F1") + "'";
                        EveryPlant[plantName]["extremeSaltMax"] = "'" + plant.WaterExtremes.Max.ToString("F1") + "'";

                        #endregion

                        EveryPlant[plantName]["maxPollutionDensity"] = "'" + plant.MaxPollutionDensity.ToString("F4") + "'";
                        EveryPlant[plantName]["pollutionTolerance"]  = "'" + plant.PollutionDensityTolerance.ToString("F4") + "'";

                        #endregion

                        #region UNCATEGORISED
                        #endregion

                        #region OBSOLETE

                        /*
                         *
                         * SEEDS
                         *
                         * if (plant.SeedItemType != null) { EveryPlant[plantName]["seedDrop"] = "'" + SplitName(RemoveItemTag(plant.SeedItemType.Name)) + "'"; }
                         * EveryPlant[plantName]["seedDropChance"] = "'" + (plant.SeedDropChance * 100).ToString("F0") + "'";
                         * EveryPlant[plantName]["seedAtGrowth"] = "'" + (plant.SeedsAtGrowth * 100).ToString("F0") + "'";
                         * EveryPlant[plantName]["seedBonusGrowth"] = "'" + (plant.SeedsBonusAtGrowth * 100).ToString("F0") + "'";
                         * EveryPlant[plantName]["seedMax"] = "'" + plant.SeedRange.Max.ToString("F1") + "'";
                         * EveryPlant[plantName]["seedMin"] = "'" + plant.SeedRange.Min.ToString("F1") + "'";
                         *
                         *
                         */

                        #endregion
                    }
                }
            }
            WriteDictionaryToFile("Wiki_Module_PlantData.txt", "plants", EveryPlant);
        }
 public override void SetSpeciesScript(BasicSpeciesScript _species)
 {
     plantSpecies = (PlantSpecies)_species;
 }