Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes wrong signal usages #10875

Merged
merged 7 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/_onclick/hud/holoparasite.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ai/monkey/monkey_behaviors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 12 additions & 4 deletions code/datums/components/COMPONENT_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ 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 can take a signal name by itself.
RegisterSignal(parent, COMSIG_NOT_REAL, PROC_REF(signalproc))

// 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))

/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 has similar behavior
UnregisterSignal(parent, COMSIG_NOT_REAL)

// But you can just include all registered signals in one call
UnregisterSignal(parent, list(
COMSIG_NOT_REAL,
COMSIG_NOT_REAL_EITHER,
COMSIG_ALMOST_REAL,
Expand Down
12 changes: 10 additions & 2 deletions code/datums/components/area_sound_manager.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
RegisterSignal(parent, change_on, PROC_REF(handle_change))
RegisterSignal(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)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/plumbing/_plumbing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/tether.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/datums/components/waddling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion code/datums/components/wearertargeting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
SIGNAL_HANDLER

if((slot in valid_slots) && istype(equipper, mobtype))
RegisterSignal(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)

Expand Down
4 changes: 2 additions & 2 deletions code/datums/elements/weather_listener.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/heretic/knowledge/void_lore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/nukeop/equipment/borgchameleon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/holoparasite/abilities/major/explosive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/silicon/robot/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions code/modules/reagents/reagent_containers/spray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/organs/augments_internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading