From 4644cd2527d7a11bca2d0cd6e66628aee71d378f Mon Sep 17 00:00:00 2001 From: bombasticSlacks Date: Thu, 3 Mar 2022 12:35:29 -0400 Subject: [PATCH 1/7] Stocks, stock accessories, new C++ handling --- data/json/flags.json | 14 ++ .../itemgroups/Weapons_Mods_Ammo/gunmod.json | 2 +- data/json/items/classes/gun.json | 10 ++ data/json/items/gun/12mm.json | 1 + data/json/items/gun/20x66mm.json | 3 + data/json/items/gun/22.json | 3 + data/json/items/gun/223.json | 3 +- data/json/items/gun/3006.json | 3 + data/json/items/gun/308.json | 7 +- data/json/items/gun/40x46mm.json | 1 + data/json/items/gun/45.json | 1 + data/json/items/gun/50.json | 2 + data/json/items/gun/500.json | 1 + data/json/items/gun/545x39.json | 3 +- data/json/items/gun/57.json | 1 + data/json/items/gun/5x50.json | 1 + data/json/items/gun/700nx.json | 1 + data/json/items/gun/762.json | 4 + data/json/items/gun/762R.json | 3 + data/json/items/gun/762x25.json | 1 + data/json/items/gun/8x40mm.json | 15 +- data/json/items/gun/9mm.json | 11 +- data/json/items/gun/blunderbuss.json | 1 + data/json/items/gun/combination.json | 1 + data/json/items/gun/robofac_gun.json | 11 +- data/json/items/gun/ups.json | 2 + data/json/items/gunmod/mount.json | 4 +- data/json/items/gunmod/stock.json | 139 ++++++++++++++---- data/json/items/migration.json | 10 ++ .../mods/CRT_EXPANSION/items/crt_gunmods.json | 9 -- .../CRT_EXPANSION/items/crt_item_groups.json | 2 +- .../CRT_EXPANSION/scenarios/crt_classes.json | 2 +- src/character.cpp | 1 + src/flag.cpp | 2 + src/flag.h | 2 + src/item.cpp | 32 +++- 36 files changed, 250 insertions(+), 59 deletions(-) diff --git a/data/json/flags.json b/data/json/flags.json index e144e9c2f025c..7395a155a93b2 100644 --- a/data/json/flags.json +++ b/data/json/flags.json @@ -1136,8 +1136,21 @@ }, { "id": "COLLAPSIBLE_STOCK", + "//": "this is deprecated for the COLLAPSED_STOCK and FOLDED_STOCK, kept around for mod support", "type": "json_flag" }, + { + "id": "FOLDED_STOCK", + "//": "for weapons that stock folds to one side, no change in volume.", + "type": "json_flag", + "info": "This items stock is folded it will be hard to shoot with." + }, + { + "id": "COLLAPSED_STOCK", + "//": "for weapons that stock collapses into the body reducing volume as well.", + "type": "json_flag", + "info": "This items stock is collapsed it will be hard to shoot with." + }, { "id": "CONDUCTIVE", "type": "json_flag" @@ -1369,6 +1382,7 @@ }, { "id": "NEEDS_UNFOLD", + "//": "should not be used for folding mods, use a transforming mod instead", "type": "json_flag" }, { diff --git a/data/json/itemgroups/Weapons_Mods_Ammo/gunmod.json b/data/json/itemgroups/Weapons_Mods_Ammo/gunmod.json index 4328621ebb370..5b51ec2388008 100644 --- a/data/json/itemgroups/Weapons_Mods_Ammo/gunmod.json +++ b/data/json/itemgroups/Weapons_Mods_Ammo/gunmod.json @@ -39,7 +39,7 @@ [ "pistol_scope", 10 ], [ "pistol_stock", 10 ], [ "tail_hook_stock", 30 ], - [ "bthk_stock", 20 ], + [ "butt_hook", 20 ], [ "arredondo_chute", 20 ], [ "recoil_stock", 60 ], [ "shot_suppressor", 10 ], diff --git a/data/json/items/classes/gun.json b/data/json/items/classes/gun.json index de9ef34b0cf4d..e8d4337d78aa6 100644 --- a/data/json/items/classes/gun.json +++ b/data/json/items/classes/gun.json @@ -3,6 +3,8 @@ "abstract": "gun_base", "type": "GUN", "reload_noise_volume": 10, + "//": "this is the default handling for anything with a stock", + "handling": 20, "name": { "str": "base gun" }, "symbol": "(", "color": "light_gray", @@ -30,6 +32,8 @@ "name": { "str": "base launcher" }, "skill": "launcher", "modes": [ [ "DEFAULT", "single", 1, "NPC_AVOID" ] ], + "//": "default handling for anything without a recoil stock", + "handling": 10, "valid_mod_locations": [ [ "accessories", 2 ], [ "barrel", 1 ], [ "sights", 1 ], [ "sling", 1 ] ], "flags": [ "RELOAD_ONE", "RELOAD_EJECT", "NEVER_JAMS" ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt" ] @@ -41,6 +45,8 @@ "name": { "str": "base pistol" }, "skill": "pistol", "sight_dispersion": 60, + "//": "default handling for anything without a stock", + "handling": 10, "valid_mod_locations": [ [ "accessories", 2 ], [ "barrel", 1 ], @@ -155,6 +161,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ] }, @@ -177,6 +184,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ] }, @@ -213,6 +221,7 @@ [ "sights mount", 1 ], [ "sling", 1 ], [ "stock mount", 1 ], + [ "stock accessory", 2], [ "underbarrel mount", 1 ] ] }, @@ -244,6 +253,7 @@ [ "sights mount", 1 ], [ "sling", 1 ], [ "stock mount", 1 ], + [ "stock accessory", 2], [ "underbarrel mount", 1 ] ] }, diff --git a/data/json/items/gun/12mm.json b/data/json/items/gun/12mm.json index 0073c032170cf..14287aa361e61 100644 --- a/data/json/items/gun/12mm.json +++ b/data/json/items/gun/12mm.json @@ -28,6 +28,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "flags": [ "NEVER_JAMS" ], diff --git a/data/json/items/gun/20x66mm.json b/data/json/items/gun/20x66mm.json index e2cd917d030da..b5bb3206e5771 100644 --- a/data/json/items/gun/20x66mm.json +++ b/data/json/items/gun/20x66mm.json @@ -34,6 +34,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "flags": [ "RELOAD_ONE", "WATERPROOF_GUN", "NEVER_JAMS", "PUMP_ACTION" ], @@ -70,6 +71,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "flags": [ "WATERPROOF_GUN", "NEVER_JAMS" ], @@ -106,6 +108,7 @@ [ "rail", 1 ], [ "sights", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel mount", 1 ] ], "flags": [ "WATERPROOF_GUN", "NEVER_JAMS" ], diff --git a/data/json/items/gun/22.json b/data/json/items/gun/22.json index 664d0b0b8309b..db1476050ee29 100644 --- a/data/json/items/gun/22.json +++ b/data/json/items/gun/22.json @@ -36,6 +36,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], @@ -80,6 +81,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt" ], @@ -208,6 +210,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], diff --git a/data/json/items/gun/223.json b/data/json/items/gun/223.json index 753adc1b276b3..c8706a0394d0c 100644 --- a/data/json/items/gun/223.json +++ b/data/json/items/gun/223.json @@ -314,7 +314,8 @@ [ "rail", 1 ], [ "sights", 1 ], [ "sling", 1 ], - [ "stock", 1 ] + [ "stock", 1 ], + [ "stock accessory", 2] ], "pocket_data": [ { diff --git a/data/json/items/gun/3006.json b/data/json/items/gun/3006.json index a4c5ecf8e66f5..b9c816cda49f0 100644 --- a/data/json/items/gun/3006.json +++ b/data/json/items/gun/3006.json @@ -35,6 +35,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt" ], @@ -75,6 +76,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], @@ -158,6 +160,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], diff --git a/data/json/items/gun/308.json b/data/json/items/gun/308.json index fc6d96469d1fe..2432a3b71d20f 100644 --- a/data/json/items/gun/308.json +++ b/data/json/items/gun/308.json @@ -106,6 +106,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ] }, @@ -184,7 +185,8 @@ [ "rail", 1 ], [ "sights", 1 ], [ "sling", 1 ], - [ "stock", 1 ] + [ "stock", 1 ], + [ "stock accessory", 2] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "belt308" ] } ] }, @@ -224,7 +226,8 @@ [ "rail", 1 ], [ "sights", 1 ], [ "sling", 1 ], - [ "stock", 1 ] + [ "stock", 1 ], + [ "stock accessory", 2] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "belt308" ] } ] }, diff --git a/data/json/items/gun/40x46mm.json b/data/json/items/gun/40x46mm.json index 6541a91b85be8..06b5e057f3e47 100644 --- a/data/json/items/gun/40x46mm.json +++ b/data/json/items/gun/40x46mm.json @@ -153,6 +153,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "flags": [ "RELOAD_ONE", "WATERPROOF_GUN", "NEVER_JAMS" ], diff --git a/data/json/items/gun/45.json b/data/json/items/gun/45.json index 1b468b651e287..3c56691db6f98 100644 --- a/data/json/items/gun/45.json +++ b/data/json/items/gun/45.json @@ -353,6 +353,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], diff --git a/data/json/items/gun/50.json b/data/json/items/gun/50.json index e0c02ddb82f1b..9bbc16a0c8ea4 100644 --- a/data/json/items/gun/50.json +++ b/data/json/items/gun/50.json @@ -83,6 +83,7 @@ [ "muzzle", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "grip", 1 ], [ "rail mount", 1 ], [ "underbarrel mount", 1 ] @@ -187,6 +188,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "default_mods": [ "bipod", "rifle_scope", "muzzle_brake" ], diff --git a/data/json/items/gun/500.json b/data/json/items/gun/500.json index 31c43e76e652d..4a9c8ea8d20d1 100644 --- a/data/json/items/gun/500.json +++ b/data/json/items/gun/500.json @@ -32,6 +32,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "rail mount", 1 ], [ "underbarrel mount", 1 ] ], diff --git a/data/json/items/gun/545x39.json b/data/json/items/gun/545x39.json index f3a94a5beb644..134eea2960c12 100644 --- a/data/json/items/gun/545x39.json +++ b/data/json/items/gun/545x39.json @@ -34,6 +34,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "flags": [ "NEVER_JAMS" ], @@ -62,7 +63,7 @@ "min_cycle_recoil": 1260, "modes": [ [ "DEFAULT", "semi-auto", 1 ], [ "BURST", "burst", 2 ], [ "AUTO", "auto", 4 ] ], "barrel_volume": "250 ml", - "default_mods": [ "bars" ], + "default_mods": [ "bars", "wire_stock" ], "valid_mod_locations": [ [ "accessories", 4 ], [ "barrel", 1 ], diff --git a/data/json/items/gun/57.json b/data/json/items/gun/57.json index 90ae6e21097b2..4112819de8cf7 100644 --- a/data/json/items/gun/57.json +++ b/data/json/items/gun/57.json @@ -73,6 +73,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], diff --git a/data/json/items/gun/5x50.json b/data/json/items/gun/5x50.json index a2f8a84a3f33f..6f94012dc6a03 100644 --- a/data/json/items/gun/5x50.json +++ b/data/json/items/gun/5x50.json @@ -35,6 +35,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "flags": [ "WATERPROOF_GUN", "NEVER_JAMS" ], diff --git a/data/json/items/gun/700nx.json b/data/json/items/gun/700nx.json index e87e97cbd7ce4..120af7b0933bc 100644 --- a/data/json/items/gun/700nx.json +++ b/data/json/items/gun/700nx.json @@ -31,6 +31,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "flags": [ "NEVER_JAMS", "RELOAD_EJECT" ], diff --git a/data/json/items/gun/762.json b/data/json/items/gun/762.json index 57d229a0d5ad4..39b564baeb362 100644 --- a/data/json/items/gun/762.json +++ b/data/json/items/gun/762.json @@ -32,6 +32,7 @@ [ "sights mount", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel mount", 1 ] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "akmag30", "akmag10", "akmag20", "akmag40", "akdrum75" ] } ] @@ -72,6 +73,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "akmag30", "akmag10", "akmag20", "akmag40" ] } ] @@ -113,6 +115,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "flags": [ "RELOAD_ONE", "NEVER_JAMS" ], @@ -158,6 +161,7 @@ [ "sights mount", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel mount", 1 ] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "akmag30", "akmag10", "akmag20", "akmag40", "akdrum75" ] } ] diff --git a/data/json/items/gun/762R.json b/data/json/items/gun/762R.json index 8e846dd2fe5e6..fca90cabe7b60 100644 --- a/data/json/items/gun/762R.json +++ b/data/json/items/gun/762R.json @@ -40,6 +40,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "relative": { "price": 10000 } @@ -78,6 +79,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock mount", 1 ], + [ "stock accessory", 2], [ "underbarrel mount", 1 ] ], "flags": [ "RELOAD_ONE" ], @@ -108,6 +110,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ] ], "relative": { "price": 10000 } diff --git a/data/json/items/gun/762x25.json b/data/json/items/gun/762x25.json index fc6417633633d..abb9a4a761931 100644 --- a/data/json/items/gun/762x25.json +++ b/data/json/items/gun/762x25.json @@ -35,6 +35,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 2], [ "underbarrel", 1 ], [ "rail mount", 1 ] ], diff --git a/data/json/items/gun/8x40mm.json b/data/json/items/gun/8x40mm.json index d4b9106b58e5e..4331d1027daea 100644 --- a/data/json/items/gun/8x40mm.json +++ b/data/json/items/gun/8x40mm.json @@ -105,6 +105,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 1 ], [ "underbarrel", 1 ] ], "flags": [ "WATERPROOF_GUN", "NEVER_JAMS" ], @@ -135,7 +136,16 @@ "modes": [ [ "DEFAULT", "semi-auto", 1 ], [ "AUTO", "auto", 6 ] ], "reload": 400, "barrel_volume": "1500 ml", - "valid_mod_locations": [ [ "barrel", 1 ], [ "grip", 1 ], [ "mechanism", 4 ], [ "rail", 1 ], [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ] ], + "valid_mod_locations": [ + [ "barrel", 1 ], + [ "grip", 1 ], + [ "mechanism", 4 ], + [ "rail", 1 ], + [ "sights", 1 ], + [ "sling", 1 ], + [ "stock", 1 ], + [ "stock accessory", 1 ] + ], "flags": [ "WATERPROOF_GUN", "NEVER_JAMS" ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "8x40_500_mag", "8x40_250_mag" ] } ] }, @@ -170,6 +180,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 1 ], [ "underbarrel", 1 ] ], "flags": [ "WATERPROOF_GUN", "NEVER_JAMS" ], @@ -209,6 +220,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 1 ], [ "underbarrel", 1 ] ], "flags": [ "WATERPROOF_GUN", "NEVER_JAMS" ], @@ -245,6 +257,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 1 ], [ "underbarrel", 1 ] ], "magazines": [ [ "8x40mm", [ "8x40_100_mag", "8x40_50_mag", "8x40_250_mag" ] ] ], diff --git a/data/json/items/gun/9mm.json b/data/json/items/gun/9mm.json index f9ac4051f417e..2e31ee0fd9e32 100644 --- a/data/json/items/gun/9mm.json +++ b/data/json/items/gun/9mm.json @@ -109,6 +109,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 1 ], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], @@ -190,7 +191,8 @@ [ "sights mount", 1 ], [ "underbarrel mount", 1 ], [ "sling", 1 ], - [ "stock", 1 ] + [ "stock", 1 ], + [ "stock accessory", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], "pocket_data": [ @@ -270,7 +272,8 @@ [ "sights", 1 ], [ "underbarrel mount", 1 ], [ "sling", 1 ], - [ "stock", 1 ] + [ "stock", 1 ], + [ "stock accessory", 1 ] ], "ranged_damage": { "damage_type": "bullet", "amount": 0 } }, @@ -737,6 +740,7 @@ [ "muzzle", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 1 ], [ "grip mount", 1 ], [ "rail mount", 1 ], [ "sights mount", 1 ], @@ -1275,7 +1279,8 @@ [ "rail mount", 3 ], [ "underbarrel mount", 1 ], [ "sling", 1 ], - [ "stock", 1 ] + [ "stock", 1 ], + [ "stock accessory", 1 ] ], "default_mods": [ "folding_stock", "red_dot_sight" ], "pocket_data": [ diff --git a/data/json/items/gun/blunderbuss.json b/data/json/items/gun/blunderbuss.json index e2d97f2b27195..e06fe7f9a50d4 100644 --- a/data/json/items/gun/blunderbuss.json +++ b/data/json/items/gun/blunderbuss.json @@ -28,6 +28,7 @@ "valid_mod_locations": [ [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 1 ], [ "grip mount", 1 ], [ "rail mount", 1 ], [ "sights mount", 1 ], diff --git a/data/json/items/gun/combination.json b/data/json/items/gun/combination.json index e9c0e86c0ac7c..0359a5aec63ef 100644 --- a/data/json/items/gun/combination.json +++ b/data/json/items/gun/combination.json @@ -36,6 +36,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 1 ], [ "underbarrel", 1 ], [ "rail mount", 1 ] ], diff --git a/data/json/items/gun/robofac_gun.json b/data/json/items/gun/robofac_gun.json index b8fae5b326179..97d35adbfabe6 100644 --- a/data/json/items/gun/robofac_gun.json +++ b/data/json/items/gun/robofac_gun.json @@ -22,9 +22,9 @@ "dispersion": 150, "durability": 9, "min_cycle_recoil": 1350, - "default_mods": [ "robofac_handguard", "hybrid_sight_4x", "holo_sight", "robofac_laser_sight" ], + "default_mods": [ "robofac_handguard", "hybrid_sight_4x", "holo_sight", "robofac_laser_sight", "robofac_stock" ], "//": "Forward ejection port would require a different brass catcher design", - "valid_mod_locations": [ [ "accessories", 2 ], [ "sling", 1 ], [ "stock", 1 ], [ "grip", 1 ], [ "bore", 1 ], [ "sights", 1 ] ], + "valid_mod_locations": [ [ "accessories", 2 ], [ "sling", 1 ], [ "grip", 1 ], [ "bore", 1 ], [ "sights", 1 ], [ "stock", 1 ], [ "stock accessory", 1 ] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "robofac40", "robofac20", "robofac10", "robofac60" ] } ] }, { @@ -155,6 +155,13 @@ "name": { "str": "integrated front grip" }, "flags": [ "PUMP_RAIL_COMPATIBLE", "IRREMOVABLE" ] }, + { + "id": "robofac_stock", + "type": "GUNMOD", + "copy-from": "adjustable_stock", + "name": { "str": "bullpup adjustable stock" }, + "flags": [ "IRREMOVABLE" ] + }, { "id": "robofac40", "type": "MAGAZINE", diff --git a/data/json/items/gun/ups.json b/data/json/items/gun/ups.json index bc0fee24ef6e8..d30e36b74e952 100644 --- a/data/json/items/gun/ups.json +++ b/data/json/items/gun/ups.json @@ -33,6 +33,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 1 ], [ "underbarrel", 1 ] ], "ammo_effects": [ "DRAW_LASER_BEAM", "EMP" ], @@ -137,6 +138,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], + [ "stock accessory", 1 ], [ "underbarrel", 1 ] ], "ammo_effects": [ "LASER", "INCENDIARY" ], diff --git a/data/json/items/gunmod/mount.json b/data/json/items/gunmod/mount.json index 12a7655816121..1b3ccc39bcd76 100644 --- a/data/json/items/gunmod/mount.json +++ b/data/json/items/gunmod/mount.json @@ -99,7 +99,7 @@ "id": "stock_mount", "type": "GUNMOD", "name": { "str": "replaceable stock kit" }, - "description": "This is a kit consisting of various steel parts; when installed, it would remove the weapon's original fixed stock, install a new stock mount on its place, modify original stock to fit it and then reattach it to the gun, or simply attach a stock mount if gun had no stock to start with. This allows easy installation of any kind of more advanced stocks.", + "description": "This is a kit consisting of various steel parts; when installed, it would remove the weapon's original fixed stock, install a new stock mount on its place and modify original stock to fit it and then reattach it to the gun. This allows easy installation of any kind of more advanced stocks.", "weight": "80 g", "volume": "50 ml", "integral_volume": "0 ml", @@ -109,7 +109,7 @@ "symbol": ":", "color": "light_gray", "location": "stock mount", - "mod_targets": [ "smg", "rifle", "pistol", "shotgun", "crossbow", "launcher" ], + "mod_targets": [ "smg", "rifle", "shotgun", "crossbow", "pistol" ], "install_time": "20 m", "min_skills": [ [ "gun", 5 ] ], "add_mod": [ [ "stock", 1 ] ], diff --git a/data/json/items/gunmod/stock.json b/data/json/items/gunmod/stock.json index d4fce9bf161d7..642a93c63a03b 100644 --- a/data/json/items/gunmod/stock.json +++ b/data/json/items/gunmod/stock.json @@ -25,7 +25,7 @@ "id": "folding_stock", "type": "GUNMOD", "name": { "str": "folding stock" }, - "description": "A folding stock which reduces volume but needs unfolding before use. Increases the time needed to wield the weapon.", + "description": "A folding stock which reduces length when folded. Currently unfolded and ready to shoot.", "weight": "200 g", "volume": "500 ml", "integral_volume": "0 ml", @@ -38,14 +38,84 @@ "color": "dark_gray", "location": "stock", "mod_targets": [ "smg", "rifle", "shotgun", "launcher" ], - "min_skills": [ [ "weapon", 3 ] ], - "flags": [ "NEEDS_UNFOLD", "COLLAPSIBLE_STOCK" ] + "use_action": { + "type": "transform", + "msg": "You fold the stock for transport.", + "menu_text": "Fold", + "target": "folding_stock_folded", + "moves": 120 + }, + "min_skills": [ [ "weapon", 3 ] ] + }, + { + "id": "folding_stock_folded", + "type": "GUNMOD", + "name": { "str": "folding stock (folded)" }, + "description": "A folding stock which reduces length. Currently folded making shooting this gun difficult.", + "copy-from": "folding_stock", + "use_action": { + "type": "transform", + "msg": "You unfold the stock for combat.", + "menu_text": "Unfold", + "target": "folding_stock", + "moves": 120 + }, + "//": "10 is the modifier that stocked weapons normally get", + "handling_modifier": -10, + "flags": [ "FOLDED_STOCK" ] + }, + { + "id": "high_end_folding_stock", + "type": "GUNMOD", + "name": { "str": "modular folding stock" }, + "description": "A multi position, high-end, folding stock which reduces length when folded. Currently unfolded and ready to shoot.", + "weight": "200 g", + "volume": "500 ml", + "integral_volume": "0 ml", + "integral_weight": "0 g", + "price": 42000, + "price_postapoc": 250, + "install_time": "5 m", + "material": [ "plastic", "steel" ], + "symbol": ":", + "color": "dark_gray", + "location": "stock", + "mod_targets": [ "smg", "rifle", "shotgun", "launcher" ], + "use_action": { + "type": "transform", + "msg": "You fold the stock for transport.", + "menu_text": "Fold", + "target": "high_end_folding_stock_folded", + "moves": 120 + }, + "//": "benefits of a recoil stock and adjustable stock", + "dispersion_modifier": -1, + "handling_modifier": 5, + "min_skills": [ [ "weapon", 3 ] ] + }, + { + "id": "high_end_folding_stock_folded", + "type": "GUNMOD", + "name": { "str": "modular folding stock (folded)" }, + "description": "A multi position, high-end, folding stock which reduces length when folded. Currently folded making shooting this gun hard.", + "copy-from": "high_end_folding_stock", + "use_action": { + "type": "transform", + "msg": "You unfold the stock for combat.", + "menu_text": "Unfold", + "target": "high_end_folding_stock", + "moves": 120 + }, + "//": "10 is the modifier that stocked weapons normally get", + "dispersion_modifier": 0, + "handling_modifier": -10, + "flags": [ "FOLDED_STOCK" ] }, { "id": "wire_stock", "type": "GUNMOD", - "name": { "str": "folding wire stock" }, - "description": "A folding wire stock which folds up very compactly but needs unfolding before use. It's somewhat wobbly but is better than nothing at all. Increases the time needed to wield the weapon.", + "name": { "str": "collapsing wire stock" }, + "description": "A collapsing wire stock which collapses into the body of the gun very compactly reducing length and volume.", "weight": "170 g", "volume": "250 ml", "integral_volume": "0 ml", @@ -59,8 +129,32 @@ "location": "stock", "handling_modifier": 2, "mod_targets": [ "pistol", "smg", "rifle", "shotgun" ], + "use_action": { + "type": "transform", + "msg": "You push the stock in for storage.", + "menu_text": "Fold", + "target": "wire_stock_folded", + "moves": 120 + }, "min_skills": [ [ "weapon", 3 ] ], - "flags": [ "NEEDS_UNFOLD" ] + "flags": [ "IRREMOVABLE" ] + }, + { + "id": "wire_stock_folded", + "type": "GUNMOD", + "name": { "str": "collapsing wire stock (collapsed)" }, + "description": "A collapsing wire stock which collapses into the body of the gun very compactly reducing length and volume. Currently collapsed making shooting difficult.", + "copy-from": "wire_stock", + "use_action": { + "type": "transform", + "msg": "You pull the stock out for combat.", + "menu_text": "Unfold", + "target": "wire_stock", + "moves": 120 + }, + "//": "10 is the modifier that stocked weapons normally get", + "handling_modifier": -10, + "flags": [ "COLLAPSED_STOCK", "IRREMOVABLE" ] }, { "id": "pistol_stock", @@ -69,6 +163,9 @@ "description": "An add-on stock for handguns considerably improving control of recoil.", "weight": "350 g", "volume": "500 ml", + "integral_longest_side": "30 cm", + "integral_volume": "500 ml", + "integral_weight": "350 g", "price": 38000, "price_postapoc": 500, "install_time": "5 m", @@ -110,6 +207,7 @@ "weight": "300 g", "volume": "250 ml", "integral_volume": "0 ml", + "integral_weight": "300 g", "price": 4500, "price_postapoc": 500, "install_time": "3 m", @@ -118,7 +216,7 @@ "material": [ "plastic", "steel" ], "symbol": ":", "color": "dark_gray", - "location": "stock", + "location": "stock accessory", "mod_targets": [ "rifle" ], "dispersion_modifier": -1, "handling_modifier": 2, @@ -131,38 +229,20 @@ "description": "An attachment to the butt of the gun that is put under the armpit allowing for greater stability.", "weight": "100 g", "volume": "100 ml", + "integral_longest_side": "4 cm", + "integral_volume": "100 ml", + "integral_weight": "100 g", "price": 4750, "price_postapoc": 50, "material": [ "aluminum" ], "symbol": ":", "color": "dark_gray", - "location": "stock", + "location": "stock accessory", "mod_targets": [ "smg", "rifle", "shotgun", "launcher", "crossbow" ], "install_time": "10 m", "dispersion_modifier": -15, "min_skills": [ [ "weapon", 1 ] ] }, - { - "id": "bthk_stock", - "type": "GUNMOD", - "name": { "str": "butt hook stock" }, - "description": "A replacement stock that partially encloses arm allowing for greater stability. Good fit and padding also helps with recoil control.", - "weight": "300 g", - "volume": "300 ml", - "integral_volume": "0 L", - "integral_weight": "0 g", - "price": 8000, - "price_postapoc": 300, - "material": [ "plastic", "steel" ], - "symbol": ":", - "color": "dark_gray", - "location": "stock", - "mod_targets": [ "smg", "rifle", "shotgun", "launcher", "crossbow" ], - "install_time": "5 m", - "dispersion_modifier": -20, - "handling_modifier": 2, - "min_skills": [ [ "weapon", 2 ] ] - }, { "id": "tail_hook_stock", "type": "GUNMOD", @@ -183,6 +263,7 @@ "dispersion_modifier": -20, "handling_modifier": 4, "min_skills": [ [ "weapon", 3 ] ], + "//2": "this seems to be for hooking the gun on your arm not actually folding it up for storage", "flags": [ "NEEDS_UNFOLD" ] } ] diff --git a/data/json/items/migration.json b/data/json/items/migration.json index 183f8e1f0c888..f4456d38dd352 100644 --- a/data/json/items/migration.json +++ b/data/json/items/migration.json @@ -1607,5 +1607,15 @@ "id": "hickory_nut_unshelled", "type": "MIGRATION", "replace": "hickory_nut_shelled" + }, + { + "id": "bthk_stock", + "type": "MIGRATION", + "replace": "adjustable_stock" + }, + { + "id": "folding_bthk_stock", + "type": "MIGRATION", + "replace": "high_end_folding_stock" } ] diff --git a/data/mods/CRT_EXPANSION/items/crt_gunmods.json b/data/mods/CRT_EXPANSION/items/crt_gunmods.json index 39e12f6edf40f..8a379a396a1c7 100644 --- a/data/mods/CRT_EXPANSION/items/crt_gunmods.json +++ b/data/mods/CRT_EXPANSION/items/crt_gunmods.json @@ -38,15 +38,6 @@ "flags": [ "IRREMOVABLE", "RELOAD_ONE", "RELOAD_EJECT" ], "pocket_data": [ { "pocket_type": "MAGAZINE", "ammo_restriction": { "shot": 1 } } ] }, - { - "id": "folding_bthk_stock", - "type": "GUNMOD", - "name": "folding butt hook stock", - "copy-from": "bthk_stock", - "looks_like": "bthk_stock", - "description": "A replacement folding stock that partially encloses arm allowing for greater stability. Good fit and padding also helps with recoil control.", - "extend": { "flags": [ "NEEDS_UNFOLD", "COLLAPSIBLE_STOCK" ] } - }, { "id": "beam_difractor", "copy-from": "beam_scatterer", diff --git a/data/mods/CRT_EXPANSION/items/crt_item_groups.json b/data/mods/CRT_EXPANSION/items/crt_item_groups.json index 5357015798aaa..53097dfb88182 100644 --- a/data/mods/CRT_EXPANSION/items/crt_item_groups.json +++ b/data/mods/CRT_EXPANSION/items/crt_item_groups.json @@ -3,7 +3,7 @@ "type": "item_group", "id": "gunmod_rare", "//": "Common gunmods typically owned by citizens and found in many locations.", - "items": [ [ "folding_bthk_stock", 20 ] ] + "items": [ [ "high_end_folding_stock", 20 ] ] }, { "type": "item_group", diff --git a/data/mods/CRT_EXPANSION/scenarios/crt_classes.json b/data/mods/CRT_EXPANSION/scenarios/crt_classes.json index b514160a8927c..03072f462a960 100644 --- a/data/mods/CRT_EXPANSION/scenarios/crt_classes.json +++ b/data/mods/CRT_EXPANSION/scenarios/crt_classes.json @@ -457,7 +457,7 @@ "badge_marshal", "knife_swissarmy", "beam_difractor", - "bthk_stock", + "butt_hook", "flare_gmod", "crt_etool" ], diff --git a/src/character.cpp b/src/character.cpp index 0118bb9934539..d86d74e83bf88 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -976,6 +976,7 @@ double Character::aim_factor_from_volume( const item &gun ) const { skill_id gun_skill = gun.gun_skill(); double wielded_volume = gun.volume() / 1_ml; + // this is only here for mod support if( gun.has_flag( flag_COLLAPSIBLE_STOCK ) ) { // use the unfolded volume wielded_volume += gun.collapsed_volume_delta() / 1_ml; diff --git a/src/flag.cpp b/src/flag.cpp index ea3620a832835..ec42ef77cc87d 100644 --- a/src/flag.cpp +++ b/src/flag.cpp @@ -63,6 +63,7 @@ const flag_id flag_CLIMATE_CONTROL( "CLIMATE_CONTROL" ); const flag_id flag_COLD( "COLD" ); const flag_id flag_COLD_IMMUNE( "COLD_IMMUNE" ); const flag_id flag_COLLAPSE_CONTENTS( "COLLAPSE_CONTENTS" ); +const flag_id flag_COLLAPSED_STOCK( "COLLAPSED_STOCK" ); const flag_id flag_COLLAPSIBLE_STOCK( "COLLAPSIBLE_STOCK" ); const flag_id flag_COLLAR( "COLLAR" ); const flag_id flag_COMBAT_TOGGLEABLE( "COMBAT_TOGGLEABLE" ); @@ -125,6 +126,7 @@ const flag_id flag_FIX_NEARSIGHT( "FIX_NEARSIGHT" ); const flag_id flag_FLAMING( "FLAMING" ); const flag_id flag_FLASH_PROTECTION( "FLASH_PROTECTION" ); const flag_id flag_FLOTATION( "FLOTATION" ); +const flag_id flag_FOLDED_STOCK( "FOLDED_STOCK" ); const flag_id flag_FORAGE_HALLU( "FORAGE_HALLU" ); const flag_id flag_FORAGE_POISON( "FORAGE_POISON" ); const flag_id flag_FRAGILE( "FRAGILE" ); diff --git a/src/flag.h b/src/flag.h index 4b98711184e85..735022efa40bb 100644 --- a/src/flag.h +++ b/src/flag.h @@ -73,6 +73,7 @@ extern const flag_id flag_CLIMATE_CONTROL; extern const flag_id flag_COLD; extern const flag_id flag_COLD_IMMUNE; extern const flag_id flag_COLLAPSE_CONTENTS; +extern const flag_id flag_COLLAPSED_STOCK; extern const flag_id flag_COLLAPSIBLE_STOCK; extern const flag_id flag_COLLAR; extern const flag_id flag_COMBAT_TOGGLEABLE; @@ -135,6 +136,7 @@ extern const flag_id flag_FIX_NEARSIGHT; extern const flag_id flag_FLAMING; extern const flag_id flag_FLASH_PROTECTION; extern const flag_id flag_FLOTATION; +extern const flag_id flag_FOLDED_STOCK; extern const flag_id flag_FORAGE_HALLU; extern const flag_id flag_FORAGE_POISON; extern const flag_id flag_FRAGILE; diff --git a/src/item.cpp b/src/item.cpp index 2f6f8638a647b..e26e6a9badd6b 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -5989,6 +5989,9 @@ std::string item::tname( unsigned int quantity, bool with_prefix, unsigned int t if( is_filthy() ) { tagtext += _( " (filthy)" ); } + if( is_gun() && ( has_flag( flag_COLLAPSED_STOCK ) || has_flag( flag_FOLDED_STOCK ) ) ) { + tagtext += _( " (folded)" ); + } if( is_broken() ) { tagtext += _( " (broken)" ); } @@ -6437,13 +6440,29 @@ units::length item::length() const // only the longest thing sticking off the gun matters for length adjustment // TODO: Differentiate from back end mods like stocks vs front end like bayonets and muzzle devices units::length max_length = 0_mm; + units::length stock_length = 0_mm; + units::length stock_accessory_length = 0_mm; for( const item *mod : mods ) { - units::length l = mod->integral_length(); - if( l > max_length ) { - max_length = l; + // stocks and accessories for stocks are added with whatever the longest thing on the front is + if( mod->type->gunmod->location.str() == "stock" ) { + stock_length = mod->integral_length(); + if( has_flag( flag_COLLAPSED_STOCK ) || has_flag( flag_FOLDED_STOCK ) ) { + // stock is folded so need to reduce length + + // folded stock length is estimated at about 20 cm, LOP for guns should be about + // 13.5 inches and a folding stock folds past the trigger and isn't perfectly efficient + stock_length = stock_length - 20_cm; + } + } else if( mod->type->gunmod->location.str() == "stock accessory" ) { + stock_accessory_length = mod->integral_length(); + } else { + units::length l = mod->integral_length(); + if( l > max_length ) { + max_length = l; + } } } - return length_adjusted + max_length; + return length_adjusted + max_length + stock_length + stock_accessory_length; } units::length max = is_soft() ? 0_mm : type->longest_side; @@ -6460,8 +6479,9 @@ units::volume item::collapsed_volume_delta() const { units::volume delta_volume = 0_ml; - // TODO: implement stock_length property for guns - if( is_gun() && has_flag( flag_COLLAPSIBLE_STOCK ) ) { + // COLLAPSIBLE_STOCK is the legacy version of this just here for mod support + // TODO Remove at some point + if( is_gun() && ( has_flag( flag_COLLAPSIBLE_STOCK ) || has_flag( flag_COLLAPSED_STOCK ) ) ) { // consider only the base size of the gun (without mods) int tmpvol = get_var( "volume", ( type->volume - type->gun->barrel_volume ) / units::legacy_volume_factor ); From 7a3c1e9f123162d78002b0733377f139c36092b6 Mon Sep 17 00:00:00 2001 From: bombasticSlacks Date: Thu, 3 Mar 2022 12:55:04 -0400 Subject: [PATCH 2/7] lint --- data/json/items/gun/robofac_gun.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/data/json/items/gun/robofac_gun.json b/data/json/items/gun/robofac_gun.json index 97d35adbfabe6..e14f97db7d35b 100644 --- a/data/json/items/gun/robofac_gun.json +++ b/data/json/items/gun/robofac_gun.json @@ -24,7 +24,15 @@ "min_cycle_recoil": 1350, "default_mods": [ "robofac_handguard", "hybrid_sight_4x", "holo_sight", "robofac_laser_sight", "robofac_stock" ], "//": "Forward ejection port would require a different brass catcher design", - "valid_mod_locations": [ [ "accessories", 2 ], [ "sling", 1 ], [ "grip", 1 ], [ "bore", 1 ], [ "sights", 1 ], [ "stock", 1 ], [ "stock accessory", 1 ] ], + "valid_mod_locations": [ + [ "accessories", 2 ], + [ "sling", 1 ], + [ "grip", 1 ], + [ "bore", 1 ], + [ "sights", 1 ], + [ "stock", 1 ], + [ "stock accessory", 1 ] + ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "robofac40", "robofac20", "robofac10", "robofac60" ] } ] }, { From 5b90cb6abcde5ccb04a422d64b499e38c9193ba2 Mon Sep 17 00:00:00 2001 From: bombasticSlacks Date: Thu, 3 Mar 2022 12:55:42 -0400 Subject: [PATCH 3/7] revert changes to stock kit --- data/json/items/gunmod/mount.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/items/gunmod/mount.json b/data/json/items/gunmod/mount.json index 1b3ccc39bcd76..c7157382a5f69 100644 --- a/data/json/items/gunmod/mount.json +++ b/data/json/items/gunmod/mount.json @@ -99,7 +99,7 @@ "id": "stock_mount", "type": "GUNMOD", "name": { "str": "replaceable stock kit" }, - "description": "This is a kit consisting of various steel parts; when installed, it would remove the weapon's original fixed stock, install a new stock mount on its place and modify original stock to fit it and then reattach it to the gun. This allows easy installation of any kind of more advanced stocks.", + "description": "This is a kit consisting of various steel parts; when installed, it would remove the weapon's original fixed stock, install a new stock mount on its place, modify original stock to fit it and then reattach it to the gun, or simply attach a stock mount if gun had no stock to start with. This allows easy installation of any kind of more advanced stocks.", "weight": "80 g", "volume": "50 ml", "integral_volume": "0 ml", From ca2c105bec2544eee022b5899757fb5a52b274f2 Mon Sep 17 00:00:00 2001 From: bombasticSlacks Date: Thu, 3 Mar 2022 12:56:10 -0400 Subject: [PATCH 4/7] more revert --- data/json/items/gunmod/mount.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/items/gunmod/mount.json b/data/json/items/gunmod/mount.json index c7157382a5f69..37d2afe3bec7c 100644 --- a/data/json/items/gunmod/mount.json +++ b/data/json/items/gunmod/mount.json @@ -109,7 +109,7 @@ "symbol": ":", "color": "light_gray", "location": "stock mount", - "mod_targets": [ "smg", "rifle", "shotgun", "crossbow", "pistol" ], + "mod_targets": [ "smg", "rifle", "pistol", "shotgun", "crossbow", "launcher" ], "install_time": "20 m", "min_skills": [ [ "gun", 5 ] ], "add_mod": [ [ "stock", 1 ] ], From 616e2bbc979f35de87488eff347912a7e822bd76 Mon Sep 17 00:00:00 2001 From: bombasticSlacks Date: Thu, 3 Mar 2022 13:21:12 -0400 Subject: [PATCH 5/7] linting --- data/json/items/classes/gun.json | 8 ++++---- data/json/items/gun/12mm.json | 2 +- data/json/items/gun/20x66mm.json | 6 +++--- data/json/items/gun/22.json | 6 +++--- data/json/items/gun/223.json | 2 +- data/json/items/gun/3006.json | 6 +++--- data/json/items/gun/308.json | 6 +++--- data/json/items/gun/40x46mm.json | 2 +- data/json/items/gun/45.json | 2 +- data/json/items/gun/50.json | 4 ++-- data/json/items/gun/500.json | 2 +- data/json/items/gun/545x39.json | 2 +- data/json/items/gun/57.json | 2 +- data/json/items/gun/5x50.json | 2 +- data/json/items/gun/700nx.json | 2 +- data/json/items/gun/762.json | 8 ++++---- data/json/items/gun/762R.json | 6 +++--- data/json/items/gun/762x25.json | 2 +- src/iuse_actor.cpp | 2 +- 19 files changed, 36 insertions(+), 36 deletions(-) diff --git a/data/json/items/classes/gun.json b/data/json/items/classes/gun.json index e8d4337d78aa6..40b7edad741a5 100644 --- a/data/json/items/classes/gun.json +++ b/data/json/items/classes/gun.json @@ -161,7 +161,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ] }, @@ -184,7 +184,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ] }, @@ -221,7 +221,7 @@ [ "sights mount", 1 ], [ "sling", 1 ], [ "stock mount", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel mount", 1 ] ] }, @@ -253,7 +253,7 @@ [ "sights mount", 1 ], [ "sling", 1 ], [ "stock mount", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel mount", 1 ] ] }, diff --git a/data/json/items/gun/12mm.json b/data/json/items/gun/12mm.json index 14287aa361e61..940625c40bc0a 100644 --- a/data/json/items/gun/12mm.json +++ b/data/json/items/gun/12mm.json @@ -28,7 +28,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "flags": [ "NEVER_JAMS" ], diff --git a/data/json/items/gun/20x66mm.json b/data/json/items/gun/20x66mm.json index b5bb3206e5771..096513015100c 100644 --- a/data/json/items/gun/20x66mm.json +++ b/data/json/items/gun/20x66mm.json @@ -34,7 +34,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "flags": [ "RELOAD_ONE", "WATERPROOF_GUN", "NEVER_JAMS", "PUMP_ACTION" ], @@ -71,7 +71,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "flags": [ "WATERPROOF_GUN", "NEVER_JAMS" ], @@ -108,7 +108,7 @@ [ "rail", 1 ], [ "sights", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel mount", 1 ] ], "flags": [ "WATERPROOF_GUN", "NEVER_JAMS" ], diff --git a/data/json/items/gun/22.json b/data/json/items/gun/22.json index db1476050ee29..c6553695df668 100644 --- a/data/json/items/gun/22.json +++ b/data/json/items/gun/22.json @@ -36,7 +36,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], @@ -81,7 +81,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt" ], @@ -210,7 +210,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], diff --git a/data/json/items/gun/223.json b/data/json/items/gun/223.json index c8706a0394d0c..03b3286d468c7 100644 --- a/data/json/items/gun/223.json +++ b/data/json/items/gun/223.json @@ -315,7 +315,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2] + [ "stock accessory", 2 ] ], "pocket_data": [ { diff --git a/data/json/items/gun/3006.json b/data/json/items/gun/3006.json index b9c816cda49f0..0dc62f1a11195 100644 --- a/data/json/items/gun/3006.json +++ b/data/json/items/gun/3006.json @@ -35,7 +35,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt" ], @@ -76,7 +76,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], @@ -160,7 +160,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], diff --git a/data/json/items/gun/308.json b/data/json/items/gun/308.json index 2432a3b71d20f..0c6fbea64934a 100644 --- a/data/json/items/gun/308.json +++ b/data/json/items/gun/308.json @@ -106,7 +106,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ] }, @@ -186,7 +186,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2] + [ "stock accessory", 2 ] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "belt308" ] } ] }, @@ -227,7 +227,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2] + [ "stock accessory", 2 ] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "belt308" ] } ] }, diff --git a/data/json/items/gun/40x46mm.json b/data/json/items/gun/40x46mm.json index 06b5e057f3e47..6798983514236 100644 --- a/data/json/items/gun/40x46mm.json +++ b/data/json/items/gun/40x46mm.json @@ -153,7 +153,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "flags": [ "RELOAD_ONE", "WATERPROOF_GUN", "NEVER_JAMS" ], diff --git a/data/json/items/gun/45.json b/data/json/items/gun/45.json index 3c56691db6f98..227e45931b9b7 100644 --- a/data/json/items/gun/45.json +++ b/data/json/items/gun/45.json @@ -353,7 +353,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], diff --git a/data/json/items/gun/50.json b/data/json/items/gun/50.json index 9bbc16a0c8ea4..ccf24b7e0ead3 100644 --- a/data/json/items/gun/50.json +++ b/data/json/items/gun/50.json @@ -83,7 +83,7 @@ [ "muzzle", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "grip", 1 ], [ "rail mount", 1 ], [ "underbarrel mount", 1 ] @@ -188,7 +188,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "default_mods": [ "bipod", "rifle_scope", "muzzle_brake" ], diff --git a/data/json/items/gun/500.json b/data/json/items/gun/500.json index 4a9c8ea8d20d1..8463d59ca172b 100644 --- a/data/json/items/gun/500.json +++ b/data/json/items/gun/500.json @@ -32,7 +32,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "rail mount", 1 ], [ "underbarrel mount", 1 ] ], diff --git a/data/json/items/gun/545x39.json b/data/json/items/gun/545x39.json index 134eea2960c12..a8e604f76e8e4 100644 --- a/data/json/items/gun/545x39.json +++ b/data/json/items/gun/545x39.json @@ -34,7 +34,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "flags": [ "NEVER_JAMS" ], diff --git a/data/json/items/gun/57.json b/data/json/items/gun/57.json index 4112819de8cf7..c8b2e66393b76 100644 --- a/data/json/items/gun/57.json +++ b/data/json/items/gun/57.json @@ -73,7 +73,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "faults": [ "fault_gun_blackpowder", "fault_gun_dirt", "fault_gun_chamber_spent" ], diff --git a/data/json/items/gun/5x50.json b/data/json/items/gun/5x50.json index 6f94012dc6a03..d4c6568cf8c4b 100644 --- a/data/json/items/gun/5x50.json +++ b/data/json/items/gun/5x50.json @@ -35,7 +35,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "flags": [ "WATERPROOF_GUN", "NEVER_JAMS" ], diff --git a/data/json/items/gun/700nx.json b/data/json/items/gun/700nx.json index 120af7b0933bc..98cdc89740718 100644 --- a/data/json/items/gun/700nx.json +++ b/data/json/items/gun/700nx.json @@ -31,7 +31,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "flags": [ "NEVER_JAMS", "RELOAD_EJECT" ], diff --git a/data/json/items/gun/762.json b/data/json/items/gun/762.json index 39b564baeb362..890170b3e8f9c 100644 --- a/data/json/items/gun/762.json +++ b/data/json/items/gun/762.json @@ -32,7 +32,7 @@ [ "sights mount", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel mount", 1 ] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "akmag30", "akmag10", "akmag20", "akmag40", "akdrum75" ] } ] @@ -73,7 +73,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "akmag30", "akmag10", "akmag20", "akmag40" ] } ] @@ -115,7 +115,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "flags": [ "RELOAD_ONE", "NEVER_JAMS" ], @@ -161,7 +161,7 @@ [ "sights mount", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel mount", 1 ] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", "item_restriction": [ "akmag30", "akmag10", "akmag20", "akmag40", "akdrum75" ] } ] diff --git a/data/json/items/gun/762R.json b/data/json/items/gun/762R.json index fca90cabe7b60..652fc384bea98 100644 --- a/data/json/items/gun/762R.json +++ b/data/json/items/gun/762R.json @@ -40,7 +40,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "relative": { "price": 10000 } @@ -79,7 +79,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock mount", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel mount", 1 ] ], "flags": [ "RELOAD_ONE" ], @@ -110,7 +110,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ] ], "relative": { "price": 10000 } diff --git a/data/json/items/gun/762x25.json b/data/json/items/gun/762x25.json index abb9a4a761931..e610a61263693 100644 --- a/data/json/items/gun/762x25.json +++ b/data/json/items/gun/762x25.json @@ -35,7 +35,7 @@ [ "sights", 1 ], [ "sling", 1 ], [ "stock", 1 ], - [ "stock accessory", 2], + [ "stock accessory", 2 ], [ "underbarrel", 1 ], [ "rail mount", 1 ] ], diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index ff88de0c3c6c1..ba1535d152520 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -4321,7 +4321,7 @@ ret_val modify_gunmods_actor::can_use( const Character &p, const item &it, return ret_val::make_failure( _( "Doesn't appear to be modded." ) ); } - const bool modifiables = std::all_of( mods.begin(), mods.end(), + const bool modifiables = std::any_of( mods.begin(), mods.end(), std::bind( &item::is_transformable, std::placeholders::_1 ) ); if( !modifiables ) { From 9285b553614cc45aff06ae7b55385f5de2a1437b Mon Sep 17 00:00:00 2001 From: bombasticSlacks Date: Thu, 3 Mar 2022 14:23:59 -0400 Subject: [PATCH 6/7] plurals and spaces --- data/json/items/gunmod/mount.json | 2 +- data/json/items/gunmod/stock.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/json/items/gunmod/mount.json b/data/json/items/gunmod/mount.json index 37d2afe3bec7c..12a7655816121 100644 --- a/data/json/items/gunmod/mount.json +++ b/data/json/items/gunmod/mount.json @@ -99,7 +99,7 @@ "id": "stock_mount", "type": "GUNMOD", "name": { "str": "replaceable stock kit" }, - "description": "This is a kit consisting of various steel parts; when installed, it would remove the weapon's original fixed stock, install a new stock mount on its place, modify original stock to fit it and then reattach it to the gun, or simply attach a stock mount if gun had no stock to start with. This allows easy installation of any kind of more advanced stocks.", + "description": "This is a kit consisting of various steel parts; when installed, it would remove the weapon's original fixed stock, install a new stock mount on its place, modify original stock to fit it and then reattach it to the gun, or simply attach a stock mount if gun had no stock to start with. This allows easy installation of any kind of more advanced stocks.", "weight": "80 g", "volume": "50 ml", "integral_volume": "0 ml", diff --git a/data/json/items/gunmod/stock.json b/data/json/items/gunmod/stock.json index 642a93c63a03b..0515ca342189c 100644 --- a/data/json/items/gunmod/stock.json +++ b/data/json/items/gunmod/stock.json @@ -50,7 +50,7 @@ { "id": "folding_stock_folded", "type": "GUNMOD", - "name": { "str": "folding stock (folded)" }, + "name": { "str": "folding stock (folded)", "str_pl": "folding stocks (folded)" }, "description": "A folding stock which reduces length. Currently folded making shooting this gun difficult.", "copy-from": "folding_stock", "use_action": { @@ -96,7 +96,7 @@ { "id": "high_end_folding_stock_folded", "type": "GUNMOD", - "name": { "str": "modular folding stock (folded)" }, + "name": { "str": "modular folding stock (folded)", "str_pl": "modular folding stocks (folded)" }, "description": "A multi position, high-end, folding stock which reduces length when folded. Currently folded making shooting this gun hard.", "copy-from": "high_end_folding_stock", "use_action": { @@ -142,7 +142,7 @@ { "id": "wire_stock_folded", "type": "GUNMOD", - "name": { "str": "collapsing wire stock (collapsed)" }, + "name": { "str": "collapsing wire stock (collapsed)", "str_pl": "collapsing wire stocks (collapsed)" }, "description": "A collapsing wire stock which collapses into the body of the gun very compactly reducing length and volume. Currently collapsed making shooting difficult.", "copy-from": "wire_stock", "use_action": { From d260f8fa9f8a434a7a4e3cffc5415ae7c3cffffb Mon Sep 17 00:00:00 2001 From: bombasticSlacks Date: Thu, 3 Mar 2022 21:15:18 -0400 Subject: [PATCH 7/7] alphabetize --- src/flag.cpp | 2 +- src/flag.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/flag.cpp b/src/flag.cpp index ec42ef77cc87d..68cc75419bb29 100644 --- a/src/flag.cpp +++ b/src/flag.cpp @@ -62,8 +62,8 @@ const flag_id flag_CITY_START( "CITY_START" ); const flag_id flag_CLIMATE_CONTROL( "CLIMATE_CONTROL" ); const flag_id flag_COLD( "COLD" ); const flag_id flag_COLD_IMMUNE( "COLD_IMMUNE" ); -const flag_id flag_COLLAPSE_CONTENTS( "COLLAPSE_CONTENTS" ); const flag_id flag_COLLAPSED_STOCK( "COLLAPSED_STOCK" ); +const flag_id flag_COLLAPSE_CONTENTS( "COLLAPSE_CONTENTS" ); const flag_id flag_COLLAPSIBLE_STOCK( "COLLAPSIBLE_STOCK" ); const flag_id flag_COLLAR( "COLLAR" ); const flag_id flag_COMBAT_TOGGLEABLE( "COMBAT_TOGGLEABLE" ); diff --git a/src/flag.h b/src/flag.h index 735022efa40bb..d9b7629cc0839 100644 --- a/src/flag.h +++ b/src/flag.h @@ -72,8 +72,8 @@ extern const flag_id flag_CITY_START; extern const flag_id flag_CLIMATE_CONTROL; extern const flag_id flag_COLD; extern const flag_id flag_COLD_IMMUNE; -extern const flag_id flag_COLLAPSE_CONTENTS; extern const flag_id flag_COLLAPSED_STOCK; +extern const flag_id flag_COLLAPSE_CONTENTS; extern const flag_id flag_COLLAPSIBLE_STOCK; extern const flag_id flag_COLLAR; extern const flag_id flag_COMBAT_TOGGLEABLE;