Merge pull request #7195 from Citadel-Station-13/upstream-merge-38574

[MIRROR] Global component signals
This commit is contained in:
LetterJay
2018-06-24 18:20:17 -05:00
committed by GitHub
10 changed files with 98 additions and 1 deletions
+4
View File
@@ -58,6 +58,7 @@
if(!silent)
P.SendSignal(COMSIG_COMPONENT_REMOVING, src)
parent = null
SSdcs.UnregisterSignal(src, signal_procs)
LAZYCLEARLIST(signal_procs)
return ..()
@@ -93,6 +94,9 @@
if(!override && procs[sig_type])
stack_trace("[sig_type] overridden. Use override = TRUE to suppress this warning")
if(sig_type[1] == "!")
SSdcs.RegisterSignal(src, sig_type)
procs[sig_type] = proc_or_callback
enabled = TRUE
+23
View File
@@ -0,0 +1,23 @@
// This is just a bit of fun while making an example for global signal
/datum/component/edit_complainer
var/list/say_lines
/datum/component/edit_complainer/Initialize(list/text)
if(!ismovableatom(parent))
return COMPONENT_INCOMPATIBLE
var/static/list/default_lines = list(
"CentCom's profligacy frays another thread.",
"Another tug at the weave.",
"Who knows when the stresses will finally shatter the form?",
"Even now a light shines through the cracks.",
"CentCom once more twists knowledge beyond its authority.",
"There is an uncertain air in the mansus.",
)
say_lines = text || default_lines
RegisterSignal(COMSIG_GLOB_VAR_EDIT, .proc/var_edit_react)
/datum/component/edit_complainer/proc/var_edit_react(list/arguments)
var/atom/movable/master = parent
master.say(pick(say_lines))