From 418ce600c0e761384611c06d8d6d9dec81d21a9c Mon Sep 17 00:00:00 2001 From: snipercup <50166150+snipercup@users.noreply.github.com> Date: Fri, 24 Jan 2020 21:13:29 +0100 Subject: [PATCH] Installing gunmods takes time --- data/json/items/gunmod/conversions.json | 2 +- data/json/items/gunmod/loading_port.json | 2 +- data/json/items/gunmod/magazine.json | 2 +- data/json/items/gunmod/mechanism.json | 8 ++++---- data/json/items/gunmod/mount.json | 14 +++++++------- data/json/items/gunmod/muzzle.json | 4 ++-- data/json/items/gunmod/sights.json | 6 +++--- src/item_factory.cpp | 8 ++++---- src/player.cpp | 5 ++--- 9 files changed, 25 insertions(+), 26 deletions(-) diff --git a/data/json/items/gunmod/conversions.json b/data/json/items/gunmod/conversions.json index 6300d2b21c793..4ef3be2785cd0 100644 --- a/data/json/items/gunmod/conversions.json +++ b/data/json/items/gunmod/conversions.json @@ -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 ] ], diff --git a/data/json/items/gunmod/loading_port.json b/data/json/items/gunmod/loading_port.json index 29e14f69aa22b..5a606fbf042a8 100644 --- a/data/json/items/gunmod/loading_port.json +++ b/data/json/items/gunmod/loading_port.json @@ -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", diff --git a/data/json/items/gunmod/magazine.json b/data/json/items/gunmod/magazine.json index 0eb6854625a30..df499def0809c 100644 --- a/data/json/items/gunmod/magazine.json +++ b/data/json/items/gunmod/magazine.json @@ -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" ] diff --git a/data/json/items/gunmod/mechanism.json b/data/json/items/gunmod/mechanism.json index ec40ec110a2a9..449910e4f6fe4 100644 --- a/data/json/items/gunmod/mechanism.json +++ b/data/json/items/gunmod/mechanism.json @@ -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 ] ] }, @@ -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 ] ], @@ -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, @@ -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" ] } diff --git a/data/json/items/gunmod/mount.json b/data/json/items/gunmod/mount.json index 8dc42f867fdfe..a696327589556 100644 --- a/data/json/items/gunmod/mount.json +++ b/data/json/items/gunmod/mount.json @@ -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" ] @@ -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" ] @@ -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" ] @@ -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" ] @@ -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" ] @@ -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" ] @@ -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" ] diff --git a/data/json/items/gunmod/muzzle.json b/data/json/items/gunmod/muzzle.json index 1acbf9774ef76..3db8ed19d6d91 100644 --- a/data/json/items/gunmod/muzzle.json +++ b/data/json/items/gunmod/muzzle.json @@ -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, @@ -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, diff --git a/data/json/items/gunmod/sights.json b/data/json/items/gunmod/sights.json index 1f24265a969b8..409b4b5e66673 100644 --- a/data/json/items/gunmod/sights.json +++ b/data/json/items/gunmod/sights.json @@ -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 ] ], @@ -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 ] ], @@ -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, diff --git a/src/item_factory.cpp b/src/item_factory.cpp index 4bae7acfcfd00..8c4bf6c50ee8a 100644 --- a/src/item_factory.cpp +++ b/src/item_factory.cpp @@ -1859,10 +1859,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( read_from_json_string( *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( read_from_json_string( *jo.get_raw( "install_time" ), time_duration::units ) ); } diff --git a/src/player.cpp b/src/player.cpp index 281385fe2815b..1f972bc8d6ccd 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -4025,7 +4025,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 ) { @@ -4170,8 +4170,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( 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 ) );