/mob/observer/dead/verb/nifjoin()
set category = "Ghost"
set name = "Join Into Soulcatcher"
set desc = "Select a player with a working NIF + Soulcatcher NIFSoft to join into it."
var/picked = input("Pick a friend with NIF and Soulcatcher to join into. Harrass strangers, get banned. Not everyone has a NIF w/ Soulcatcher.","Select a player") as null|anything in player_list
//Didn't pick anyone or picked a null
if(!picked)
return
//Good choice testing and some instance-grabbing
if(!ishuman(picked))
to_chat(src,"[picked] isn't in a humanoid mob at the moment.")
return
var/mob/living/carbon/human/H = picked
if(H.stat || !H.client)
to_chat(src,"[H] isn't awake/alive at the moment.")
return
if(!H.nif)
to_chat(src,"[H] doesn't have a NIF installed.")
return
var/datum/nifsoft/soulcatcher/SC = H.nif.imp_check(NIF_SOULCATCHER)
if(!SC)
to_chat(src,"[H] doesn't have the Soulcatcher NIFSoft installed, or their NIF is unpowered.")
return
//Fine fine, we can ask.
var/obj/item/device/nif/nif = H.nif
to_chat(src,"Request sent to [H].")
var/req_time = world.time
nif.notify("Transient mindstate detected, analyzing...")
sleep(15) //So if they are typing they get interrupted by sound and message, and don't type over the box
var/response = alert(H,"[src] ([src.key]) wants to join into your Soulcatcher.","Soulcatcher Request","Deny","Allow")
if(response == "Deny")
to_chat(src,"[H] denied your request.")
return
if((world.time - req_time) > 1 MINUTES)
to_chat(H,"The request had already expired. (1 minute waiting max)")
return
//Final check since we waited for input a couple times.
if(H && src && src.key && !H.stat && nif && SC)
if(!mind) //No mind yet, aka haven't played in this round.
mind = new(key)
mind.name = name
mind.current = src
mind.active = TRUE
SC.catch_mob(src) //This will result in us being deleted so...