Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain hole construction #72927

Merged
merged 4 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1141,6 +1141,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
Loading