Beispiel #1
0
    // Removes structs from dict that are not in recent biomes
    private void RemoveQueue()
    {
        byte biome;
        bool found = false;

        if (loadedBiomes.Count > this.maxBiomesActive)
        {
            biome = loadedBiomes[0];
            loadedBiomes.RemoveAt(0);

            // For every Struct in removed biome
            foreach (int s in BiomeHandler.GetBiomeStructs((BiomeCode)biome))
            {
                found = false;

                // For every biome in loaded biomes
                foreach (byte b in loadedBiomes)
                {
                    if (BiomeHandler.GetBiomeStructs((BiomeCode)b).Contains(s))
                    {
                        found = true;
                        break;
                    }
                }
                // Removes if not found
                if (!found)
                {
                    structs.Remove(s);
                }
            }
        }
    }
Beispiel #2
0
    // Adds all Structs of a biome to the loadQueue
    public void LoadBiome(byte code)
    {
        if (!loadedBiomes.Contains(code))
        {
            loadedBiomes.Add(code);
            RemoveQueue();

            foreach (int structCode in BiomeHandler.GetBiomeStructs((BiomeCode)code))
            {
                if (loadQueue.Contains(structCode) || structs.ContainsKey(structCode))
                {
                    continue;
                }
                else
                {
                    loadQueue.Add(structCode);
                }
            }
        }
        else
        {
            loadedBiomes.Remove(code);
            loadedBiomes.Add(code);
        }
    }
Beispiel #3
0
 public void GenerateDesertStructures(ChunkLoader_Server cl, ChunkPos pos, ushort[] blockdata, ushort[] statedata, ushort[] hpdata)
 {
     foreach (int structCode in BiomeHandler.GetBiomeStructs(BiomeCode.DESERT))
     {
         if (structCode >= 9 && structCode <= 11) // Metal veins
         {
             wgen.GenerateStructures(pos, BiomeCode.DESERT, structCode, 9, blockdata, statedata, hpdata, range: true);
         }
     }
 }
Beispiel #4
0
 public void GenerateSnowyForestStructures(ChunkLoader_Server cl, ChunkPos pos, ushort[] blockdata, ushort[] statedata, ushort[] hpdata)
 {
     foreach (int structCode in BiomeHandler.GetBiomeStructs(BiomeCode.FOREST))
     {
         if (structCode == 1 || structCode == 2 || structCode == 8) // Trees
         {
             wgen.GenerateStructures(pos, BiomeCode.FOREST, structCode, 0, blockdata, statedata, hpdata);
         }
         else if (structCode == 3 || structCode == 4) // Dirt Piles
         {
             wgen.GenerateStructures(pos, BiomeCode.FOREST, structCode, 3, blockdata, statedata, hpdata, range: true);
         }
         else if (structCode >= 9 && structCode <= 11) // Metal veins
         {
             wgen.GenerateStructures(pos, BiomeCode.FOREST, structCode, 9, blockdata, statedata, hpdata, range: true);
         }
     }
 }
Beispiel #5
0
 public void GenerateGrassyHighlandsStructures(ChunkLoader_Server cl, ChunkPos pos, ushort[] blockdata, ushort[] statedata, ushort[] hpdata)
 {
     foreach (int structCode in BiomeHandler.GetBiomeStructs(BiomeCode.GRASSY_HIGHLANDS))
     {
         if (structCode == 2) // Tree
         {
             wgen.GenerateStructures(pos, BiomeCode.GRASSY_HIGHLANDS, structCode, 0, blockdata, statedata, hpdata);
         }
         else if (structCode == 3 || structCode == 4) // Dirt Piles
         {
             wgen.GenerateStructures(pos, BiomeCode.GRASSY_HIGHLANDS, structCode, 3, blockdata, statedata, hpdata, range: true);
         }
         else if (structCode == 5) // Boulder
         {
             wgen.GenerateStructures(pos, BiomeCode.GRASSY_HIGHLANDS, structCode, 1, blockdata, statedata, hpdata);
         }
         else if (structCode >= 9 && structCode <= 11) // Metal veins
         {
             wgen.GenerateStructures(pos, BiomeCode.GRASSY_HIGHLANDS, structCode, 9, blockdata, statedata, hpdata, range: true);
         }
     }
 }