diff --git a/data/mods/Aftershock/items/armor/modular_exos/modular_exoskeleton.json b/data/mods/Aftershock/items/armor/modular_exos/modular_exoskeleton.json index 99b9cf9c29550..70f303219e257 100644 --- a/data/mods/Aftershock/items/armor/modular_exos/modular_exoskeleton.json +++ b/data/mods/Aftershock/items/armor/modular_exos/modular_exoskeleton.json @@ -21,6 +21,7 @@ "max_contains_volume": "10 L", "max_contains_weight": "80 kg", "flag_restriction": [ "EXO_TORSO_PLATE" ], + "inherits_flags": true, "moves": 60 }, { @@ -31,6 +32,7 @@ "max_contains_volume": "2 L", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_MEDIUM_GADGET", "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -41,6 +43,7 @@ "max_contains_volume": "1500 ml", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -51,6 +54,7 @@ "max_contains_volume": "1500 ml", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -61,6 +65,7 @@ "max_contains_volume": "25 L", "max_contains_weight": "140 kg", "flag_restriction": [ "EXO_PSU", "EXO_LARGE_GADGET", "EXO_MEDIUM_GADGET", "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -72,6 +77,7 @@ "max_contains_volume": "12 L", "max_contains_weight": "80 kg", "flag_restriction": [ "EXO_ARM_PLATE" ], + "inherits_flags": true, "moves": 60 }, { @@ -82,6 +88,7 @@ "max_contains_volume": "2 L", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_MEDIUM_GADGET", "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -92,6 +99,7 @@ "max_contains_volume": "2 L", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_MEDIUM_GADGET", "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -102,6 +110,7 @@ "max_contains_volume": "1500 ml", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -112,6 +121,7 @@ "max_contains_volume": "1500 ml", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -123,6 +133,7 @@ "max_contains_volume": "12 L", "max_contains_weight": "80 kg", "flag_restriction": [ "EXO_LEG_PLATE" ], + "inherits_flags": true, "moves": 60 }, { @@ -133,6 +144,7 @@ "max_contains_volume": "2 L", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_MEDIUM_GADGET", "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -143,6 +155,7 @@ "max_contains_volume": "2 L", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_MEDIUM_GADGET", "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -153,6 +166,7 @@ "max_contains_volume": "1500 ml", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 }, { @@ -163,6 +177,7 @@ "max_contains_volume": "1500 ml", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_SMALL_GADGET" ], + "inherits_flags": true, "moves": 60 } ], @@ -243,6 +258,7 @@ "max_contains_volume": "2 L", "max_contains_weight": "5 kg", "flag_restriction": [ "EXO_HELMET_GADGET" ], + "inherits_flags": true, "moves": 60 } ] diff --git a/data/mods/Aftershock/items/armor/modular_exos/modular_exoskeleton_modules.json b/data/mods/Aftershock/items/armor/modular_exos/modular_exoskeleton_modules.json index 37c7204c845fc..eb5fa5f77526b 100644 --- a/data/mods/Aftershock/items/armor/modular_exos/modular_exoskeleton_modules.json +++ b/data/mods/Aftershock/items/armor/modular_exos/modular_exoskeleton_modules.json @@ -203,6 +203,21 @@ "type": "transform" } }, + { + "id": "exo_lense_module", + "type": "TOOL", + "name": { "str": "exosuit multi lense zoom module" }, + "description": "A series of strangely shaped hexagonal lenses that flutter about inside your helmet. As the lenses shift things around you stay perfectly in focus no matter your eyesight or distance. It can be mounted to an exosuit helmet.", + "weight": "500 g", + "volume": "250 ml", + "price": "10 kUSD", + "to_hit": -2, + "bashing": 6, + "material": [ "lvl4ballisticglass", "qt_steel" ], + "symbol": "(", + "color": "yellow", + "flags": [ "CANT_WEAR", "FIX_NEARSIGHT", "FIX_FARSIGHT", "ZOOM", "EXO_HELMET_GADGET" ] + }, { "id": "exo_flashlight", "type": "TOOL_ARMOR", diff --git a/src/item.cpp b/src/item.cpp index a8b235971c56a..5834333f00d08 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -6822,6 +6822,18 @@ bool item::has_flag( const flag_id &f ) const } } + // check flags from items in inherit pockets + for( const item_pocket *pocket : contents.get_all_contained_pockets() ) { + // if the pocket inherits flags + if( pocket->inherits_flags() ) { + for( const item *e : pocket->all_items_top() ) { + if( e->has_flag( f ) ) { + return true; + } + } + } + } + // other item type flags ret = type->has_flag( f ); if( ret ) { diff --git a/src/item_pocket.cpp b/src/item_pocket.cpp index ca0173475c0b6..47f36a7c742e2 100644 --- a/src/item_pocket.cpp +++ b/src/item_pocket.cpp @@ -173,6 +173,7 @@ void pocket_data::load( const JsonObject &jo ) optional( jo, was_loaded, "rigid", rigid, false ); optional( jo, was_loaded, "holster", holster ); optional( jo, was_loaded, "ablative", ablative ); + optional( jo, was_loaded, "inherits_flags", inherits_flags ); // if ablative also flag as a holster so it only holds 1 item if( ablative ) { holster = true; @@ -1768,6 +1769,11 @@ bool item_pocket::airtight() const return data->airtight; } +bool item_pocket::inherits_flags() const +{ + return data->inherits_flags; +} + bool item_pocket::allows_speedloader( const itype_id &speedloader_id ) const { if( data->allowed_speedloaders.empty() ) { diff --git a/src/item_pocket.h b/src/item_pocket.h index 2b6fce24c66ff..7c279d6d2c7e7 100644 --- a/src/item_pocket.h +++ b/src/item_pocket.h @@ -148,6 +148,7 @@ class item_pocket bool rigid() const; bool watertight() const; bool airtight() const; + bool inherits_flags() const; // is this speedloader compatible with this pocket (if any speedloaders are whitelisted) bool allows_speedloader( const itype_id &speedloader_id ) const; @@ -479,6 +480,8 @@ class pocket_data bool airtight = false; // the pocket will spill its contents if placed in another container bool open_container = false; + // items in this pocket pass their flags to the parent item + bool inherits_flags = false; // a description of the pocket translation description;