Skip to content

Commit

Permalink
Fix vehicles turning bushes into pits (cataclysmbnteam#2927)
Browse files Browse the repository at this point in the history
* Fix vehicles turning bushes into pits

* Fix my fuckin' bork
  • Loading branch information
chaosvolt committed Jun 3, 2023
1 parent 50e8cc1 commit 1ac2536
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
14 changes: 7 additions & 7 deletions data/json/furniture_and_terrain/terrain-floors-outdoors.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
},
{
Expand All @@ -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",
Expand All @@ -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 }
},
{
Expand Down Expand Up @@ -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"
},
Expand All @@ -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",
Expand Down Expand Up @@ -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 }
},
{
Expand All @@ -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 }
},
{
Expand Down
4 changes: 2 additions & 2 deletions data/json/furniture_and_terrain/terrain-flora.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
},
{
Expand All @@ -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 }
},
{
Expand Down
2 changes: 1 addition & 1 deletion data/json/furniture_and_terrain/terrain-traps.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
},
{
Expand Down
1 change: 1 addition & 0 deletions doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/vehicle_autodrive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down

0 comments on commit 1ac2536

Please sign in to comment.