From c0148208a411d81e4a1ac1412e76b5f5e3c4bc20 Mon Sep 17 00:00:00 2001 From: Fris0uman <41293484+Fris0uman@users.noreply.github.com> Date: Fri, 28 May 2021 12:10:44 +0200 Subject: [PATCH] Remove "burst" from the code for good (#48856) --- data/json/items/gun/shot.json | 2 +- doc/JSON_INFO.md | 3 +-- src/item_factory.cpp | 12 ------------ src/itype.h | 3 --- 4 files changed, 2 insertions(+), 18 deletions(-) diff --git a/data/json/items/gun/shot.json b/data/json/items/gun/shot.json index a0c1f6dde9f75..662fbbcbf64b9 100644 --- a/data/json/items/gun/shot.json +++ b/data/json/items/gun/shot.json @@ -53,7 +53,7 @@ "material": [ "steel" ], "dispersion": 855, "durability": 8, - "burst": 6, + "modes": [ [ "DEFAULT", "burst", 6 ] ], "ups_charges": 1, "reload": 200, "valid_mod_locations": [ [ "accessories", 4 ], [ "sights", 1 ], [ "rail mount", 1 ] ], diff --git a/doc/JSON_INFO.md b/doc/JSON_INFO.md index ea1e15b2fde8d..decfedccd4ab4 100644 --- a/doc/JSON_INFO.md +++ b/doc/JSON_INFO.md @@ -2686,7 +2686,6 @@ Guns can be defined like this: "durability": 8, // Resistance to damage/rusting, also determines misfire chance "blackpowder_tolerance": 8,// One in X chance to get clogged up (per shot) when firing blackpowder ammunition (higher is better). Optional, default is 8. "min_cycle_recoil": 0, // Minimum ammo recoil for gun to be able to fire more than once per attack. -"burst": 5, // Number of shots fired in burst mode "variants": [ // Cosmetic variants this gun can have { "id": "varianta", // id used in spawning to spawn this variant specifically @@ -2699,6 +2698,7 @@ Guns can be defined like this: "clip_size": 100, // Maximum amount of ammo that can be loaded "ups_charges": 0, // Additionally to the normal ammo (if any), a gun can require some charges from an UPS. This also works on mods. Attaching a mod with ups_charges will add/increase ups drain on the weapon. "ammo_to_fire" 1, // Amount of ammo used +"modes": [ [ "DEFAULT", "semi-auto", 1 ], [ "AUTO", "auto", 4 ] ], // Firing modes on this gun, DEFAULT,AUTO, or MELEE followed by the name of the mode displayed in game, and finaly the number of shots of the mod. "reload": 450, // Amount of time to reload, 100 = 1 second = 1 "turn" "built_in_mods": ["m203"], //An array of mods that will be integrated in the weapon using the IRREMOVABLE tag. "default_mods": ["m203"] //An array of mods that will be added to a weapon on spawn. @@ -2731,7 +2731,6 @@ Gun mods can be defined like this: "acceptable_ammo": [ "9mm" ], // Optional filter restricting mod to guns with those base (before modifiers) ammo types "ammo_modifier": [ "57" ], // Optional field which if specified modifies parent gun to use these ammo types "magazine_adaptor": [ [ "223", [ "stanag30" ] ] ], // Optional field which changes the types of magazines the parent gun accepts -"burst_modifier": 3, // Optional field increasing or decreasing base gun burst size "damage_modifier": -1, // Optional field increasing or decreasing base gun damage "dispersion_modifier": 15, // Optional field increasing or decreasing base gun dispersion "loudness_modifier": 4, // Optional field increasing or decreasing base guns loudness diff --git a/src/item_factory.cpp b/src/item_factory.cpp index c7f736d1e3eef..dd7ecebfc358a 100644 --- a/src/item_factory.cpp +++ b/src/item_factory.cpp @@ -418,12 +418,6 @@ void Item_factory::finalize_pre( itype &obj ) gun_modifier_data( to_translation( "melee" ), 1, { "MELEE" } ) ); } - if( obj.gun->burst > 1 ) { - // handle legacy JSON format - obj.gun->modes.emplace( gun_mode_id( "AUTO" ), - gun_modifier_data( to_translation( "auto" ), obj.gun->burst, - std::set() ) ); - } if( obj.gun->handling < 0 ) { // TODO: specify in JSON via classes @@ -1795,11 +1789,6 @@ void gun_variant_data::load( const JsonObject &jo ) void Item_factory::load( islot_gun &slot, const JsonObject &jo, const std::string &src ) { bool strict = src == "dda"; - - if( jo.has_member( "burst" ) && jo.has_member( "modes" ) ) { - jo.throw_error( "cannot specify both burst and modes", "burst" ); - } - assign( jo, "skill", slot.skill_used, strict ); assign( jo, "ammo", slot.ammo, strict ); assign( jo, "range", slot.range, strict ); @@ -1811,7 +1800,6 @@ void Item_factory::load( islot_gun &slot, const JsonObject &jo, const std::strin assign( jo, "recoil", slot.recoil, strict, 0 ); assign( jo, "handling", slot.handling, strict ); assign( jo, "durability", slot.durability, strict, 0, 10 ); - assign( jo, "burst", slot.burst, strict, 1 ); assign( jo, "loudness", slot.loudness, strict ); assign( jo, "clip_size", slot.clip, strict, 0 ); assign( jo, "reload", slot.reload_time, strict, 0 ); diff --git a/src/itype.h b/src/itype.h index 05c6de659d557..35c5f3e1ba2c1 100644 --- a/src/itype.h +++ b/src/itype.h @@ -546,9 +546,6 @@ struct islot_gun : common_ranged_data { /** Firing modes are supported by the gun. Always contains at least DEFAULT mode */ std::map modes; - /** Burst size for AUTO mode (legacy field for items not migrated to specify modes ) */ - int burst = 0; - /** How easy is control of recoil? If unset value automatically derived from weapon type */ int handling = -1;