Skip to content

Commit

Permalink
Merge pull request #72927 from PatrikLundell/retain_hole_construction
Browse files Browse the repository at this point in the history
Retain hole construction
  • Loading branch information
Maleclypse authored Apr 18, 2024
2 parents f234170 + ff5eb47 commit 5b6b22d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/json/furniture_and_terrain/terrain-migo.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"sound": "boom!",
"sound_fail": "whack!",
"ter_set": "t_null",
"ter_set_bashed_from_above": "t_platform_resin",
"items": [ { "item": "resin_chunk", "count": [ 10, 40 ] } ]
}
},
Expand Down
29 changes: 29 additions & 0 deletions src/construction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,35 @@ void complete_construction( Character *you )
}
}
}

if( ter_id( built.post_terrain ).id() == ter_t_open_air ) {
const tripoint_bub_ms below = terp + tripoint_below;
if( below.z() > -OVERMAP_DEPTH && here.ter( below ).obj().has_flag( "SUPPORTS_ROOF" ) ) {
const map_bash_info bash_info = here.ter( below ).obj().bash;
// ter_set_bashed_from_above should default to ter_set
if( bash_info.ter_set_bashed_from_above.id() == t_null ) {
if( below.z() >= -1 ) {
// Stupid to set soil at above the ground level, but if they haven't defined
// anything for the terrain that's what you'll get.
// Trying to get the regional version of soil. There ought to be a sane way to do this...
ter_id converted_terrain = ter_t_dirt;
regional_settings settings = g->get_cur_om().get_settings();
std::map<std::string, int> soil_map =
settings.region_terrain_and_furniture.unfinalized_terrain.find( "t_region_soil" )->second;
if( !soil_map.empty() ) {
converted_terrain = ter_id(
settings.region_terrain_and_furniture.unfinalized_terrain.find( "t_region_soil" )->second.begin()->first );
}
here.ter_set( below, converted_terrain );
} else {
// At the time of writing there doesn't seem to be any regional definition of "rock" (which would have to be smashed to get a floor).
here.ter_set( below, ter_t_rock_floor );
}
} else {
here.ter_set( below, bash_info.ter_set_bashed_from_above.id() );
}
}
}
}
}

Expand Down

0 comments on commit 5b6b22d

Please sign in to comment.