diff --git a/code/game/click/observer.dm b/code/game/click/observer.dm index ac0f8a93f0c0..dbd40e23aeed 100644 --- a/code/game/click/observer.dm +++ b/code/game/click/observer.dm @@ -99,26 +99,3 @@ */ -//! ## VR FILE MERGE ## !// -/obj/item/paicard/attack_ghost(mob/user) - . = ..() - if(src.pai != null) //Have a person in them already? - user.examinate(src) - return - var/choice = input(user, "You sure you want to inhabit this PAI?") in list("Yes", "No") - var/pai_name = input(user, "Choose your character's name", "Character Name") as text - var/actual_pai_name = sanitize_species_name(pai_name) - var/pai_key - if (isnull(pai_name)) - return - if(choice == "Yes") - pai_key = user.key - else - return - var/turf/location = get_turf(src) - var/obj/item/paicard/card = new(location) - var/mob/living/silicon/pai/pai = new(card) - qdel(src) - pai.key = pai_key - card.setPersonality(pai) - pai.SetName(actual_pai_name) diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm index e935a0f6b82c..2e3a21760cf2 100644 --- a/code/game/objects/items/devices/paicard.dm +++ b/code/game/objects/items/devices/paicard.dm @@ -383,3 +383,45 @@ GLOBAL_LIST_BOILERPLATE(all_pai_cards, /obj/item/paicard) /obj/item/paicard/proc/stop_displaying_hologram() displaying_hologram = FALSE update_icons() + +/// Handling for ghosts going into empty pAI cards +/obj/item/paicard/attack_ghost(mob/user) + . = ..() + + if(src.pai != null) //Have a person in them already? + user.examinate(src) + return + + var/datum/category_item/player_setup_item/player_global/pai/pai_pref = user.client.prefs.preference_by_type[/datum/category_item/player_setup_item/player_global/pai] + var/datum/paiCandidate/prefs = pai_pref?.candidate + var/has_pAI_data = !isnull(prefs) && !isnull(prefs.name) + var/options = (has_pAI_data ? list("Yes (As [prefs.name])") : list()) + list("Yes (Pick Name)", "No") + + var/choice = input(user, "Do you wish to inhabit this PAI?") in options + if(choice == "No" || isnull(choice)) + return + + var/pai_name + var/actual_pai_name + + if(choice == "Yes (Pick Name)") + pai_name = input(user, "Choose your character's name", "Character Name") as text + actual_pai_name = sanitize_species_name(pai_name) + else + actual_pai_name = sanitize_species_name(prefs.name) + + if(isnull(actual_pai_name)) + return + + var/pai_key = user.key + var/turf/location = get_turf(src) + var/obj/item/paicard/card = new(location) + var/mob/living/silicon/pai/pai = new(card) + qdel(src) + + if(choice != "Yes (Pick Name)") + pai.desc = prefs.description + + pai.key = pai_key + card.setPersonality(pai) + pai.SetName(actual_pai_name)