Skip to content

Commit

Permalink
Offer to deactivate extended bionics when NPC is requesting it (#61412)
Browse files Browse the repository at this point in the history
  • Loading branch information
Night-Pryanik committed Oct 4, 2022
1 parent 87a0a8e commit 5ce6671
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/npctalk_funcs.cpp
Expand Up @@ -972,6 +972,14 @@ void talk_function::drop_weapon( npc &p )
void talk_function::player_weapon_away( npc &/*p*/ )
{
Character &player_character = get_player_character();

cata::optional<bionic *> bionic_weapon = player_character.find_bionic_by_uid(
player_character.get_weapon_bionic_uid() );
if( bionic_weapon ) {
player_character.deactivate_bionic( **bionic_weapon );
return;
}

player_character.i_add( player_character.remove_weapon() );
}

Expand Down
6 changes: 6 additions & 0 deletions src/talker_character.cpp
Expand Up @@ -407,6 +407,12 @@ bool talker_character_const::unarmed_attack() const

bool talker_character_const::can_stash_weapon() const
{
cata::optional<bionic *> bionic_weapon = me_chr_const->find_bionic_by_uid(
me_chr_const->get_weapon_bionic_uid() );
if( bionic_weapon && me_chr_const->can_deactivate_bionic( **bionic_weapon ).success() ) {
return true;
}

return me_chr_const->can_pickVolume( *me_chr_const->get_wielded_item() );
}

Expand Down

0 comments on commit 5ce6671

Please sign in to comment.