diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 21f80c6f8aa..145effe3dc5 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -11,9 +11,14 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define ALL_CARDINALS (NORTH|SOUTH|EAST|WEST) // for /datum/var/datum_flags -#define DF_USE_TAG (1<<0) -#define DF_VAR_EDITED (1<<1) +#define DF_USE_TAG (1<<0) +#define DF_VAR_EDITED (1<<1) #define DF_ISPROCESSING (1<<2) +/** + * Is this datum capable of sending signals? + * Set when a signal has been registered. + */ +#define DF_SIGNAL_ENABLED (1<<3) //FLAGS BITMASK // scroll down before changing the numbers on these diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 32944483349..b9156b8ba1a 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -85,6 +85,7 @@ DEFINE_BITFIELD(datum_flags, list( "DF_ISPROCESSING" = DF_ISPROCESSING, "DF_VAR_EDITED" = DF_VAR_EDITED, "DF_USE_TAG" = DF_USE_TAG, + "DF_SIGNAL_ENABLED" = DF_SIGNAL_ENABLED, )) DEFINE_BITFIELD(disease_flags, list( diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index e2a1ccc4b44..cada03c4032 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -202,7 +202,7 @@ else // Many other things have registered here lookup[sig_type][src] = TRUE - signal_enabled = TRUE + datum_flags |= DF_SIGNAL_ENABLED /** * Stop listening to a given signal from target @@ -311,14 +311,14 @@ var/target = comp_lookup[sigtype] if(!length(target)) var/datum/C = target - if(!C.signal_enabled) + if(!(C.datum_flags & DF_SIGNAL_ENABLED)) return NONE var/proctype = C.signal_procs[src][sigtype] return NONE | CallAsync(C, proctype, arguments) . = NONE for(var/I in target) var/datum/C = I - if(!C.signal_enabled) + if(!(C.datum_flags & DF_SIGNAL_ENABLED)) continue var/proctype = C.signal_procs[src][sigtype] . |= CallAsync(C, proctype, arguments) diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 62a6d6201ba..20add82b88a 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -36,12 +36,6 @@ var/list/comp_lookup /// Lazy associated list in the structure of `signals:proctype` that are run when the datum receives that signal var/list/list/datum/callback/signal_procs - /** - * Is this datum capable of sending signals? - * - * Set to true when a signal has been registered - */ - var/signal_enabled = FALSE /// Datum level flags var/datum_flags = NONE @@ -106,7 +100,7 @@ qdel(timer) //BEGIN: ECS SHIT - signal_enabled = FALSE + datum_flags &= ~DF_SIGNAL_ENABLED var/list/dc = datum_components if(dc) diff --git a/code/game/gamemodes/clown_ops/clown_weapons.dm b/code/game/gamemodes/clown_ops/clown_weapons.dm index ec73e9d3620..8426407a1bf 100644 --- a/code/game/gamemodes/clown_ops/clown_weapons.dm +++ b/code/game/gamemodes/clown_ops/clown_weapons.dm @@ -75,11 +75,18 @@ light_color = COLOR_YELLOW var/next_trombone_allowed = 0 -/obj/item/melee/transforming/energy/sword/bananium/ComponentInitialize() +/obj/item/melee/transforming/energy/sword/bananium/Initialize() . = ..() - AddComponent(/datum/component/slippery, 60, GALOSHES_DONT_HELP) - var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery) - slipper.signal_enabled = active + adjust_slipperiness() + +/* Adds or removes a slippery component, depending on whether the sword + * is active or not. + */ +/obj/item/melee/transforming/energy/sword/proc/adjust_slipperiness() + if(active) + AddComponent(/datum/component/slippery, 60, GALOSHES_DONT_HELP) + else + qdel(GetComponent(/datum/component/slippery)) /obj/item/melee/transforming/energy/sword/bananium/attack(mob/living/M, mob/living/user) ..() @@ -102,9 +109,8 @@ return ..() /obj/item/melee/transforming/energy/sword/bananium/transform_weapon(mob/living/user, supress_message_text) - ..() - var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery) - slipper.signal_enabled = active + . = ..() + adjust_slipperiness() /obj/item/melee/transforming/energy/sword/bananium/ignition_effect(atom/A, mob/user) return "" @@ -132,16 +138,22 @@ on_throwforce = 0 on_throw_speed = 1 -/obj/item/shield/energy/bananium/ComponentInitialize() +/obj/item/shield/energy/bananium/Initialize() . = ..() - AddComponent(/datum/component/slippery, 60, GALOSHES_DONT_HELP) - var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery) - slipper.signal_enabled = active + adjust_slipperiness() + +/* Adds or removes a slippery component, depending on whether the shield + * is active or not. + */ +/obj/item/shield/energy/bananium/proc/adjust_slipperiness() + if(active) + AddComponent(/datum/component/slippery, 60, GALOSHES_DONT_HELP) + else + qdel(GetComponent(/datum/component/slippery)) /obj/item/shield/energy/bananium/attack_self(mob/living/carbon/human/user) - ..() - var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery) - slipper.signal_enabled = active + . = ..() + adjust_slipperiness() /obj/item/shield/energy/bananium/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, gentle = FALSE, quickstart = TRUE) if(active)