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

Method caveLiquidSeeds

source/game/StarWorldGeneration.cpp:1431–1447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1429}
1430
1431Set<Vec2I> WorldGenerator::caveLiquidSeeds(WorldStorage* worldStorage, ServerTileSectorArray::Sector const& sector) {
1432 RectI sectorTiles = worldStorage->tileArray()->sectorRegion(sector);
1433 auto samplePoint = sectorTiles.center();
1434 auto blockInfo = m_worldServer->worldTemplate()->blockInfo(samplePoint[0], samplePoint[1]);
1435 float seedDensity = blockInfo.caveLiquidSeedDensity;
1436 Set<Vec2I> nodes;
1437 if (seedDensity > 0) {
1438 int frequency = int(100 / seedDensity);
1439 for (int y = frequency * floor(sectorTiles.min()[1] / frequency); y < sectorTiles.max()[1]; y += frequency) {
1440 for (int x = frequency * floor(sectorTiles.min()[0] / frequency); x < sectorTiles.max()[0]; x += frequency) {
1441 if (sectorTiles.contains(Vec2I(x, y)))
1442 nodes.add(Vec2I(x, y));
1443 }
1444 }
1445 }
1446 return nodes;
1447}
1448
1449Map<Vec2I, float> WorldGenerator::determineLiquidLevel(Set<Vec2I> const& spots, Set<Vec2I> const& filled) {
1450 Set<Vec2I> openSet(spots);

Callers

nothing calls this directly

Calls 8

sectorRegionMethod · 0.80
blockInfoMethod · 0.80
worldTemplateMethod · 0.80
centerMethod · 0.45
minMethod · 0.45
maxMethod · 0.45
containsMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected