Don't flow finite liquid into an unloaded chunk

This commit is contained in:
proller 2013-04-06 19:32:59 +04:00 committed by kwolekr
parent becd8c03fd
commit 120f02e20b
2 changed files with 10 additions and 6 deletions

@ -1763,6 +1763,11 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
total_level = LIQUID_LEVEL_SOURCE * can_liquid_same_level; total_level = LIQUID_LEVEL_SOURCE * can_liquid_same_level;
} }
// prevent lakes in air under unloaded blocks
if (p0.Y > water_level && neighbors[D_BOTTOM].n.getContent() == CONTENT_IGNORE) {
total_level = 0;
}
// calculate self level 5 blocks // calculate self level 5 blocks
u8 want_level = u8 want_level =
total_level >= LIQUID_LEVEL_SOURCE * can_liquid_same_level total_level >= LIQUID_LEVEL_SOURCE * can_liquid_same_level
@ -1807,8 +1812,8 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
} }
for (u16 ii = 0; ii < 7; ii++) // infinity and cave flood optimization for (u16 ii = 0; ii < 7; ii++) // infinity and cave flood optimization
if (liquid_levels_want[ii] >= 0 && if ( neighbors[ii].i ||
(neighbors[ii].i || (liquid_levels_want[ii] >= 0 &&
(fast_flood && p0.Y < water_level && (fast_flood && p0.Y < water_level &&
(initial_size >= 1000 (initial_size >= 1000
&& ii != D_TOP && ii != D_TOP
@ -1916,8 +1921,7 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
if(!suspect.empty()){ if(!suspect.empty()){
// Blame suspect // Blame suspect
RollbackScopeActor rollback_scope(m_gamedef->rollback(), RollbackScopeActor rollback_scope(m_gamedef->rollback(), suspect, true);
suspect, true);
// Get old node for rollback // Get old node for rollback
RollbackNode rollback_oldnode(this, p0, m_gamedef); RollbackNode rollback_oldnode(this, p0, m_gamedef);
// Set node // Set node

@ -265,9 +265,9 @@ void MapgenIndev::defineCave(Cave & cave, PseudoRandom ps, v3s16 node_min, bool
cave.part_max_length_rs = ps.range(2,4); cave.part_max_length_rs = ps.range(2,4);
if (node_min.Y < -100 && !ps.range(0, farscale(0.2, node_min.X,node_min.Y,node_min.Z)*30)) { //huge if (node_min.Y < -100 && !ps.range(0, farscale(0.2, node_min.X,node_min.Y,node_min.Z)*30)) { //huge
cave.flooded = !ps.range(0, 3); cave.flooded = !ps.range(0, 3);
cave.tunnel_routepoints = ps.range(5, 20); cave.tunnel_routepoints = ps.range(5, 30);
cave.min_tunnel_diameter = 30; cave.min_tunnel_diameter = 30;
cave.max_tunnel_diameter = ps.range(40, ps.range(80,120)); cave.max_tunnel_diameter = ps.range(40, ps.range(80,200));
} else { } else {
cave.tunnel_routepoints = ps.range(5, ps.range(15,30)); cave.tunnel_routepoints = ps.range(5, ps.range(15,30));
cave.min_tunnel_diameter = 5; cave.min_tunnel_diameter = 5;