From 1ae4d1a4663d0fc681010d9765100530e4643c2e Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Tue, 9 Apr 2024 13:00:46 +0200 Subject: [PATCH 1/4] Converted t_floor_resin smashed terrain to t_platform_resin --- data/json/furniture_and_terrain/terrain-migo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/furniture_and_terrain/terrain-migo.json b/data/json/furniture_and_terrain/terrain-migo.json index 2d365418a53b7..65b03780296b9 100644 --- a/data/json/furniture_and_terrain/terrain-migo.json +++ b/data/json/furniture_and_terrain/terrain-migo.json @@ -54,7 +54,7 @@ "str_max": 700, "sound": "boom!", "sound_fail": "whack!", - "ter_set": "t_null", + "ter_set": "t_floor_resin", "items": [ { "item": "resin_chunk", "count": [ 10, 40 ] } ] } }, From efe9f9e9288aacf0e98e3082bc0c53eef176c6e4 Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Tue, 9 Apr 2024 13:01:39 +0200 Subject: [PATCH 2/4] Converts terrain whose roof is removed through construction into roofless terrain --- src/construction.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/construction.cpp b/src/construction.cpp index e78715131efb8..716b519b1a1ac 100644 --- a/src/construction.cpp +++ b/src/construction.cpp @@ -107,6 +107,7 @@ static const ter_str_id ter_t_open_air( "t_open_air" ); static const ter_str_id ter_t_pit( "t_pit" ); static const ter_str_id ter_t_ramp_down_high( "t_ramp_down_high" ); static const ter_str_id ter_t_ramp_down_low( "t_ramp_down_low" ); +static const ter_str_id ter_t_region_soil( "t_region_soil" ); static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); static const ter_str_id ter_t_sand( "t_sand" ); static const ter_str_id ter_t_stairs_down( "t_stairs_down" ); @@ -1141,6 +1142,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 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() ); + } + } + } } } From b67e1c80332894c4d969aedca1edf727b2e0df81 Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Tue, 9 Apr 2024 13:17:56 +0200 Subject: [PATCH 3/4] moved change from ter_set to ter_set_bashed_from_above --- data/json/furniture_and_terrain/terrain-migo.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/json/furniture_and_terrain/terrain-migo.json b/data/json/furniture_and_terrain/terrain-migo.json index 65b03780296b9..e2f151a55d440 100644 --- a/data/json/furniture_and_terrain/terrain-migo.json +++ b/data/json/furniture_and_terrain/terrain-migo.json @@ -54,7 +54,8 @@ "str_max": 700, "sound": "boom!", "sound_fail": "whack!", - "ter_set": "t_floor_resin", + "ter_set": "t_null", + "ter_set_bashed_from_above": "t_platform_resin", "items": [ { "item": "resin_chunk", "count": [ 10, 40 ] } ] } }, From ff5eb475682027f15a88dff76af4b5652148e48b Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Tue, 9 Apr 2024 14:24:05 +0200 Subject: [PATCH 4/4] Removed unused constant --- src/construction.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/construction.cpp b/src/construction.cpp index 716b519b1a1ac..ace145da9b279 100644 --- a/src/construction.cpp +++ b/src/construction.cpp @@ -107,7 +107,6 @@ static const ter_str_id ter_t_open_air( "t_open_air" ); static const ter_str_id ter_t_pit( "t_pit" ); static const ter_str_id ter_t_ramp_down_high( "t_ramp_down_high" ); static const ter_str_id ter_t_ramp_down_low( "t_ramp_down_low" ); -static const ter_str_id ter_t_region_soil( "t_region_soil" ); static const ter_str_id ter_t_rock_floor( "t_rock_floor" ); static const ter_str_id ter_t_sand( "t_sand" ); static const ter_str_id ter_t_stairs_down( "t_stairs_down" );