Files
Bubberstation/code/datums/components/ling_decoy_brain.dm
SkyratBot 8df7202455 [MIRROR] Rename notify_ghost_cloning to notify_revival [MDB IGNORE] (#25442)
* Rename notify_ghost_cloning to notify_revival (#80096)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

Renames
- `/mob/proc/notify_ghost_cloning` to `/mob/proc/notify_revival`
- `/mob/dead/observer/proc/notify_cloning` to
`/mob/dead/observer/proc/send_revival_notification`
- `/atom/movable/screen/alert/notify_cloning` to
`/atom/movable/screen/alert/revival`.

I could have found a way to merge both procs together but default
parameters keep me up at night.

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game

Conciseness, code that is named after a removed feature is silly.

<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

nothing playerfacing

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

* Rename notify_ghost_cloning to notify_revival

* Missed wow

* Modular

---------

Co-authored-by: distributivgesetz <distributivgesetz93@gmail.com>
Co-authored-by: SomeRandomOwl <somerandomowl@ratchtnet.com>
2023-12-06 01:36:04 -05:00

69 lines
2.8 KiB
Plaintext

/// Component applied to ling brains to make them into decoy brains, as ling brains are vestigial and don't do anything
/datum/component/ling_decoy_brain
/// The ling this brain is linked to
VAR_FINAL/datum/antagonist/changeling/parent_ling
/// A talk action that is granted to the ling when this decoy enters an MMI
VAR_FINAL/datum/action/changeling/mmi_talk/talk_action
/datum/component/ling_decoy_brain/Initialize(datum/antagonist/changeling/ling)
if(!istype(parent, /obj/item/organ/internal/brain))
return COMPONENT_INCOMPATIBLE
if(isnull(ling))
stack_trace("[type] instantiated without a changeling to link to.")
return COMPONENT_INCOMPATIBLE
parent_ling = ling
RegisterSignal(parent_ling, COMSIG_QDELETING, PROC_REF(clear_decoy))
/datum/component/ling_decoy_brain/Destroy()
UnregisterSignal(parent_ling, COMSIG_QDELETING)
parent_ling = null
QDEL_NULL(talk_action)
return ..()
/datum/component/ling_decoy_brain/RegisterWithParent()
var/obj/item/organ/internal/brain/ling_brain = parent
ling_brain.organ_flags &= ~ORGAN_VITAL
ling_brain.decoy_override = TRUE
RegisterSignal(ling_brain, COMSIG_ATOM_ENTERING, PROC_REF(entered_mmi))
/datum/component/ling_decoy_brain/UnregisterFromParent()
var/obj/item/organ/internal/brain/ling_brain = parent
ling_brain.organ_flags |= ORGAN_VITAL
ling_brain.decoy_override = FALSE
UnregisterSignal(ling_brain, COMSIG_ATOM_ENTERING, PROC_REF(entered_mmi))
/**
* Signal proc for [COMSIG_ATOM_ENTERING], when the brain enters an MMI grant the MMI talk action to the ling
*
* Unfortunately this is hooked on Entering rather than its own dedicated MMI signal becuase MMI code is a fuck
*/
/datum/component/ling_decoy_brain/proc/entered_mmi(obj/item/organ/internal/brain/source, atom/entering, atom/old_loc, ...)
SIGNAL_HANDLER
var/mob/living/the_real_ling = parent_ling.owner.current
if(!istype(the_real_ling))
return
if(istype(source.loc, /obj/item/mmi) && talk_action?.owner != the_real_ling)
if(isnull(talk_action))
talk_action = new() // Not linked to anything, we manage the reference (and don't want it disappearing on us)
talk_action.brain_ref = source
if(the_real_ling.key)
to_chat(the_real_ling, span_ghostalert("We detect our decoy brain has been placed within a Man-Machine Interface. \
We can use the \"MMI Talk\" action to command it to speak."))
else
the_real_ling.notify_revival("Your decoy brain has been placed in an MMI, re-enter your body to talk via it!", source = the_real_ling, flashwindow = TRUE)
talk_action.Grant(the_real_ling)
else if(talk_action?.owner == the_real_ling)
to_chat(the_real_ling, span_ghostalert("We can no longer detect our decoy brain."))
talk_action.Remove(the_real_ling)
/// Clear up the decoy if the ling is de-linged
/datum/component/ling_decoy_brain/proc/clear_decoy(datum/source)
SIGNAL_HANDLER
qdel(src)