From b9f2c4052936054ba6f9484b5f9e3d1665edfb27 Mon Sep 17 00:00:00 2001 From: Evildragon Date: Wed, 10 Apr 2024 13:31:36 +0900 Subject: [PATCH 1/6] Signal fixes --- code/__DEFINES/dcs/helpers.dm | 8 ++++++++ code/_onclick/hud/holoparasite.dm | 2 +- code/datums/ai/monkey/monkey_behaviors.dm | 2 +- code/datums/components/COMPONENT_TEMPLATE.md | 13 ++++++++++--- code/datums/components/area_sound_manager.dm | 4 ++-- code/datums/components/footstep.dm | 2 +- code/datums/components/plumbing/_plumbing.dm | 2 +- code/datums/components/tether.dm | 2 +- code/datums/components/waddling.dm | 4 ++-- code/datums/components/wearertargeting.dm | 2 +- code/datums/elements/weather_listener.dm | 4 ++-- .../antagonists/heretic/knowledge/void_lore.dm | 2 +- .../antagonists/nukeop/equipment/borgchameleon.dm | 2 +- .../holoparasite/abilities/major/explosive.dm | 2 +- code/modules/mob/living/silicon/robot/robot.dm | 4 ++-- .../living/simple_animal/friendly/drone/_drone.dm | 4 ++-- code/modules/reagents/reagent_containers/spray.dm | 4 ++-- code/modules/surgery/organs/augments_internal.dm | 2 +- 18 files changed, 40 insertions(+), 25 deletions(-) diff --git a/code/__DEFINES/dcs/helpers.dm b/code/__DEFINES/dcs/helpers.dm index 1d4ecacc86b8b..cae5f26462970 100644 --- a/code/__DEFINES/dcs/helpers.dm +++ b/code/__DEFINES/dcs/helpers.dm @@ -6,6 +6,14 @@ #define SEND_GLOBAL_SIGNAL(sigtype, arguments...) ( SEND_SIGNAL(SSdcs, sigtype, ##arguments) ) +/// Use when 2nd parameter dynamically can be null, non-list or listed signals +/// It won't RegisterSignal if signal is null +#define RegisterSignalsDynamic(parent, signals, args...) \ + if(!isnull(signals)) {\ + islist(signals) \ + ? RegisterSignals(parent, signals, ##args) \ + : RegisterSignal(parent, signals, ##args) } + /// A wrapper for _AddElement that allows us to pretend we're using normal named arguments #define AddElement(arguments...) _AddElement(list(##arguments)) /// A wrapper for _RemoveElement that allows us to pretend we're using normal named arguments diff --git a/code/_onclick/hud/holoparasite.dm b/code/_onclick/hud/holoparasite.dm index 6189c503a8042..e339109028978 100644 --- a/code/_onclick/hud/holoparasite.dm +++ b/code/_onclick/hud/holoparasite.dm @@ -136,7 +136,7 @@ LAZYADD(accent_overlays, overlay) RegisterSignal(owner, COMSIG_HOLOPARA_SET_ACCENT_COLOR, PROC_REF(on_set_accent_color)) RegisterSignal(owner, COMSIG_MOB_LOGIN, PROC_REF(on_login)) - RegisterSignal(owner, list(COMSIG_HOLOPARA_POST_MANIFEST, COMSIG_HOLOPARA_RECALL, COMSIG_MOVABLE_MOVED), PROC_REF(_update_appearance)) + RegisterSignals(owner, list(COMSIG_HOLOPARA_POST_MANIFEST, COMSIG_HOLOPARA_RECALL, COMSIG_MOVABLE_MOVED), PROC_REF(_update_appearance)) /atom/movable/screen/holoparasite/Destroy() stop_timer() diff --git a/code/datums/ai/monkey/monkey_behaviors.dm b/code/datums/ai/monkey/monkey_behaviors.dm index 01303801b7292..b95a45e170403 100644 --- a/code/datums/ai/monkey/monkey_behaviors.dm +++ b/code/datums/ai/monkey/monkey_behaviors.dm @@ -13,7 +13,7 @@ item_blacklist[target] = TRUE if(istype(controller, /datum/ai_controller/monkey)) //What the fuck - controller.RegisterSignal(target, COMSIG_PARENT_QDELETING, /datum/ai_controller/monkey/proc/target_del) + controller.RegisterSignal(target, COMSIG_PARENT_QDELETING, TYPE_PROC_REF(/datum/ai_controller/monkey, target_del)) controller.blackboard[BB_MONKEY_PICKUPTARGET] = null diff --git a/code/datums/components/COMPONENT_TEMPLATE.md b/code/datums/components/COMPONENT_TEMPLATE.md index 223347578e226..805c093808a7d 100644 --- a/code/datums/components/COMPONENT_TEMPLATE.md +++ b/code/datums/components/COMPONENT_TEMPLATE.md @@ -16,12 +16,19 @@ See _component.dm for detailed explanations send_to_playing_players(myargtwo) /datum/component/mycomponent/RegisterWithParent() - RegisterSignal(parent, COMSIG_NOT_REAL, ./proc/signalproc) // RegisterSignal can take a signal name by itself, - RegisterSignal(parent, list(COMSIG_NOT_REAL_EITHER, COMSIG_ALMOST_REAL), ./proc/otherproc) // or a list of them to assign to the same proc + RegisterSignal(parent, COMSIG_NOT_REAL, PROC_REF(signalproc)) + // RegisterSignal can take a signal name by itself, + RegisterSignals(parent, list(COMSIG_NOT_REAL_EITHER, COMSIG_ALMOST_REAL), PROC_REF(otherproc)) + // or a list of them to assign to the same proc + //! if signals are a list, use 'RegisterSignals' with extra s. + //! if it's a single signal, use 'RegisterSignal' without s + RegisterSignalsDynamic(parent, a_variable_list_or_not, PROC_REF(otherproc)) + // If your signals can be single or list, use this RegisterSignalsDynamic /datum/component/mycomponent/UnregisterFromParent() UnregisterSignal(parent, COMSIG_NOT_REAL) // UnregisterSignal has similar behavior - UnregisterSignal(parent, list( // But you can just include all registered signals in one call + UnregisterSignal(parent, list( + /* But you can just include all registered signals in one call */ COMSIG_NOT_REAL, COMSIG_NOT_REAL_EITHER, COMSIG_ALMOST_REAL, diff --git a/code/datums/components/area_sound_manager.dm b/code/datums/components/area_sound_manager.dm index 72df0e0070d4d..1b6d185b70672 100644 --- a/code/datums/components/area_sound_manager.dm +++ b/code/datums/components/area_sound_manager.dm @@ -18,8 +18,8 @@ RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(react_to_move)) RegisterSignal(parent, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(react_to_z_move)) - RegisterSignal(parent, change_on, PROC_REF(handle_change)) - RegisterSignal(parent, remove_on, PROC_REF(handle_removal)) + RegisterSignalsDynamic(parent, change_on, PROC_REF(handle_change)) + RegisterSignalsDynamic(parent, remove_on, PROC_REF(handle_removal)) /datum/component/area_sound_manager/Destroy(force, silent) QDEL_NULL(our_loop) diff --git a/code/datums/components/footstep.dm b/code/datums/components/footstep.dm index cf5b13e60e719..c445a11cb758e 100644 --- a/code/datums/components/footstep.dm +++ b/code/datums/components/footstep.dm @@ -8,7 +8,7 @@ return COMPONENT_INCOMPATIBLE volume = volume_ e_range = e_range_ - RegisterSignals(parent, list(COMSIG_MOVABLE_MOVED), PROC_REF(play_footstep)) + RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(play_footstep)) /datum/component/footstep/proc/play_footstep() SIGNAL_HANDLER diff --git a/code/datums/components/plumbing/_plumbing.dm b/code/datums/components/plumbing/_plumbing.dm index 504db6baf703e..c5cf5f6156cb7 100644 --- a/code/datums/components/plumbing/_plumbing.dm +++ b/code/datums/components/plumbing/_plumbing.dm @@ -28,7 +28,7 @@ turn_connects = _turn_connects RegisterSignals(parent, list(COMSIG_MOVABLE_MOVED,COMSIG_PARENT_PREQDELETED), PROC_REF(disable)) - RegisterSignals(parent, list(COMSIG_OBJ_DEFAULT_UNFASTEN_WRENCH), PROC_REF(toggle_active)) + RegisterSignal(parent, COMSIG_OBJ_DEFAULT_UNFASTEN_WRENCH, PROC_REF(toggle_active)) RegisterSignal(parent, COMSIG_OBJ_HIDE, PROC_REF(hide)) RegisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS, PROC_REF(create_overlays)) //create overlays also gets called after init (no idea by what it just happens) diff --git a/code/datums/components/tether.dm b/code/datums/components/tether.dm index c6d9ac02947c3..5549c71fe4c27 100644 --- a/code/datums/components/tether.dm +++ b/code/datums/components/tether.dm @@ -14,7 +14,7 @@ src.tether_name = initial(tmp.name) else src.tether_name = tether_name - RegisterSignal(parent, list(COMSIG_MOVABLE_PRE_MOVE), PROC_REF(checkTether)) + RegisterSignal(parent, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(checkTether)) /datum/component/tether/proc/checkTether(mob/mover, newloc) SIGNAL_HANDLER diff --git a/code/datums/components/waddling.dm b/code/datums/components/waddling.dm index 22c6e38d7da60..e2df2656ad730 100644 --- a/code/datums/components/waddling.dm +++ b/code/datums/components/waddling.dm @@ -6,9 +6,9 @@ if(!ismovable(parent)) return COMPONENT_INCOMPATIBLE if(isliving(parent)) - RegisterSignals(parent, list(COMSIG_MOVABLE_MOVED), PROC_REF(LivingWaddle)) + RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(LivingWaddle)) else - RegisterSignals(parent, list(COMSIG_MOVABLE_MOVED), PROC_REF(Waddle)) + RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(Waddle)) /datum/component/waddling/proc/LivingWaddle() SIGNAL_HANDLER diff --git a/code/datums/components/wearertargeting.dm b/code/datums/components/wearertargeting.dm index 0d94e33c3d769..85af50d9510b2 100644 --- a/code/datums/components/wearertargeting.dm +++ b/code/datums/components/wearertargeting.dm @@ -16,7 +16,7 @@ SIGNAL_HANDLER if((slot in valid_slots) && istype(equipper, mobtype)) - RegisterSignal(equipper, signals, proctype, TRUE) + RegisterSignalsDynamic(equipper, signals, proctype, TRUE) else UnregisterSignal(equipper, signals) diff --git a/code/datums/elements/weather_listener.dm b/code/datums/elements/weather_listener.dm index 8281fa181ae1e..722fa677ed9e5 100644 --- a/code/datums/elements/weather_listener.dm +++ b/code/datums/elements/weather_listener.dm @@ -36,8 +36,8 @@ var/list/fitting_z_levels = SSmapping.levels_by_trait(weather_trait) if(!(new_z in fitting_z_levels)) return - var/datum/component/our_comp = source.AddComponent(/datum/component/area_sound_manager, playlist, list(), COMSIG_MOB_LOGOUT, fitting_z_levels) - our_comp.RegisterSignals(SSdcs, sound_change_signals, /datum/component/area_sound_manager/proc/handle_change) + var/datum/component/our_comp = source.AddComponent(/datum/component/area_sound_manager, playlist, null, COMSIG_MOB_LOGOUT, fitting_z_levels) + our_comp.RegisterSignals(SSdcs, sound_change_signals, TYPE_PROC_REF(/datum/component/area_sound_manager, handle_change)) /datum/element/weather_listener/proc/handle_logout(datum/source) SIGNAL_HANDLER diff --git a/code/modules/antagonists/heretic/knowledge/void_lore.dm b/code/modules/antagonists/heretic/knowledge/void_lore.dm index d104d17e9920a..06c0852573795 100644 --- a/code/modules/antagonists/heretic/knowledge/void_lore.dm +++ b/code/modules/antagonists/heretic/knowledge/void_lore.dm @@ -266,7 +266,7 @@ /datum/heretic_knowledge/final/void_final/on_lose(mob/user) on_death() // Losing is pretty much dying. I think - RegisterSignal(user, list(COMSIG_LIVING_LIFE, COMSIG_MOB_DEATH)) + RegisterSignals(user, list(COMSIG_LIVING_LIFE, COMSIG_MOB_DEATH)) /** * Signal proc for [COMSIG_LIVING_LIFE]. diff --git a/code/modules/antagonists/nukeop/equipment/borgchameleon.dm b/code/modules/antagonists/nukeop/equipment/borgchameleon.dm index 207e1c5f2eb8d..95d2a93d716fc 100644 --- a/code/modules/antagonists/nukeop/equipment/borgchameleon.dm +++ b/code/modules/antagonists/nukeop/equipment/borgchameleon.dm @@ -96,7 +96,7 @@ return if(listeningTo) UnregisterSignal(listeningTo, signalCache) - RegisterSignal(user, signalCache, PROC_REF(disrupt)) + RegisterSignals(user, signalCache, PROC_REF(disrupt)) listeningTo = user /obj/item/borg_chameleon/proc/deactivate(mob/living/silicon/robot/user) diff --git a/code/modules/holoparasite/abilities/major/explosive.dm b/code/modules/holoparasite/abilities/major/explosive.dm index f5e72dc6094d0..447fdc4ac87a2 100644 --- a/code/modules/holoparasite/abilities/major/explosive.dm +++ b/code/modules/holoparasite/abilities/major/explosive.dm @@ -176,7 +176,7 @@ arm_hud.begin_timer(arming_cooldown_length) RegisterSignal(target, COMSIG_PARENT_EXAMINE, PROC_REF(display_examine)) RegisterSignal(target, COMSIG_PARENT_PREQDELETED, PROC_REF(on_bomb_destroyed)) - RegisterSignal(target, boom_signals, PROC_REF(kaboom)) + RegisterSignals(target, boom_signals, PROC_REF(kaboom)) bomb_disarm_timers[target] = addtimer(CALLBACK(src, PROC_REF(disable), target), master_stats.potential * 18 * 10, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE) bombs += target diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index f5c949a888a37..e96e37ba32a03 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -182,8 +182,8 @@ alert_control = new(src, list(ALARM_ATMOS, ALARM_FIRE, ALARM_POWER, ALARM_CAMERA, ALARM_BURGLAR, ALARM_MOTION), list(z)) RegisterSignal(alert_control.listener, COMSIG_ALARM_TRIGGERED, PROC_REF(alarm_triggered)) RegisterSignal(alert_control.listener, COMSIG_ALARM_CLEARED, PROC_REF(alarm_cleared)) - alert_control.listener.RegisterSignal(src, COMSIG_LIVING_DEATH, /datum/alarm_listener/proc/prevent_alarm_changes) - alert_control.listener.RegisterSignal(src, COMSIG_LIVING_REVIVE, /datum/alarm_listener/proc/allow_alarm_changes) + alert_control.listener.RegisterSignal(src, COMSIG_LIVING_DEATH, TYPE_PROC_REF(/datum/alarm_listener, prevent_alarm_changes)) + alert_control.listener.RegisterSignal(src, COMSIG_LIVING_REVIVE, TYPE_PROC_REF(/datum/alarm_listener, allow_alarm_changes)) RegisterSignal(src, COMSIG_ATOM_ON_EMAG, PROC_REF(on_emag)) RegisterSignal(src, COMSIG_ATOM_SHOULD_EMAG, PROC_REF(should_emag)) diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm index 664d8906ab151..bfbc47a96fde7 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -106,8 +106,8 @@ listener = new(list(ALARM_ATMOS, ALARM_FIRE, ALARM_POWER), list(z)) RegisterSignal(listener, COMSIG_ALARM_TRIGGERED, PROC_REF(alarm_triggered)) RegisterSignal(listener, COMSIG_ALARM_CLEARED, PROC_REF(alarm_cleared)) - listener.RegisterSignal(src, COMSIG_LIVING_DEATH, /datum/alarm_listener/proc/prevent_alarm_changes) - listener.RegisterSignal(src, COMSIG_LIVING_REVIVE, /datum/alarm_listener/proc/allow_alarm_changes) + listener.RegisterSignal(src, COMSIG_LIVING_DEATH, TYPE_PROC_REF(/datum/alarm_listener, prevent_alarm_changes)) + listener.RegisterSignal(src, COMSIG_LIVING_REVIVE, TYPE_PROC_REF(/datum/alarm_listener, allow_alarm_changes)) /mob/living/simple_animal/drone/med_hud_set_health() var/image/holder = hud_list[DIAG_HUD] diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index f04b868582fbc..d476d5abb1c45 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -79,8 +79,8 @@ D.sprayer = src D.lifetime = puff_reagent_left D.stream = stream_mode - D.RegisterSignal(our_loop, COMSIG_PARENT_QDELETING, /obj/effect/decal/chempuff/proc/loop_ended) - D.RegisterSignal(our_loop, COMSIG_MOVELOOP_POSTPROCESS, /obj/effect/decal/chempuff/proc/check_move) + D.RegisterSignal(our_loop, COMSIG_PARENT_QDELETING, TYPE_PROC_REF(/obj/effect/decal/chempuff, loop_ended)) + D.RegisterSignal(our_loop, COMSIG_MOVELOOP_POSTPROCESS, TYPE_PROC_REF(/obj/effect/decal/chempuff, check_move)) /obj/item/reagent_containers/spray/attack_self(mob/user) stream_mode = !stream_mode diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm index 5b63391109655..11e92180f7157 100644 --- a/code/modules/surgery/organs/augments_internal.dm +++ b/code/modules/surgery/organs/augments_internal.dm @@ -114,7 +114,7 @@ /obj/item/organ/cyberimp/brain/anti_stun/Insert() . = ..() - RegisterSignal(owner, signalCache, PROC_REF(on_signal)) + RegisterSignals(owner, signalCache, PROC_REF(on_signal)) /obj/item/organ/cyberimp/brain/anti_stun/proc/on_signal(datum/source, amount) SIGNAL_HANDLER From 79d7686dc457f5d48dd8ffb2083262aa5a59dd4a Mon Sep 17 00:00:00 2001 From: Evildragon Date: Sat, 13 Apr 2024 11:21:49 +0900 Subject: [PATCH 2/6] Removes dynamic macro --- code/datums/components/COMPONENT_TEMPLATE.md | 2 -- code/datums/components/area_sound_manager.dm | 12 ++++++++++-- code/datums/components/wearertargeting.dm | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/code/datums/components/COMPONENT_TEMPLATE.md b/code/datums/components/COMPONENT_TEMPLATE.md index 805c093808a7d..b76a4e58e4aa1 100644 --- a/code/datums/components/COMPONENT_TEMPLATE.md +++ b/code/datums/components/COMPONENT_TEMPLATE.md @@ -22,8 +22,6 @@ See _component.dm for detailed explanations // or a list of them to assign to the same proc //! if signals are a list, use 'RegisterSignals' with extra s. //! if it's a single signal, use 'RegisterSignal' without s - RegisterSignalsDynamic(parent, a_variable_list_or_not, PROC_REF(otherproc)) - // If your signals can be single or list, use this RegisterSignalsDynamic /datum/component/mycomponent/UnregisterFromParent() UnregisterSignal(parent, COMSIG_NOT_REAL) // UnregisterSignal has similar behavior diff --git a/code/datums/components/area_sound_manager.dm b/code/datums/components/area_sound_manager.dm index 1b6d185b70672..d0c27025e30ee 100644 --- a/code/datums/components/area_sound_manager.dm +++ b/code/datums/components/area_sound_manager.dm @@ -18,8 +18,16 @@ RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(react_to_move)) RegisterSignal(parent, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(react_to_z_move)) - RegisterSignalsDynamic(parent, change_on, PROC_REF(handle_change)) - RegisterSignalsDynamic(parent, remove_on, PROC_REF(handle_removal)) + // change on can be a list of signals + if(islist(change_on)) + RegisterSignals(parent, change_on, PROC_REF(handle_change)) + else if(!isnull(change_on)) + RegisterSignal(parent, change_on, PROC_REF(handle_change)) + // remove on can be a list of signals + if(islist(remove_on)) + RegisterSignals(parent, remove_on, PROC_REF(handle_removal)) + else if(!isnull(remove_on)) + RegisterSignal(parent, remove_on, PROC_REF(handle_removal)) /datum/component/area_sound_manager/Destroy(force, silent) QDEL_NULL(our_loop) diff --git a/code/datums/components/wearertargeting.dm b/code/datums/components/wearertargeting.dm index 85af50d9510b2..2ff91638f044a 100644 --- a/code/datums/components/wearertargeting.dm +++ b/code/datums/components/wearertargeting.dm @@ -16,7 +16,10 @@ SIGNAL_HANDLER if((slot in valid_slots) && istype(equipper, mobtype)) - RegisterSignalsDynamic(equipper, signals, proctype, TRUE) + if(islist(signals)) + RegisterSignals(equipper, signals, proctype, TRUE) + else if(!isnull(signals)) + RegisterSignal(equipper, signals, proctype, TRUE) else UnregisterSignal(equipper, signals) From fd684aa8229d752e870a9e8939eb261dd99a76ba Mon Sep 17 00:00:00 2001 From: Evildragon Date: Sat, 13 Apr 2024 11:23:00 +0900 Subject: [PATCH 3/6] I didn't save this.. Removes dynamic macro. --- code/__DEFINES/dcs/helpers.dm | 8 -------- 1 file changed, 8 deletions(-) diff --git a/code/__DEFINES/dcs/helpers.dm b/code/__DEFINES/dcs/helpers.dm index cae5f26462970..1d4ecacc86b8b 100644 --- a/code/__DEFINES/dcs/helpers.dm +++ b/code/__DEFINES/dcs/helpers.dm @@ -6,14 +6,6 @@ #define SEND_GLOBAL_SIGNAL(sigtype, arguments...) ( SEND_SIGNAL(SSdcs, sigtype, ##arguments) ) -/// Use when 2nd parameter dynamically can be null, non-list or listed signals -/// It won't RegisterSignal if signal is null -#define RegisterSignalsDynamic(parent, signals, args...) \ - if(!isnull(signals)) {\ - islist(signals) \ - ? RegisterSignals(parent, signals, ##args) \ - : RegisterSignal(parent, signals, ##args) } - /// A wrapper for _AddElement that allows us to pretend we're using normal named arguments #define AddElement(arguments...) _AddElement(list(##arguments)) /// A wrapper for _RemoveElement that allows us to pretend we're using normal named arguments From 5bfa0ebf5d6900c2d6949e83a19d6551e6cec9ad Mon Sep 17 00:00:00 2001 From: EvilDragonfiend <87972842+EvilDragonfiend@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:58:46 +0900 Subject: [PATCH 4/6] Update COMPONENT_TEMPLATE.md --- code/datums/components/COMPONENT_TEMPLATE.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/code/datums/components/COMPONENT_TEMPLATE.md b/code/datums/components/COMPONENT_TEMPLATE.md index b76a4e58e4aa1..fdbe9f9e19f2f 100644 --- a/code/datums/components/COMPONENT_TEMPLATE.md +++ b/code/datums/components/COMPONENT_TEMPLATE.md @@ -16,17 +16,20 @@ See _component.dm for detailed explanations send_to_playing_players(myargtwo) /datum/component/mycomponent/RegisterWithParent() + // RegisterSignal can take a signal name by itself, RegisterSignal(parent, COMSIG_NOT_REAL, PROC_REF(signalproc)) - // RegisterSignal can take a signal name by itself, + + // or a list of them to assign to the same proc + //! if signals are a list, use 'RegisterSignals' with extra s. + //! if it's a single signal, use 'RegisterSignal' without s RegisterSignals(parent, list(COMSIG_NOT_REAL_EITHER, COMSIG_ALMOST_REAL), PROC_REF(otherproc)) - // or a list of them to assign to the same proc - //! if signals are a list, use 'RegisterSignals' with extra s. - //! if it's a single signal, use 'RegisterSignal' without s /datum/component/mycomponent/UnregisterFromParent() - UnregisterSignal(parent, COMSIG_NOT_REAL) // UnregisterSignal has similar behavior + // UnregisterSignal has similar behavior + UnregisterSignal(parent, COMSIG_NOT_REAL) + + // But you can just include all registered signals in one call UnregisterSignal(parent, list( - /* But you can just include all registered signals in one call */ COMSIG_NOT_REAL, COMSIG_NOT_REAL_EITHER, COMSIG_ALMOST_REAL, From 48834166fb6aa23232538f06bf8858608d47015c Mon Sep 17 00:00:00 2001 From: EvilDragonfiend <87972842+EvilDragonfiend@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:59:23 +0900 Subject: [PATCH 5/6] nitpick --- code/datums/components/COMPONENT_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/COMPONENT_TEMPLATE.md b/code/datums/components/COMPONENT_TEMPLATE.md index fdbe9f9e19f2f..ffb5267f93f86 100644 --- a/code/datums/components/COMPONENT_TEMPLATE.md +++ b/code/datums/components/COMPONENT_TEMPLATE.md @@ -16,7 +16,7 @@ See _component.dm for detailed explanations send_to_playing_players(myargtwo) /datum/component/mycomponent/RegisterWithParent() - // RegisterSignal can take a signal name by itself, + // RegisterSignal can take a signal name by itself. RegisterSignal(parent, COMSIG_NOT_REAL, PROC_REF(signalproc)) // or a list of them to assign to the same proc From 57d5328ce1f226448e852835ce68c41d19e6f28f Mon Sep 17 00:00:00 2001 From: EvilDragonfiend <87972842+EvilDragonfiend@users.noreply.github.com> Date: Wed, 17 Apr 2024 16:00:14 +0900 Subject: [PATCH 6/6] nitpick 2 --- code/datums/components/COMPONENT_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/components/COMPONENT_TEMPLATE.md b/code/datums/components/COMPONENT_TEMPLATE.md index ffb5267f93f86..c2777a67d5a6a 100644 --- a/code/datums/components/COMPONENT_TEMPLATE.md +++ b/code/datums/components/COMPONENT_TEMPLATE.md @@ -19,7 +19,7 @@ See _component.dm for detailed explanations // RegisterSignal can take a signal name by itself. RegisterSignal(parent, COMSIG_NOT_REAL, PROC_REF(signalproc)) - // or a list of them to assign to the same proc + // or a list of them to assign to another proc 'RegisterSignals()' //! if signals are a list, use 'RegisterSignals' with extra s. //! if it's a single signal, use 'RegisterSignal' without s RegisterSignals(parent, list(COMSIG_NOT_REAL_EITHER, COMSIG_ALMOST_REAL), PROC_REF(otherproc))