Add deathrattle implant for nuclear operatives (#55903)

Deathrattle implant, comes in box of 8, implant yourself and others, and
you'll get a little notification when they die.

Intended for nuke ops, price around the same as the codebook, since it's
a utility communication item, that actually "plans to fail", so it can't
be too expensive, because it doesn't help them win, just lets them know
how much they are losing by.
This commit is contained in:
coiax
2021-01-20 19:30:30 -03:00
committed by GitHub
parent 13a57cd807
commit 25e476e92a
6 changed files with 117 additions and 1 deletions
+3 -1
View File
@@ -83,6 +83,7 @@
if(user)
log_combat(user, target, "implanted", "\a [name]")
SEND_SIGNAL(src, COMSIG_IMPLANT_IMPLANTED, target, user, silent, force)
return TRUE
/obj/item/implant/proc/removed(mob/living/source, silent = FALSE, special = 0)
@@ -96,7 +97,8 @@
var/mob/living/carbon/human/H = source
H.sec_hud_set_implants()
return 1
SEND_SIGNAL(src, COMSIG_IMPLANT_REMOVED, source, silent, special)
return TRUE
/obj/item/implant/Destroy()
if(imp_in)
@@ -0,0 +1,77 @@
/datum/deathrattle_group
var/name
var/list/implants = list()
/datum/deathrattle_group/New(name)
if(name)
src.name = name
else
// Give the group a unique name for debugging, and possible future
// use for making custom linked groups.
src.name = "[rand(100,999)] [pick(GLOB.phonetic_alphabet)]"
/*
* Proc called by new implant being added to the group. Listens for the
* implant being implanted, removed and destroyed.
*
* If implant is already implanted in a person, then trigger the implantation
* code.
*/
/datum/deathrattle_group/proc/register(obj/item/implant/deathrattle/implant)
if(implant in implants)
return
RegisterSignal(implant, COMSIG_IMPLANT_IMPLANTED, .proc/on_implant_implantation)
RegisterSignal(implant, COMSIG_IMPLANT_REMOVED, .proc/on_implant_removal)
RegisterSignal(implant, COMSIG_PARENT_QDELETING, .proc/on_implant_destruction)
implants += implant
if(implant.imp_in)
on_implant_implantation(implant.imp_in)
/datum/deathrattle_group/proc/on_implant_implantation(obj/item/implant/implant, mob/living/target, mob/user, silent = FALSE, force = FALSE)
SIGNAL_HANDLER
RegisterSignal(target, COMSIG_MOB_STATCHANGE, .proc/on_user_statchange)
/datum/deathrattle_group/proc/on_implant_removal(obj/item/implant/implant, mob/living/source, silent = FALSE, special = 0)
SIGNAL_HANDLER
UnregisterSignal(source, COMSIG_MOB_STATCHANGE)
/datum/deathrattle_group/proc/on_implant_destruction(obj/item/implant/implant)
implants -= implant
/datum/deathrattle_group/proc/on_user_statchange(mob/living/owner, new_stat)
SIGNAL_HANDLER
if(new_stat != DEAD)
return
var/name = owner.mind ? owner.mind.name : owner.real_name
var/area = get_area_name(get_turf(owner))
for(var/_implant in implants)
var/obj/item/implant/deathrattle/implant = _implant
// Skip the unfortunate soul, and any unimplanted implants
if(implant.imp_in == owner || !implant.imp_in)
continue
// Deliberately the same message framing as nanite message + ghost deathrattle
to_chat(implant.imp_in, "<i>You hear a strange, robotic voice in your head...</i> \"<span class='robot'><b>[name]</b> has died at <b>[area]</b>.</span>\"")
/obj/item/implant/deathrattle
name = "deathrattle implant"
desc = "Hope no one else dies, prepare for when they do."
activated = FALSE
/obj/item/implant/deathrattle/can_be_implanted_in(mob/living/target)
// Can be implanted in anything that's a mob. Syndicate cyborgs, talking fish, humans...
return TRUE
/obj/item/implantcase/deathrattle
name = "implant case - 'Deathrattle'"
desc = "A glass case containing a deathrattle implant."
imp_type = /obj/item/implant/deathrattle
@@ -565,3 +565,21 @@
/obj/item/storage/box/syndie_kit/signaler/PopulateContents()
for(var/i in 1 to 6)
new /obj/item/assembly/signaler(src)
/obj/item/storage/box/syndie_kit/imp_deathrattle
name = "deathrattle implant box"
desc = "Contains eight linked deathrattle implants."
/obj/item/storage/box/syndie_kit/imp_deathrattle/PopulateContents()
new /obj/item/implanter(src)
var/datum/deathrattle_group/group = new
var/implants = list()
for(var/j in 1 to 8)
var/obj/item/implantcase/deathrattle/case = new (src)
implants += case.imp
for(var/i in implants)
group.register(i)
desc += " The implants are registered to the \"[group.name]\" group."