Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when loading into a pAI card you can now choose to use a saved name and description #6211

Merged
merged 10 commits into from
Dec 23, 2023
23 changes: 0 additions & 23 deletions code/game/click/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
42 changes: 42 additions & 0 deletions code/game/objects/items/devices/paicard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading