From d8b3b31c3c475b6204573ad420e317ae74f6ddc9 Mon Sep 17 00:00:00 2001 From: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Wed, 6 Apr 2022 19:35:13 +0100 Subject: [PATCH] Make Air Filtration CBM Useful (#1439) * Update character.cpp * Update item.cpp * Update bionics.json * Update bionics.json * Forgot to add "time" value. Bionic thus didn't consume power when active * One of the descriptions had extra spaces. --- data/json/bionics.json | 19 ++++++++++++++++--- src/character.cpp | 2 +- src/item.cpp | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/data/json/bionics.json b/data/json/bionics.json index 692260ed63fb..3ed24c2988e8 100644 --- a/data/json/bionics.json +++ b/data/json/bionics.json @@ -807,11 +807,24 @@ { "id": "bio_purifier", "type": "bionic", - "name": { "str": "Air Filtration System" }, - "description": "Surgically implanted in your trachea is an advanced filtration system. If toxins, or airborne diseases find their way into your windpipe, the filter will attempt to remove them.", + "name": { "str": "Air Filtration System (passive)" }, + "description": "Surgically implanted in your trachea is an advanced filtration system. In it's passive form it will protect you against smoke inhalation. Once activated, it will prevent spores, toxins and diseases from being inhaled.", "occupied_bodyparts": [ [ "torso", 4 ], [ "mouth", 2 ] ], "env_protec": [ [ "mouth", 7 ] ], - "flags": [ "BIONIC_NPC_USABLE" ] + "flags": [ "BIONIC_NPC_USABLE" ], + "included_bionics": [ "bio_purifier_active" ] + }, + { + "id": "bio_purifier_active", + "type": "bionic", + "name": { "str": "Air Filtration System (active)" }, + "description": "Surgically implanted in your trachea is an advanced filtration system. In it's passive form it will protect you against smoke inhalation. Once activated, it will prevent spores, toxins and diseases from being inhaled.", + "env_protec": [ [ "mouth", 8 ] ], + "included": true, + "flags": [ "BIONIC_TOGGLED" , "BIONIC_NPC_USABLE" ], + "act_cost": "100 J", + "react_cost": "10 J", + "time": 1 }, { "id": "bio_radscrubber", diff --git a/src/character.cpp b/src/character.cpp index f5d7b95c62c5..3bfe50e85f77 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -6981,7 +6981,7 @@ int Character::get_env_resist( bodypart_id bp ) const for( const bionic_id &bid : get_bionics() ) { const auto EP = bid->env_protec.find( bp.id() ); - if( EP != bid->env_protec.end() ) { + if( ( !bid->activated || has_active_bionic( bid ) ) && EP != bid->env_protec.end() ) { ret += EP->second; } } diff --git a/src/item.cpp b/src/item.cpp index c716552bd723..467f00ee78c7 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -3239,7 +3239,7 @@ void item::bionic_info( std::vector &info, const iteminfo_query *parts if( !bid->env_protec.empty() ) { info.push_back( iteminfo( "DESCRIPTION", - _( "Environmental Protection: " ), + bid->activated ? _( "Environmental Protection (activated): " ) : _( "Environmental Protection: " ), iteminfo::no_newline ) ); for( const std::pair< const bodypart_str_id, int > element : sorted_lex( bid->env_protec ) ) { info.push_back( iteminfo( "CBM", body_part_name_as_heading( element.first->token, 1 ),