Skip to content

Commit

Permalink
Merge pull request #36767 from kevingranade/fix-anthils-again
Browse files Browse the repository at this point in the history
Overhaul anthill generation to avoid conflicting with other map features
  • Loading branch information
ZhilkinSerg committed Jan 7, 2020
2 parents 28f902a + b225c73 commit a68dc58
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/overmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1534,13 +1534,10 @@ bool overmap::generate_sub( const int z )
} else if( oter_above == "cave_rat" && z == -2 ) {
ter_set( p, oter_id( "cave_rat" ) );
} else if( oter_above == "anthill" || oter_above == "acid_anthill" ) {
mongroup_id ant_group( oter_above == "anthill" ? "GROUP_ANT" : "GROUP_ANT_ACID" );
int size = rng( MIN_ANT_SIZE, MAX_ANT_SIZE );
const int size = rng( MIN_ANT_SIZE, MAX_ANT_SIZE );
ant_points.push_back( city( p.xy(), size ) );
add_mon_group( mongroup( ant_group, tripoint( i * 2, j * 2, z ),
( size * 3 ) / 2, rng( 6000, 8000 ) ) );
} else if( oter_above == "slimepit_down" ) {
int size = rng( MIN_GOO_SIZE, MAX_GOO_SIZE );
const int size = rng( MIN_GOO_SIZE, MAX_GOO_SIZE );
goo_points.push_back( city( p.xy(), size ) );
} else if( oter_above == "forest_water" ) {
ter_set( p, oter_id( "cavern" ) );
Expand Down Expand Up @@ -1586,10 +1583,6 @@ bool overmap::generate_sub( const int z )
const string_id<overmap_connection> sewer_tunnel( "sewer_tunnel" );
connect_closest_points( sewer_points, z, *sewer_tunnel );

for( auto &i : ant_points ) {
build_anthill( tripoint( i.pos, z ), i.size );
}

// A third of overmaps have labs with a 1-in-2 chance of being subway connected.
// If the central lab exists, all labs which go down to z=4 will have a subway to central.
int lab_train_odds = 0;
Expand Down Expand Up @@ -1735,6 +1728,17 @@ bool overmap::generate_sub( const int z )
ter_set( tripoint( i, z ), oter_id( "mine_shaft" ) );
requires_sub = true;
}
for( auto &i : ant_points ) {
if( ter( { i.pos, z } ) != "empty_rock" ) {
continue;
}
mongroup_id ant_group( ter( i.pos + tripoint_above ) == "anthill" ?
"GROUP_ANT" : "GROUP_ANT_ACID" );
add_mon_group( mongroup( ant_group, tripoint( i.pos.x * 2, i.pos.y * 2, z ),
( i.size * 3 ) / 2, rng( 6000, 8000 ) ) );
build_anthill( tripoint( i.pos, z ), i.size );
}

return requires_sub;
}

Expand Down Expand Up @@ -3177,7 +3181,7 @@ void overmap::build_anthill( const tripoint &p, int s )
}
}
if( queenpoints.empty() ) {
debugmsg( "No queenpoints when building anthill" );
debugmsg( "No queenpoints when building anthill, anthill over %s", ter( p ).id().str() );
}
const tripoint target = random_entry( queenpoints );
ter_set( target, oter_id( "ants_queen" ) );
Expand Down

0 comments on commit a68dc58

Please sign in to comment.