Skip to content

Commit

Permalink
Merge pull request CleverRaven#87 from Firestorm01X2/ammo-fix
Browse files Browse the repository at this point in the history
Extend ammo effects and Fix Grenade launcher rounds don't explode
  • Loading branch information
Coolthulhu authored Oct 3, 2020
2 parents ebd4f88 + a3c3760 commit 04edad3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data/json/items/ammo/40x46mm.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"weight": "230 g",
"damage": { "damage_type": "stab", "amount": 200, "armor_penetration": 30 },
"casing": "40x46mm_m118_casing",
"extend": { "effects": [ "EXPLOSIVE_m433" ] }
"extend": { "effects": [ "FRAG" ] }
},
{
"id": "40x46mm_m576",
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/ammo/40x53mm.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"volume": "132 ml",
"damage": { "damage_type": "stab", "amount": 250, "armor_penetration": 45 },
"casing": "40x53mm_m169_casing",
"extend": { "effects": [ "EXPLOSIVE_m430a1" ] }
"extend": { "effects": [ "FRAG" ] }
},
{
"id": "40x53mm_buckshot_m169",
Expand Down
18 changes: 18 additions & 0 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,24 @@ void islot_ammo::load( const JsonObject &jo )
optional( jo, was_loaded, "count", def_charges, 1 );
optional( jo, was_loaded, "loudness", loudness, -1 );
optional( jo, was_loaded, "effects", ammo_effects );
if( jo.has_object( "extend" ) ) {
JsonObject tmp = jo.get_object( "extend" );
tmp.allow_omitted_members();
std::set<std::string> ammo_effects_ext;
optional( tmp, was_loaded, "effects", ammo_effects_ext );
ammo_effects.insert( ammo_effects_ext.begin(), ammo_effects_ext.end() );
}
if( jo.has_object( "delete" ) ) {
JsonObject tmp = jo.get_object( "delete" );
tmp.allow_omitted_members();
std::set<std::string> ammo_effects_ext;
optional( tmp, was_loaded, "effects", ammo_effects_ext );
for( auto it : ammo_effects_ext ) {
if( ammo_effects.count( it ) ) {
ammo_effects.erase( it );
}
}
}
optional( jo, was_loaded, "show_stats", force_stat_display, cata::nullopt );
}

Expand Down

0 comments on commit 04edad3

Please sign in to comment.