diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index a12483f647..3a593a8d14 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -109,7 +109,7 @@ P.datum_components = null parent = null -/datum/component/proc/RegisterSignal(sig_type_or_types, proc_on_self, override = FALSE) +/datum/component/proc/RegisterSignal(sig_type_or_types, proc_or_callback, override = FALSE) if(QDELETED(src)) return var/list/procs = signal_procs @@ -123,8 +123,10 @@ . = procs[sig_type] if(.) stack_trace("[sig_type] overridden. Use override = TRUE to suppress this warning") - - procs[sig_type] = CALLBACK(src, proc_on_self) + + if(!istype(proc_or_callback, /datum/callback)) //if it wasnt a callback before, it is now + proc_or_callback = CALLBACK(src, proc_or_callback) + procs[sig_type] = proc_or_callback /datum/component/proc/InheritComponent(datum/component/C, i_am_original) return diff --git a/code/datums/components/signal_redirect.dm b/code/datums/components/signal_redirect.dm new file mode 100644 index 0000000000..cabc946517 --- /dev/null +++ b/code/datums/components/signal_redirect.dm @@ -0,0 +1,9 @@ +/datum/component/redirect + dupe_mode = COMPONENT_DUPE_ALLOWED + +/datum/component/redirect/Initialize(list/signals, _callback) + //It's not our job to verify the right signals are registered here, just do it. + if(!signals || !signals.len || !_callback) + . = COMPONENT_INCOMPATIBLE + CRASH("A redirection component was initialized with incorrect args.") + RegisterSignal(signals, _callback) \ No newline at end of file diff --git a/tgstation.dme b/tgstation.dme index cacf12c922..5e0cabca37 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -322,6 +322,7 @@ #include "code\datums\components\paintable.dm" #include "code\datums\components\rad_insulation.dm" #include "code\datums\components\radioactive.dm" +#include "code\datums\components\signal_redirect.dm" #include "code\datums\components\slippery.dm" #include "code\datums\components\spooky.dm" #include "code\datums\components\squeek.dm"