From fc7514e804932bb76a7b38d3560be0abe0d74526 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 18 Apr 2024 03:04:12 +0200 Subject: [PATCH] [MIRROR] Added on_surgical_insertion() and signals, to match on_surgical_removal (#27242) * Added on_surgical_insertion() and signals, to match on_surgical_removal (#82486) ## About The Pull Request We have a proc for the effects of removing organs surgically -- currently only used for surplus organs blowing up -- so I added a matching proc for inserting them surgically. It also comes with its own signal, though there are no registrations. ## Why It's Good For The Game Orderly code with matching insertion and removal verbs. Maybe we could use this for lings, or traitors emagging cybernetics organs that make them do something zany? * Added on_surgical_insertion() and signals, to match on_surgical_removal --------- Co-authored-by: Joshua Kidder <49173900+Metekillot@users.noreply.github.com> --- .../dcs/signals/signals_mob/signals_mob_living.dm | 2 ++ code/modules/surgery/organ_manipulation.dm | 1 + code/modules/surgery/organs/organ_movement.dm | 7 ++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm index 924488af73e..cc9e4d2e966 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_living.dm @@ -12,6 +12,8 @@ #define COMSIG_ORGAN_BEING_REPLACED "organ_being_replaced" /// Called when an organ gets surgically removed (mob/living/user, mob/living/carbon/old_owner, target_zone, obj/item/tool) #define COMSIG_ORGAN_SURGICALLY_REMOVED "organ_surgically_removed" +/// Called when an organ gets surgically removed (mob/living/user, mob/living/carbon/new_owner, target_zone, obj/item/tool) +#define COMSIG_ORGAN_SURGICALLY_INSERTED "organ_surgically_inserted" ///Called when movement intent is toggled. #define COMSIG_MOVE_INTENT_TOGGLED "move_intent_toggled" diff --git a/code/modules/surgery/organ_manipulation.dm b/code/modules/surgery/organ_manipulation.dm index 25004d20d20..144d30e067d 100644 --- a/code/modules/surgery/organ_manipulation.dm +++ b/code/modules/surgery/organ_manipulation.dm @@ -252,6 +252,7 @@ span_notice("[user] inserts something into [target]'s [parse_zone(target_zone)]!"), ) display_pain(target, "Your [parse_zone(target_zone)] throbs with pain as your new [tool.name] comes to life!") + target_organ.on_surgical_insertion(user, target, target_zone, tool) else target_organ.forceMove(target.loc) diff --git a/code/modules/surgery/organs/organ_movement.dm b/code/modules/surgery/organs/organ_movement.dm index 7c6907da863..c39541fb8ef 100644 --- a/code/modules/surgery/organs/organ_movement.dm +++ b/code/modules/surgery/organs/organ_movement.dm @@ -224,9 +224,14 @@ /** * Proc that gets called when the organ is surgically removed by someone, can be used for special effects - * Currently only used so surplus organs can explode when surgically removed. */ /obj/item/organ/proc/on_surgical_removal(mob/living/user, mob/living/carbon/old_owner, target_zone, obj/item/tool) SHOULD_CALL_PARENT(TRUE) SEND_SIGNAL(src, COMSIG_ORGAN_SURGICALLY_REMOVED, user, old_owner, target_zone, tool) RemoveElement(/datum/element/decal/blood) +/** + * Proc that gets called when the organ is surgically inserted by someone. Seem familiar? + */ +/obj/item/organ/proc/on_surgical_insertion(mob/living/user, mob/living/carbon/new_owner, target_zone, obj/item/tool) + SHOULD_CALL_PARENT(TRUE) + SEND_SIGNAL(src, COMSIG_ORGAN_SURGICALLY_INSERTED, user, new_owner, target_zone, tool)