Skip to content

Commit

Permalink
Remove "burst" from the code for good (#48856)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fris0uman authored and ZhilkinSerg committed Jun 14, 2021
1 parent d46f89e commit 1d3948b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 18 deletions.
2 changes: 1 addition & 1 deletion data/json/items/gun/shot.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] ],
Expand Down
3 changes: 1 addition & 2 deletions doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>() ) );
}

if( obj.gun->handling < 0 ) {
// TODO: specify in JSON via classes
Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down
3 changes: 0 additions & 3 deletions src/itype.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<gun_mode_id, gun_modifier_data> 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;

Expand Down

0 comments on commit 1d3948b

Please sign in to comment.