Files
CHOMPStation2/code/modules/mob/dead/observer/observer_vr.dm
Leshana 82603a4978 Fix Runtime in observer_vr.dm,65: Cannot read null.name
If an observer/ghost was never in the game this round, thier mind var
will be null.  No sense in letting them ping the transcore.
2020-02-23 22:52:42 -05:00

76 lines
2.9 KiB
Plaintext

/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,"<span class='warning'>[picked] isn't in a humanoid mob at the moment.</span>")
return
var/mob/living/carbon/human/H = picked
if(H.stat || !H.client)
to_chat(src,"<span class='warning'>[H] isn't awake/alive at the moment.</span>")
return
if(!H.nif)
to_chat(src,"<span class='warning'>[H] doesn't have a NIF installed.</span>")
return
var/datum/nifsoft/soulcatcher/SC = H.nif.imp_check(NIF_SOULCATCHER)
if(!SC)
to_chat(src,"<span class='warning'>[H] doesn't have the Soulcatcher NIFSoft installed, or their NIF is unpowered.</span>")
return
//Fine fine, we can ask.
var/obj/item/device/nif/nif = H.nif
to_chat(src,"<span class='notice'>Request sent to [H].</span>")
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,"<span class='warning'>[H] denied your request.</span>")
return
if((world.time - req_time) > 1 MINUTES)
to_chat(H,"<span class='warning'>The request had already expired. (1 minute waiting max)</span>")
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...
/mob/observer/dead/verb/backup_ping()
set category = "Ghost"
set name = "Notify Transcore"
set desc = "If your past-due backup notification was missed or ignored, you can use this to send a new one."
if(src.mind && src.mind.name in SStranscore.backed_up)
var/datum/transhuman/mind_record/record = SStranscore.backed_up[src.mind.name]
if(!(record.dead_state == MR_DEAD))
to_chat(src, "<span class='warning'>Your backup is not past-due yet.</span>")
else if((world.time - record.last_notification) < 10 MINUTES)
to_chat(src, "<span class='warning'>Too little time has passed since your last notification.</span>")
else
SStranscore.notify(record.mindname, TRUE)
record.last_notification = world.time
to_chat(src, "<span class='notice'>New notification has been sent.</span>")
else
to_chat(src, "<span class='warning'>No mind record found!</span>")