diff --git a/data/json/vehicleparts/armor.json b/data/json/vehicleparts/armor.json index 877bc725586b..a4ca5cdcb26f 100644 --- a/data/json/vehicleparts/armor.json +++ b/data/json/vehicleparts/armor.json @@ -32,6 +32,7 @@ "color": "dark_gray", "broken_color": "dark_gray", "durability": 340, + "bonus": 50, "description": "A system of springs and pads, intended to cushion the effects of collisions on the interior of your vehicle.", "breaks_into": [ { "item": "scrap", "count": [ 1, 5 ] }, { "item": "spring", "count": [ 0, 4 ] } ], "requirements": { @@ -39,7 +40,7 @@ "removal": { "skills": [ [ "mechanics", 2 ] ], "time": "30 m", "using": [ [ "vehicle_weld_removal", 1 ] ] }, "repair": { "skills": [ [ "mechanics", 5 ] ], "time": "60 m", "using": [ [ "welding_standard", 5 ] ] } }, - "flags": [ "ARMOR" ], - "damage_reduction": { "all": 15, "bash": 100 } + "flags": [ "SHOCK_ABSORBER" ], + "damage_reduction": { "all": 25 } } ] diff --git a/data/json/vehicleparts/vp_flags.json b/data/json/vehicleparts/vp_flags.json index 0c431687d4e4..1b8f2532d5d8 100644 --- a/data/json/vehicleparts/vp_flags.json +++ b/data/json/vehicleparts/vp_flags.json @@ -22,7 +22,7 @@ "id": "ARMOR", "type": "json_flag", "context": [ "vehicle_part" ], - "info": "Armor plate. Will partially protect other components on the same frame from damage." + "info": "Armor plate. Will partially protect other components on the same frame from damage from direct attacks but not from the shock damage of a distant collision." }, { "id": "BED", @@ -133,6 +133,12 @@ "info": "This part will help prevent you from being thrown from the vehicle in a collision. You will automatically enable this part when you move into a tile with it.", "requires_flag": "BELTABLE" }, + { + "id": "SHOCK_ABSORBER", + "type": "json_flag", + "context": [ "vehicle_part" ], + "info": "Armor plate. Will partially protect other components on the same frame from the shock damage of a distant collision but not from direct attacks." + }, { "id": "STABLE", "type": "json_flag", diff --git a/src/vehicle.cpp b/src/vehicle.cpp index d8b6d59d4c8d..b5c52d6f5a91 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -6613,9 +6613,16 @@ void vehicle::damage_all( int dmg1, int dmg2, damage_type type, point impact ) for( const vpart_reference &vp : get_all_parts() ) { const size_t p = vp.part_index(); int distance = 1 + square_dist( vp.mount(), impact ); - if( distance > 1 && part_info( p ).location == part_location_structure && - !part_info( p ).has_flag( "PROTRUSION" ) ) { - damage_direct( p, rng( dmg1, dmg2 ) / ( distance * distance ), type ); + if( distance > 1 ) { + int net_dmg = rng( dmg1, dmg2 ) / ( distance * distance ); + if( part_info( p ).location != part_location_structure || + !part_info( p ).has_flag( "PROTRUSION" ) ) { + int shock_absorber = part_with_feature( p, "SHOCK_ABSORBER", true ); + if( shock_absorber >= 0 ) { + net_dmg = std::max( 0, net_dmg - parts[ shock_absorber ].info().bonus ); + } + } + damage_direct( p, net_dmg, type ); } } }