From 1ac253656f7301f49966e5875801e33f71ff4298 Mon Sep 17 00:00:00 2001 From: Chaosvolt Date: Sat, 3 Jun 2023 05:45:35 -0500 Subject: [PATCH] Fix vehicles turning bushes into pits (#2927) * Fix vehicles turning bushes into pits * Fix my fuckin' bork --- .../terrain-floors-outdoors.json | 14 +++++++------- data/json/furniture_and_terrain/terrain-flora.json | 4 ++-- data/json/furniture_and_terrain/terrain-traps.json | 2 +- doc/JSON_FLAGS.md | 1 + src/map.cpp | 3 ++- src/vehicle_autodrive.cpp | 3 ++- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/data/json/furniture_and_terrain/terrain-floors-outdoors.json b/data/json/furniture_and_terrain/terrain-floors-outdoors.json index 4b1bdac67bb6..22accf1c9766 100644 --- a/data/json/furniture_and_terrain/terrain-floors-outdoors.json +++ b/data/json/furniture_and_terrain/terrain-floors-outdoors.json @@ -7,7 +7,7 @@ "symbol": ".", "color": "brown", "move_cost": 2, - "flags": [ "TRANSPARENT", "DIGGABLE", "FLAT", "PLOWABLE" ], + "flags": [ "TRANSPARENT", "DIGGABLE", "FLAT", "PLOWABLE", "VEH_TREAT_AS_BASH_BELOW" ], "bash": { "sound": "thump", "ter_set": "t_pit_shallow", "str_min": 50, "str_max": 100, "str_min_supported": 100 } }, { @@ -18,7 +18,7 @@ "symbol": ".", "color": "yellow", "move_cost": 3, - "flags": [ "TRANSPARENT", "DIGGABLE", "FLAT", "NOCOLLIDE" ], + "flags": [ "TRANSPARENT", "DIGGABLE", "FLAT", "VEH_TREAT_AS_BASH_BELOW" ], "bash": { "sound": "thump", "ter_set": "t_pit_shallow", @@ -37,7 +37,7 @@ "color": "brown", "looks_like": "t_dirt", "move_cost": 3, - "flags": [ "TRANSPARENT", "DIGGABLE", "FLAT", "NOCOLLIDE" ], + "flags": [ "TRANSPARENT", "DIGGABLE", "FLAT", "VEH_TREAT_AS_BASH_BELOW" ], "bash": { "sound": "thump", "ter_set": "t_pit_shallow", "str_min": 50, "str_max": 100, "str_min_supported": 100 } }, { @@ -104,7 +104,7 @@ "symbol": "#", "color": "brown", "move_cost": 3, - "flags": [ "TRANSPARENT", "DIGGABLE", "MOUNTABLE", "NOCOLLIDE", "PLANTABLE" ], + "flags": [ "TRANSPARENT", "DIGGABLE", "MOUNTABLE", "VEH_TREAT_AS_BASH_BELOW", "PLANTABLE" ], "bash": { "sound": "thump", "ter_set": "t_dirt", "str_min": 50, "str_max": 100, "str_min_supported": 100 }, "examine_action": "dirtmound" }, @@ -118,7 +118,7 @@ "color": "brown", "move_cost": 3, "coverage": 40, - "flags": [ "TRANSPARENT", "DIGGABLE", "MOUNTABLE", "SUPPORTS_ROOF", "COLLAPSES", "INDOORS", "NOCOLLIDE" ], + "flags": [ "TRANSPARENT", "DIGGABLE", "MOUNTABLE", "SUPPORTS_ROOF", "COLLAPSES", "INDOORS", "VEH_TREAT_AS_BASH_BELOW" ], "bash": { "sound": "thump", "ter_set": "t_dirtfloor", @@ -151,7 +151,7 @@ "symbol": "#", "color": "green", "move_cost": 3, - "flags": [ "TRANSPARENT", "DIGGABLE", "MOUNTABLE", "NOCOLLIDE" ], + "flags": [ "TRANSPARENT", "DIGGABLE", "MOUNTABLE", "VEH_TREAT_AS_BASH_BELOW" ], "bash": { "sound": "thump", "ter_set": "t_dirt", "str_min": 50, "str_max": 100, "str_min_supported": 100 } }, { @@ -163,7 +163,7 @@ "symbol": "#", "color": "brown", "move_cost": 3, - "flags": [ "TRANSPARENT", "DIGGABLE", "MOUNTABLE", "NOCOLLIDE", "CONTAINER", "SEALED" ], + "flags": [ "TRANSPARENT", "DIGGABLE", "MOUNTABLE", "VEH_TREAT_AS_BASH_BELOW", "CONTAINER", "SEALED" ], "bash": { "sound": "thump", "ter_set": "t_dirt", "str_min": 50, "str_max": 100, "str_min_supported": 100 } }, { diff --git a/data/json/furniture_and_terrain/terrain-flora.json b/data/json/furniture_and_terrain/terrain-flora.json index b5df15ed14d2..76b4b6968cc1 100644 --- a/data/json/furniture_and_terrain/terrain-flora.json +++ b/data/json/furniture_and_terrain/terrain-flora.json @@ -2009,7 +2009,7 @@ "symbol": ",", "color": "green", "move_cost": 3, - "flags": [ "TRANSPARENT", "DIGGABLE", "FLAT", "PLOWABLE", "NOCOLLIDE" ], + "flags": [ "TRANSPARENT", "DIGGABLE", "FLAT", "PLOWABLE", "VEH_TREAT_AS_BASH_BELOW" ], "bash": { "sound": "thump", "ter_set": "t_pit_shallow", "str_min": 50, "str_max": 100, "str_min_supported": 100 } }, { @@ -2022,7 +2022,7 @@ "color": "green", "move_cost": 5, "coverage": 50, - "flags": [ "TRANSPARENT", "DIGGABLE", "PLOWABLE", "NOCOLLIDE" ], + "flags": [ "TRANSPARENT", "DIGGABLE", "PLOWABLE", "VEH_TREAT_AS_BASH_BELOW" ], "bash": { "sound": "thump", "ter_set": "t_pit_shallow", "str_min": 50, "str_max": 100, "str_min_supported": 100 } }, { diff --git a/data/json/furniture_and_terrain/terrain-traps.json b/data/json/furniture_and_terrain/terrain-traps.json index acd5a2b086f7..7abf75b3f22a 100644 --- a/data/json/furniture_and_terrain/terrain-traps.json +++ b/data/json/furniture_and_terrain/terrain-traps.json @@ -7,7 +7,7 @@ "symbol": "0", "color": "yellow", "move_cost": 8, - "flags": [ "TRANSPARENT", "DIGGABLE", "DIGGABLE_CAN_DEEPEN", "NOCOLLIDE" ], + "flags": [ "TRANSPARENT", "DIGGABLE", "DIGGABLE_CAN_DEEPEN", "VEH_TREAT_AS_BASH_BELOW" ], "bash": { "sound": "thump", "ter_set": "t_pit", "str_min": 50, "str_max": 100, "str_min_supported": 100 } }, { diff --git a/doc/JSON_FLAGS.md b/doc/JSON_FLAGS.md index 5957c1aa3a52..2ed65f71b5d2 100644 --- a/doc/JSON_FLAGS.md +++ b/doc/JSON_FLAGS.md @@ -601,6 +601,7 @@ List of known flags, used in both `terrain.json` and `furniture.json`. - ```TRANSPARENT``` Players and monsters can see through/past it. Also sets ter_t.transparent. - ```UNSTABLE``` Walking here cause the bouldering effect on the character. - ```USABLE_FIRE``` This terrain or furniture counts as a nearby fire for crafting. +- ```VEH_TREAT_AS_BASH_BELOW``` Vehicles will not collide with this even if it counts as rough terrain, like floor with bash_below does. Used for terrain meant to be turned into other terrain when smashed instead of destroying the tile beneath it. - ```WALL``` This terrain is an upright obstacle. Used for fungal conversion, and also implies `CONNECT_TO_WALL`. ### Examine Actions diff --git a/src/map.cpp b/src/map.cpp index 31b1d52fb9d0..d179f67b41ad 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2525,7 +2525,8 @@ bool map::is_bashable( const tripoint &p, const bool allow_floor ) const bool map::is_bashable_ter( const tripoint &p, const bool allow_floor ) const { const auto &ter_bash = ter( p ).obj().bash; - return ter_bash.str_max != -1 && ( !ter_bash.bash_below || allow_floor ); + return ter_bash.str_max != -1 && ( ( !ter_bash.bash_below && + !ter( p ).obj().has_flag( "VEH_TREAT_AS_BASH_BELOW" ) ) || allow_floor ); } bool map::is_bashable_furn( const tripoint &p ) const diff --git a/src/vehicle_autodrive.cpp b/src/vehicle_autodrive.cpp index e61a54000de9..6c29ca66feed 100644 --- a/src/vehicle_autodrive.cpp +++ b/src/vehicle_autodrive.cpp @@ -717,7 +717,8 @@ bool vehicle::autodrive_controller::check_drivable( tripoint pt ) const // terrain with neutral move cost or tagged with NOCOLLIDE will never cause // collisions return true; - } else if( terrain_type.bash.str_max >= 0 && !terrain_type.bash.bash_below ) { + } else if( terrain_type.bash.str_max >= 0 && !terrain_type.bash.bash_below && + !terrain_type.has_flag( "VEH_TREAT_AS_BASH_BELOW" ) ) { // bashable terrain (but not bashable floors) will cause collisions return false; } else if( terrain_type.has_flag( TFLAG_LIQUID ) ) {