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

Method validBiomeItems

source/game/StarWorldTemplate.cpp:525–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525List<BiomeItemPlacement> WorldTemplate::validBiomeItems(int x, int y, PotentialBiomeItems potentialBiomeItems) const {
526 if (y <= 0 || y >= (int)m_geometry.height() - 1)
527 return {};
528
529 x = m_geometry.xwrap(x);
530
531 auto block = getBlockInfo(x, y);
532
533 if (block.biomeTransition)
534 return {};
535 List<BiomeItemPlacement> biomeItems;
536
537 auto blockAbove = getBlockInfo(x, y + 1);
538 auto blockBelow = getBlockInfo(x, y - 1);
539
540 if (!blockBelow.biomeTransition && blockBelow.terrain && !block.terrain && !blockBelow.foregroundCave)
541 biomeItems.appendAll(std::move(potentialBiomeItems.surfaceBiomeItems));
542
543 if (!blockBelow.biomeTransition && blockBelow.terrain && block.terrain && !blockBelow.foregroundCave && block.foregroundCave)
544 biomeItems.appendAll(std::move(potentialBiomeItems.caveSurfaceBiomeItems));
545
546 if (!blockAbove.biomeTransition && blockAbove.terrain && block.terrain && !blockAbove.foregroundCave && block.foregroundCave)
547 biomeItems.appendAll(std::move(potentialBiomeItems.caveCeilingBiomeItems));
548
549 if (block.terrain && block.foregroundCave && !block.backgroundCave)
550 biomeItems.appendAll(std::move(potentialBiomeItems.caveBackgroundBiomeItems));
551
552 if (block.oceanLiquid != EmptyLiquidId && y == block.oceanLiquidLevel)
553 biomeItems.appendAll(std::move(potentialBiomeItems.oceanItems));
554
555 return biomeItems;
556}
557
558float WorldTemplate::gravity() const {
559 if (m_worldParameters)

Callers 2

generateMicroDungeonsMethod · 0.80
prepareSectorMethod · 0.80

Calls 3

appendAllMethod · 0.80
heightMethod · 0.45
xwrapMethod · 0.45

Tested by

no test coverage detected