diff --git a/data/json/npcs/robofac/robofac_ancilla_npcs/NPC_ANCILLA_DOCTOR.json b/data/json/npcs/robofac/robofac_ancilla_npcs/NPC_ANCILLA_DOCTOR.json index e06370f7886b6..15cb1ea001e3c 100644 --- a/data/json/npcs/robofac/robofac_ancilla_npcs/NPC_ANCILLA_DOCTOR.json +++ b/data/json/npcs/robofac/robofac_ancilla_npcs/NPC_ANCILLA_DOCTOR.json @@ -140,12 +140,24 @@ "effect": "bionic_install", "condition": { "npc_service": true } }, + { + "text": "I was wondering if you could install a cybernetic implant in my friend here…", + "topic": "TALK_DONE", + "effect": "bionic_install_allies", + "condition": { "npc_service": true } + }, { "text": "I need help removing an implant…", "topic": "TALK_DONE", "effect": "bionic_remove", "condition": { "npc_service": true } }, + { + "text": "I need help removing an implant from one of my friends…", + "topic": "TALK_DONE", + "effect": "bionic_remove_allies", + "condition": { "npc_service": true } + }, { "text": "Oh no, I was wondering if you knew where to get some.", "topic": "TALK_ANCILLA_DOCTOR_FIND_BIONICS" }, { "text": "Never mind.", "topic": "TALK_NONE" } ] diff --git a/src/game_inventory.cpp b/src/game_inventory.cpp index f3f95ca592c57..d2753fa4dc7f2 100644 --- a/src/game_inventory.cpp +++ b/src/game_inventory.cpp @@ -2580,12 +2580,14 @@ class bionic_install_surgeon_preset : public inventory_selector_preset } }; -item_location game_menus::inv::install_bionic( Character &you, Character &patient, bool surgeon ) +item_location game_menus::inv::install_bionic( Character &installer, Character &patron, + Character &patient, bool surgeon ) { if( surgeon ) { - return autodoc_internal( you, patient, bionic_install_surgeon_preset( you, patient ), 5, surgeon ); + return autodoc_internal( patron, patient, bionic_install_surgeon_preset( installer, patient ), 5, + surgeon ); } else { - return autodoc_internal( you, patient, bionic_install_preset( you, patient ), 5 ); + return autodoc_internal( patron, patient, bionic_install_preset( installer, patient ), 5 ); } } diff --git a/src/game_inventory.h b/src/game_inventory.h index 39bd90d31bb2a..15d962a72037e 100644 --- a/src/game_inventory.h +++ b/src/game_inventory.h @@ -145,7 +145,8 @@ item_location salvage( Character &you, const salvage_actor *actor ); /** Repair menu. */ item_location repair( Character &you, const repair_item_actor *actor, const item *main_tool ); /** Bionic install menu. */ -item_location install_bionic( Character &you, Character &patient, bool surgeon = false ); +item_location install_bionic( Character &installer, Character &patron, Character &patient, + bool surgeon = false ); /**Autoclave sterilize menu*/ item_location sterilize_cbm( Character &you ); /** Change sprite menu. */ diff --git a/src/iexamine.cpp b/src/iexamine.cpp index b5293430bced0..bcc96a81de515 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -5431,7 +5431,7 @@ void iexamine::autodoc( Character &you, const tripoint &examp ) switch( amenu.ret ) { case INSTALL_CBM: { - item_location bionic = game_menus::inv::install_bionic( you, patient ); + item_location bionic = game_menus::inv::install_bionic( you, you, patient ); if( !bionic ) { return; diff --git a/src/npctalk.cpp b/src/npctalk.cpp index 58dcc64478078..9ca3cf2b6154c 100644 --- a/src/npctalk.cpp +++ b/src/npctalk.cpp @@ -5729,7 +5729,9 @@ void talk_effect_t::parse_string_effect( const std::string &effect_id, const Jso WRAP( morale_chat ), WRAP( morale_chat_activity ), WRAP( bionic_install ), + WRAP( bionic_install_allies ), WRAP( bionic_remove ), + WRAP( bionic_remove_allies ), WRAP( drop_items_in_place ), WRAP( follow ), WRAP( follow_only ), diff --git a/src/npctalk.h b/src/npctalk.h index 594bca0503bb3..9f8406e460bf5 100644 --- a/src/npctalk.h +++ b/src/npctalk.h @@ -37,7 +37,9 @@ void buy_horse( npc & ); void buy_cow( npc & ); void buy_chicken( npc & ); void bionic_install( npc & ); +void bionic_install_allies( npc & ); void bionic_remove( npc & ); +void bionic_remove_allies( npc & ); void dismount( npc & ); void find_mount( npc & ); diff --git a/src/npctalk_funcs.cpp b/src/npctalk_funcs.cpp index 17be4f6729745..f2662bf2a8d1d 100644 --- a/src/npctalk_funcs.cpp +++ b/src/npctalk_funcs.cpp @@ -500,10 +500,9 @@ void talk_function::insult_combat( npc &p ) p.set_attitude( NPCATT_KILL ); } -void talk_function::bionic_install( npc &p ) +static void bionic_install_common( npc &p, Character &patron, Character &patient ) { - avatar &player_character = get_avatar(); - item_location bionic = game_menus::inv::install_bionic( p, player_character, true ); + item_location bionic = game_menus::inv::install_bionic( p, patron, patient, true ); if( !bionic ) { return; @@ -513,7 +512,7 @@ void talk_function::bionic_install( npc &p ) tmp->set_var( VAR_TRADE_IGNORE, 1 ); const itype &it = *tmp->type; - signed int price = npc_trading::bionic_install_price( p, player_character, bionic ); + signed int price = npc_trading::bionic_install_price( p, patient, bionic ); bool const ret = npc_trading::pay_npc( p, price ); tmp->erase_var( VAR_TRADE_IGNORE ); if( !ret ) { @@ -521,18 +520,32 @@ void talk_function::bionic_install( npc &p ) } //Makes the doctor awesome at installing but not perfect - if( player_character.can_install_bionics( it, p, false, 20 ) ) { + if( patient.can_install_bionics( it, p, false, 20 ) ) { bionic.remove_item(); - player_character.install_bionics( it, p, false, 20 ); + patient.install_bionics( it, p, false, 20 ); } } -void talk_function::bionic_remove( npc &p ) +void talk_function::bionic_install( npc &p ) { - Character &player_character = get_player_character(); - const bionic_collection all_bio = *player_character.my_bionics; + Character &pc = get_player_character(); + bionic_install_common( p, pc, pc ); +} + +void talk_function::bionic_install_allies( npc &p ) +{ + npc *patient = pick_follower(); + if( !patient ) { + return; + } + bionic_install_common( p, get_player_character(), *patient ); +} + +static void bionic_remove_common( npc &p, Character &patient ) +{ + const bionic_collection all_bio = *patient.my_bionics; if( all_bio.empty() ) { - popup( _( "You don't have any bionics installed…" ) ); + popup( _( "%s doesn't have any bionics installed…" ), patient.get_name() ); return; } @@ -572,10 +585,23 @@ void talk_function::bionic_remove( npc &p ) } //Makes the doctor awesome at uninstalling but not perfect - if( player_character.can_uninstall_bionic( *bionics[bionic_index], p, - false, 20 ) ) { - player_character.uninstall_bionic( *bionics[bionic_index], p, false, 20 ); + if( patient.can_uninstall_bionic( *bionics[bionic_index], p, false, 20 ) ) { + patient.uninstall_bionic( *bionics[bionic_index], p, false, 20 ); + } +} + +void talk_function::bionic_remove( npc &p ) +{ + bionic_remove_common( p, get_player_character() ); +} + +void talk_function::bionic_remove_allies( npc &p ) +{ + npc *patient = pick_follower(); + if( !patient ) { + return; } + bionic_remove_common( p, *patient ); } void talk_function::give_equipment( npc &p )