diff --git a/code/modules/nifsoft/nif.dm b/code/modules/nifsoft/nif.dm
index da4594d5575..db6d66e7fd6 100644
--- a/code/modules/nifsoft/nif.dm
+++ b/code/modules/nifsoft/nif.dm
@@ -42,6 +42,7 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
var/tmp/stat = NIF_PREINSTALL // Status of the NIF
var/tmp/install_done // Time when install will finish
var/tmp/open = FALSE // If it's open for maintenance (1-3)
+ var/tmp/should_be_in = BP_HEAD // Organ we're supposed to be held in
var/obj/item/device/communicator/commlink/comm // The commlink requires this
@@ -110,7 +111,11 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
//Being implanted in some mob
/obj/item/device/nif/proc/implant(var/mob/living/carbon/human/H)
- if(istype(H) && !H.nif && H.species && (loc == H.get_organ(BP_HEAD)))
+ var/obj/item/organ/brain = H.internal_organs_by_name[O_BRAIN]
+ if(istype(brain))
+ should_be_in = brain.parent_organ
+
+ if(istype(H) && !H.nif && H.species && (loc == H.get_organ(should_be_in)))
if(!bioadap && (H.species.flags & NO_SCAN)) //NO_SCAN is the default 'too complicated' flag
return FALSE
@@ -125,11 +130,18 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
//For debug or antag purposes
/obj/item/device/nif/proc/quick_implant(var/mob/living/carbon/human/H)
if(istype(H))
- var/obj/item/organ/external/head = H.get_organ(BP_HEAD)
- if(!head)
+ var/obj/item/organ/external/parent
+ //Try to find their brain and put it near that
+ var/obj/item/organ/brain = H.internal_organs_by_name[O_BRAIN]
+ if(istype(brain))
+ should_be_in = brain.parent_organ
+
+ parent = H.get_organ(should_be_in)
+ //Ok, nevermind then!
+ if(!istype(parent))
return FALSE
- src.forceMove(head)
- head.implants += src
+ forceMove(parent)
+ parent.implants += src
spawn(0) //Let the character finish spawning yo.
if(H.mind)
owner = H.mind.name
@@ -289,11 +301,17 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
stat = NIF_WORKING
owner = human.mind.name
name = initial(name) + " ([owner])"
+ if(comm)
+ var/saved_name = save_data["commlink_name"]
+ if(saved_name)
+ comm.register_device(saved_name)
+ else if(human)
+ comm.register_device(human.name)
notify("Calibration complete! User data stored!")
//Called each life() tick on the mob
/obj/item/device/nif/proc/life()
- if(!human || loc != human.get_organ(BP_HEAD))
+ if(!human || loc != human.get_organ(should_be_in))
unimplant(human)
return FALSE
@@ -562,18 +580,18 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable
var/mob/living/carbon/human/U = user
var/mob/living/carbon/human/T = M
- if(istype(T.species,/datum/species/shapeshifter/promethean) && target_zone == BP_HEAD) //Are prommy, aimed at head.
+ if(istype(T.species,/datum/species/shapeshifter/promethean) && target_zone == should_be_in) //Are prommy, aimed at head.
if(T.head || T.glasses)
to_chat(user,"Remove any headgear they have on first, as it might interfere.")
return
- var/obj/item/organ/external/head = T.get_organ(BP_HEAD)
+ var/obj/item/organ/external/head = T.get_organ(should_be_in)
if(!T)
to_chat(user,"They should probably regrow their head first.")
return
U.visible_message("[U] begins installing [src] into [T]'s head by just stuffing it in.",
"You begin installing [src] into [T]'s head by just stuffing it in.",
"There's a wet SQUISH noise.")
- if(do_mob(user = user, target = T, time = 200, target_zone = BP_HEAD))
+ if(do_mob(user = user, target = T, time = 200, target_zone = should_be_in))
user.unEquip(src)
forceMove(head)
head.implants |= src
diff --git a/code/modules/nifsoft/software/14_commlink.dm b/code/modules/nifsoft/software/14_commlink.dm
index c7cfcfde699..1fba7d0c3b0 100644
--- a/code/modules/nifsoft/software/14_commlink.dm
+++ b/code/modules/nifsoft/software/14_commlink.dm
@@ -43,7 +43,6 @@
..()
nif = newloc
nifsoft = soft
- spawn(10) register_device(nif.human) //Need to outwait the other spawn in communicators, sigh.
qdel_null(camera) //Not supported on internal one.
Destroy()
@@ -53,6 +52,11 @@
nifsoft = null
return ..()
+/obj/item/device/communicator/commlink/register_device(var/new_name)
+ owner = new_name
+ name = "[owner]'s [initial(name)]"
+ nif.save_data["commlink_name"] = owner
+
//So that only the owner's chat is relayed to others.
/obj/item/device/communicator/commlink/hear_talk(mob/living/M, text, verb, datum/language/speaking)
if(M != nif.human) return