diff --git a/_maps/RandomRuins/SpaceRuins/bus.dmm b/_maps/RandomRuins/SpaceRuins/bus.dmm index be05a8d1d6..fe624c19bf 100644 --- a/_maps/RandomRuins/SpaceRuins/bus.dmm +++ b/_maps/RandomRuins/SpaceRuins/bus.dmm @@ -334,6 +334,16 @@ /obj/item/stack/sheet/metal/fifty, /turf/open/floor/plating/asteroid/airless, /area/ruin/unpowered/no_grav) +"XA" = ( +/obj/structure/fluff/bus/passable/seat{ + icon_state = "backseat" + }, +/obj/effect/decal/cleanable/dirt, +/obj/item/toy/plush/awakenedplushie, +/turf/open/floor/plasteel/airless/dark{ + icon_state = "bus" + }, +/area/ruin/unpowered/no_grav) (1,1,1) = {" aa @@ -484,7 +494,7 @@ ab ae ad aj -am +XA az aK ad diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index 1cf27a8c68..cade3d1ef3 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -1,3 +1,10 @@ +<<<<<<< HEAD +======= +#define SEND_SIGNAL(target, sigtype, arguments...) ( !target.datum_components ? NONE : target._SendSignal(sigtype, list(##arguments)) ) + +#define SEND_GLOBAL_SIGNAL(sigtype, arguments...) ( !SSdcs.comp_lookup[sigtype] ? NONE : SSdcs._SendGlobalSignal(sigtype, list(##arguments)) ) + +>>>>>>> 84a85a5... Merge pull request #38574 from ninjanomnom/glob-signals //shorthand #define GET_COMPONENT_FROM(varname, path, target) var##path/##varname = ##target.GetComponent(##path) #define GET_COMPONENT(varname, path) GET_COMPONENT_FROM(varname, path, src) @@ -14,6 +21,14 @@ // All signals. Format: // When the signal is called: (signal arguments) +// global signals +// These are signals which can be listened to by any component on any parent +// GLOBAL SIGNALS MUST START WITH "!" +#define COMSIG_GLOB_NEW_Z "!new_z" //from base of datum/controller/subsystem/mapping/proc/add_new_zlevel(): (list/args) +#define COMSIG_GLOB_VAR_EDIT "!var_edit" //called after a successful var edit somewhere in the world: (list/args) + +////////////////////////////////////////////////////////////////// + // /datum signals #define COMSIG_COMPONENT_ADDED "component_added" //when a component is added to a datum: (/datum/component) #define COMSIG_COMPONENT_REMOVING "component_removing" //before a component is removed from a datum because of RemoveComponent: (/datum/component) diff --git a/code/controllers/subsystem/dcs.dm b/code/controllers/subsystem/dcs.dm new file mode 100644 index 0000000000..3eed510adc --- /dev/null +++ b/code/controllers/subsystem/dcs.dm @@ -0,0 +1,35 @@ +SUBSYSTEM_DEF(dcs) + name = "Datum Component System" + flags = SS_NO_INIT | SS_NO_FIRE + + var/list/comp_lookup = list() // A signal:list(components) assoc list + +/datum/controller/subsystem/dcs/proc/_SendGlobalSignal(sigtype, list/arguments) + . = NONE + for(var/i in comp_lookup[sigtype]) + var/datum/component/comp = i + if(!comp.enabled) + continue + var/datum/callback/CB = comp.signal_procs[sigtype] + if(!CB) + continue // Should we error from this? + . |= CB.InvokeAsync(arglist(arguments)) + +/datum/controller/subsystem/dcs/proc/RegisterSignal(datum/component/comp, sigtype) + if(!comp_lookup[sigtype]) + comp_lookup[sigtype] = list() + + comp_lookup[sigtype][comp] = TRUE + +/datum/controller/subsystem/dcs/proc/UnregisterSignal(datum/component/comp, list/sigtypes) + if(!length(sigtypes)) + sigtypes = list(sigtypes) + for(var/sigtype in sigtypes) + switch(length(comp_lookup[sigtype])) + if(1) + comp_lookup -= sigtype + if(2 to INFINITY) + comp_lookup[sigtype] -= comp + +/datum/controller/subsystem/dcs/Recover() + comp_lookup = SSdcs.comp_lookup diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index bfd6f5a5de..1769a26d18 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -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 diff --git a/code/datums/components/edit_complainer.dm b/code/datums/components/edit_complainer.dm new file mode 100644 index 0000000000..c0a875d457 --- /dev/null +++ b/code/datums/components/edit_complainer.dm @@ -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)) diff --git a/code/game/objects/items/plushes.dm b/code/game/objects/items/plushes.dm index 0d993da41b..eec6c00834 100644 --- a/code/game/objects/items/plushes.dm +++ b/code/game/objects/items/plushes.dm @@ -510,3 +510,13 @@ attack_verb = list("blorbled", "slimed", "absorbed") squeak_override = list('sound/effects/blobattack.ogg' = 1) gender = FEMALE //given all the jokes and drawings, I'm not sure the xenobiologists would make a slimeboy + +/obj/item/toy/plush/awakenedplushie + name = "awakened plushie" + desc = "An ancient plushie that has grown enlightened to the true nature of reality." + icon_state = "plushie_awake" + item_state = "plushie_awake" + +/obj/item/toy/plush/awakenedplushie/ComponentInitialize() + . = ..() + AddComponent(/datum/component/edit_complainer) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 0c41ae8fd2..405595d1de 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -629,6 +629,7 @@ GLOBAL_PROTECT(VVpixelmovement) if (O.vv_edit_var(variable, var_new) == FALSE) to_chat(src, "Your edit was rejected by the object.") return + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_VAR_EDIT, args) log_world("### VarEdit by [key_name(src)]: [O.type] [variable]=[var_value] => [var_new]") log_admin("[key_name(src)] modified [original_name]'s [variable] from [html_encode("[var_value]")] to [html_encode("[var_new]")]") var/msg = "[key_name_admin(src)] modified [original_name]'s [variable] from [var_value] to [var_new]" diff --git a/code/modules/mapping/space_management/zlevel_manager.dm b/code/modules/mapping/space_management/zlevel_manager.dm index a0d84c55dd..6129c5fd2b 100644 --- a/code/modules/mapping/space_management/zlevel_manager.dm +++ b/code/modules/mapping/space_management/zlevel_manager.dm @@ -17,6 +17,7 @@ z_list += S /datum/controller/subsystem/mapping/proc/add_new_zlevel(name, traits = list(), z_type = /datum/space_level) + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_NEW_Z, args) var/new_z = z_list.len + 1 if (world.maxz < new_z) world.incrementMaxZ() diff --git a/icons/obj/plushes.dmi b/icons/obj/plushes.dmi index f0eb817549..0bf89ab744 100644 Binary files a/icons/obj/plushes.dmi and b/icons/obj/plushes.dmi differ diff --git a/tgstation.dme b/tgstation.dme index 39ecf1a066..115fe25b8d 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -209,6 +209,7 @@ #include "code\controllers\subsystem\blackbox.dm" #include "code\controllers\subsystem\communications.dm" #include "code\controllers\subsystem\dbcore.dm" +#include "code\controllers\subsystem\dcs.dm" #include "code\controllers\subsystem\disease.dm" #include "code\controllers\subsystem\events.dm" #include "code\controllers\subsystem\fire_burning.dm" @@ -328,6 +329,7 @@ #include "code\datums\components\decal.dm" #include "code\datums\components\earhealing.dm" #include "code\datums\components\earprotection.dm" +#include "code\datums\components\edit_complainer.dm" #include "code\datums\components\empprotection.dm" #include "code\datums\components\forensics.dm" #include "code\datums\components\infective.dm"