MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / replaceBiomeBlocks

Method replaceBiomeBlocks

source/game/StarWorldGeneration.cpp:713–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711}
712
713void WorldGenerator::replaceBiomeBlocks(ServerTile* tile) {
714 if (auto blockBiome = m_worldServer->worldTemplate()->biome(tile->blockBiomeIndex)) {
715 if (tile->foreground == BiomeMaterialId) {
716 tile->foreground = blockBiome->mainBlock;
717 tile->foregroundHueShift = m_worldServer->worldTemplate()->biomeMaterialHueShift(tile->blockBiomeIndex, tile->foreground);
718 } else if ((tile->foreground >= Biome1MaterialId) && (tile->foreground <= Biome5MaterialId)) {
719 auto& subblocks = blockBiome->subBlocks;
720 if (subblocks.size())
721 tile->foreground = subblocks[(tile->foreground - Biome1MaterialId) % subblocks.size()];
722 else
723 tile->foreground = blockBiome->mainBlock;
724 tile->foregroundHueShift = m_worldServer->worldTemplate()->biomeMaterialHueShift(tile->blockBiomeIndex, tile->foreground);
725 }
726
727 if (tile->background == BiomeMaterialId) {
728 tile->background = blockBiome->mainBlock;
729 tile->backgroundHueShift =
730 m_worldServer->worldTemplate()->biomeMaterialHueShift(tile->blockBiomeIndex, tile->background);
731 } else if ((tile->background >= Biome1MaterialId) && (tile->background <= Biome5MaterialId)) {
732 auto& subblocks = blockBiome->subBlocks;
733 if (subblocks.size())
734 tile->background = subblocks[(tile->background - Biome1MaterialId) % subblocks.size()];
735 else
736 tile->background = blockBiome->mainBlock;
737 tile->backgroundHueShift = m_worldServer->worldTemplate()->biomeMaterialHueShift(tile->blockBiomeIndex, tile->background);
738 }
739 } else {
740 if (isBiomeMaterial(tile->foreground)) {
741 tile->foreground = EmptyMaterialId;
742 tile->foregroundHueShift = 0;
743 }
744 if (isBiomeMod(tile->foregroundMod)) {
745 tile->foregroundMod = NoModId;
746 tile->foregroundModHueShift = 0;
747 }
748 if (isBiomeMaterial(tile->background)) {
749 tile->background = EmptyMaterialId;
750 tile->backgroundHueShift = 0;
751 }
752 if (isBiomeMod(tile->backgroundMod)) {
753 tile->backgroundMod = NoModId;
754 tile->backgroundModHueShift = 0;
755 }
756 }
757}
758
759void WorldGenerator::prepareTiles(WorldStorage* worldStorage, ServerTileSectorArray::Sector const& sector) {
760 auto materialDatabase = Root::singleton().materialDatabase();

Callers 1

placeDungeonMethod · 0.80

Calls 6

isBiomeMaterialFunction · 0.85
isBiomeModFunction · 0.85
biomeMethod · 0.80
worldTemplateMethod · 0.80
biomeMaterialHueShiftMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected