Skip to content

Commit

Permalink
Merge pull request #37361 from snipercup/Installing-gunmods-takes-time
Browse files Browse the repository at this point in the history
Installing gunmods takes time
  • Loading branch information
Rivet-the-Zombie authored Jan 30, 2020
2 parents 61cd828 + 418ce60 commit b937983
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion data/json/items/gunmod/conversions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"color": "green",
"location": "bore",
"mod_targets": [ "ar15", "m4a1", "m16a4", "h&k416a5", "m27iar" ],
"//install_time": "1 m",
"install_time": "1 m",
"ammo_modifier": "300blk",
"magazine_adaptor": [ [ "300blk", [ "stanag30", "stanag50", "survivor223mag" ] ] ],
"min_skills": [ [ "weapon", 1 ] ],
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/gunmod/loading_port.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"volume": "149 ml",
"integral_volume": "149 ml",
"price": 15700,
"//install_time": "8 m",
"install_time": "8 m",
"material": "aluminum",
"symbol": ":",
"color": "green",
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/gunmod/magazine.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"location": "magazine",
"mod_targets": [ "pistol", "rifle" ],
"acceptable_ammo": [ "9mm", "460", "223" ],
"//install_time": "60 m",
"install_time": "60 m",
"magazine_adaptor": [ [ "9mm", [ "lw21mag" ] ], [ "460", [ "lw12mag" ] ], [ "223", [ "lw223mag", "lw223bigmag" ] ] ],
"min_skills": [ [ "weapon", 4 ], [ "mechanics", 3 ] ],
"flags": [ "INSTALL_DIFFICULT", "IRREMOVABLE" ]
Expand Down
8 changes: 4 additions & 4 deletions data/json/items/gunmod/mechanism.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"color": "dark_gray",
"location": "mechanism",
"mod_targets": [ "smg", "rifle", "pistol", "shotgun", "launcher" ],
"//install_time": "30 m",
"install_time": "30 m",
"dispersion_modifier": -1,
"min_skills": [ [ "weapon", 4 ], [ "mechanics", 3 ], [ "gun", 2 ] ]
},
Expand All @@ -34,7 +34,7 @@
"location": "mechanism",
"mod_targets": [ "ar15" ],
"//": "Install time short since it drops in, hinging open the AR being all the 'skill' necessary. Precision drop marginal since it'd change how semi and FA trigger pulls feel.",
"//install_time": "5 m",
"install_time": "5 m",
"dispersion_modifier": 10,
"//durability_modifier": -1,
"mode_modifier": [ [ "AUTO", "auto", 4 ] ],
Expand All @@ -55,7 +55,7 @@
"location": "mechanism",
"mod_targets": [ "ar15" ],
"//": "Sort of long install time. Gotta grind down the carrier trip to SP1-ish length. Unfortunately, since you're sort of guessing how long that is, the AR's timing with this installed will be borked.(disco might be disengaged at non-ideal times).",
"//install_time": "25 m",
"install_time": "25 m",
"dispersion_modifier": 40,
"consume_chance": 300,
"consume_divisor": 110,
Expand All @@ -78,7 +78,7 @@
"color": "dark_gray",
"location": "mechanism",
"mod_targets": [ "smg", "rifle", "pistol", "shotgun", "launcher" ],
"//install_time": "10 m",
"install_time": "10 m",
"min_skills": [ [ "weapon", 2 ] ],
"flags": [ "WATERPROOF_GUN" ]
}
Expand Down
14 changes: 7 additions & 7 deletions data/json/items/gunmod/mount.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"color": "light_gray",
"location": "grip mount",
"mod_targets": [ "smg", "rifle", "pistol", "shotgun", "crossbow", "launcher" ],
"//install_time": 60000,
"install_time": 60000,
"min_skills": [ [ "gun", 5 ] ],
"add_mod": [ [ "grip", 1 ] ],
"flags": [ "INSTALL_DIFFICULT", "IRREMOVABLE" ]
Expand All @@ -31,7 +31,7 @@
"color": "light_gray",
"location": "rail mount",
"mod_targets": [ "smg", "rifle", "pistol", "shotgun", "crossbow", "launcher" ],
"//install_time": 15000,
"install_time": 15000,
"min_skills": [ [ "gun", 3 ] ],
"add_mod": [ [ "rail", 1 ] ],
"flags": [ "INSTALL_DIFFICULT", "IRREMOVABLE" ]
Expand All @@ -49,7 +49,7 @@
"color": "light_gray",
"location": "sights mount",
"mod_targets": [ "smg", "rifle", "shotgun", "crossbow" ],
"//install_time": 15000,
"install_time": 15000,
"min_skills": [ [ "gun", 3 ] ],
"add_mod": [ [ "sights", 1 ] ],
"flags": [ "INSTALL_DIFFICULT", "IRREMOVABLE" ]
Expand All @@ -67,7 +67,7 @@
"color": "light_gray",
"location": "sights mount",
"mod_targets": [ "launcher" ],
"//install_time": 15000,
"install_time": 15000,
"min_skills": [ [ "gun", 3 ] ],
"add_mod": [ [ "sights", 1 ] ],
"flags": [ "INSTALL_DIFFICULT", "IRREMOVABLE" ]
Expand All @@ -85,7 +85,7 @@
"color": "light_gray",
"location": "sights mount",
"mod_targets": [ "pistol" ],
"//install_time": 15000,
"install_time": 15000,
"min_skills": [ [ "gun", 3 ] ],
"add_mod": [ [ "sights", 1 ] ],
"flags": [ "INSTALL_DIFFICULT", "IRREMOVABLE" ]
Expand All @@ -104,7 +104,7 @@
"color": "light_gray",
"location": "stock mount",
"mod_targets": [ "smg", "rifle", "pistol", "shotgun", "crossbow", "launcher" ],
"//install_time": 60000,
"install_time": 60000,
"min_skills": [ [ "gun", 5 ] ],
"add_mod": [ [ "stock", 1 ] ],
"flags": [ "INSTALL_DIFFICULT", "IRREMOVABLE" ]
Expand All @@ -122,7 +122,7 @@
"color": "light_gray",
"location": "underbarrel mount",
"mod_targets": [ "smg", "rifle", "pistol", "shotgun", "crossbow", "launcher", "bow" ],
"//install_time": 15000,
"install_time": 15000,
"min_skills": [ [ "gun", 3 ] ],
"add_mod": [ [ "underbarrel", 1 ] ],
"flags": [ "INSTALL_DIFFICULT", "IRREMOVABLE" ]
Expand Down
4 changes: 2 additions & 2 deletions data/json/items/gunmod/muzzle.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"color": "dark_gray",
"location": "muzzle",
"mod_targets": [ "pistol", "smg", "rifle" ],
"//install_time": "0 m",
"install_time": "0 m",
"handling_modifier": 2,
"consume_divisor": 840,
"loudness_modifier": -50,
Expand Down Expand Up @@ -201,7 +201,7 @@
"color": "dark_gray",
"location": "muzzle",
"mod_targets": [ "pistol", "smg" ],
"//install_time": "0 m",
"install_time": "0 m",
"consume_chance": 7000,
"consume_divisor": 85,
"handling_modifier": 1,
Expand Down
6 changes: 3 additions & 3 deletions data/json/items/gunmod/sights.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"color": "dark_gray",
"location": "sights",
"mod_targets": [ "rifle", "crossbow", "launcher" ],
"//install_time": "30 m",
"install_time": "30 m",
"sight_dispersion": 0,
"aim_speed": 0,
"min_skills": [ [ "weapon", 2 ], [ "gun", 4 ] ],
Expand All @@ -171,7 +171,7 @@
"color": "dark_gray",
"location": "sights",
"mod_targets": [ "rifle", "crossbow", "launcher" ],
"//install_time": "30 m",
"install_time": "30 m",
"sight_dispersion": 8,
"aim_speed": 2,
"min_skills": [ [ "weapon", 2 ], [ "gun", 4 ] ],
Expand Down Expand Up @@ -211,7 +211,7 @@
"color": "dark_gray",
"location": "sights",
"mod_targets": [ "rifle", "shotgun", "crossbow", "launcher" ],
"//install_time": "30 m",
"install_time": "30 m",
"consume_chance": 1000,
"consume_divisor": 505,
"sight_dispersion": 15,
Expand Down
8 changes: 4 additions & 4 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1858,10 +1858,10 @@ void Item_factory::load( islot_gunmod &slot, const JsonObject &jo, const std::st
assign( jo, "ammo_effects", slot.ammo_effects, strict );
assign( jo, "ups_charges_multiplier", slot.ups_charges_multiplier );
assign( jo, "weight_multiplier", slot.weight_multiplier );
if( jo.has_int( "time" ) ) {
slot.install_time = jo.get_int( "time" );
} else if( jo.has_string( "time" ) ) {
slot.install_time = to_moves<int>( read_from_json_string<time_duration>( *jo.get_raw( "time" ),
if( jo.has_int( "install_time" ) ) {
slot.install_time = jo.get_int( "install_time" );
} else if( jo.has_string( "install_time" ) ) {
slot.install_time = to_moves<int>( read_from_json_string<time_duration>( *jo.get_raw( "install_time" ),
time_duration::units ) );
}

Expand Down
5 changes: 2 additions & 3 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4008,7 +4008,7 @@ bool player::gunmod_remove( item &gun, item &mod )
}

gun.gun_set_mode( gun_mode_id( "DEFAULT" ) );
moves -= mod.type->gunmod->install_time / 2;
//TODO: add activity for removing gunmods

if( mod.typeId() == "brass_catcher" ) {
gun.casings_handle( [&]( item & e ) {
Expand Down Expand Up @@ -4153,8 +4153,7 @@ void player::gunmod_add( item &gun, item &mod )
actions[ prompt.ret ]();
}

const int turns = !has_trait( trait_DEBUG_HS ) ? mod.type->gunmod->install_time : 0;
const int moves = to_moves<int>( time_duration::from_turns( turns ) );
const int moves = !has_trait( trait_DEBUG_HS ) ? mod.type->gunmod->install_time : 0;

assign_activity( activity_id( "ACT_GUNMOD_ADD" ), moves, -1, get_item_position( &gun ), tool );
activity.values.push_back( get_item_position( &mod ) );
Expand Down

0 comments on commit b937983

Please sign in to comment.