Pulls apart the vestiges of components still hanging onto signals (#75914)

## About The Pull Request

Signals were initially only usable with component listeners, which while
no longer the case has lead to outdated documentation, names, and a
similar location in code.

This pr pulls the two apart. Partially because mso thinks we should, but
also because they really aren't directly linked anymore, and having them
in this midstate just confuses people.

[Renames comp_lookup to listen_lookup, since that's what it
does](https://github.com/tgstation/tgstation/commit/102b79694fa8eb57ecf7b36032616a9e368ccced)

[Moves signal procs over to their own
file](https://github.com/tgstation/tgstation/commit/33d07d01fd336726b4f6f6f1b61bb0b3f11a00dc)

[Renames the PREQDELETING and QDELETING comsigs to drop the parent bit
since they can hook to more then just comps
now](https://github.com/tgstation/tgstation/commit/335ea4ad081ec63c42cfa05856e582cca833af6e)

[Does something similar to the attackby comsigs (PARENT ->
ATOM)](https://github.com/tgstation/tgstation/commit/210e57051df63f88dac3dd83321236da825aae5e)

[And finally passes over the examine
signals](https://github.com/tgstation/tgstation/commit/65917658fb8a1e7d28ae23c9437a583d646f0302)

## Why It's Good For The Game

Code makes more sense, things are better teased apart, s just good imo

## Changelog
🆑
refactor: Pulled apart the last vestiges of names/docs directly linking
signals to components
/🆑
This commit is contained in:
LemonInTheDark
2023-06-09 06:14:31 +00:00
committed by GitHub
parent c0ae81032b
commit ae5a4f955d
335 changed files with 913 additions and 913 deletions
@@ -184,7 +184,7 @@ GLOBAL_LIST_EMPTY_TYPED(integrated_circuits, /obj/item/integrated_circuit)
set_on(TRUE)
SEND_SIGNAL(src, COMSIG_CIRCUIT_SET_SHELL, new_shell)
shell = new_shell
RegisterSignal(shell, COMSIG_PARENT_QDELETING, PROC_REF(remove_current_shell))
RegisterSignal(shell, COMSIG_QDELETING, PROC_REF(remove_current_shell))
for(var/obj/item/circuit_component/attached_component as anything in attached_components)
attached_component.register_shell(shell)
// Their input ports may be updated with user values, but the outputs haven't updated
@@ -201,7 +201,7 @@ GLOBAL_LIST_EMPTY_TYPED(integrated_circuits, /obj/item/integrated_circuit)
shell.name = initial(shell.name)
for(var/obj/item/circuit_component/attached_component as anything in attached_components)
attached_component.unregister_shell(shell)
UnregisterSignal(shell, COMSIG_PARENT_QDELETING)
UnregisterSignal(shell, COMSIG_QDELETING)
shell = null
set_on(FALSE)
SEND_SIGNAL(src, COMSIG_CIRCUIT_SHELL_REMOVED)
+2 -2
View File
@@ -34,7 +34,7 @@
say("Marked [target].")
marked_atom = target
RegisterSignal(marked_atom, COMSIG_PARENT_QDELETING, PROC_REF(cleanup_marked_atom))
RegisterSignal(marked_atom, COMSIG_QDELETING, PROC_REF(cleanup_marked_atom))
update_icon()
flick("multitool_circuit_flick", src)
playsound(src.loc, 'sound/misc/compiler-stage2.ogg', 30, TRUE)
@@ -50,7 +50,7 @@
/obj/item/multitool/circuit/proc/clear_marked_atom()
if(!marked_atom)
return
UnregisterSignal(marked_atom, COMSIG_PARENT_QDELETING)
UnregisterSignal(marked_atom, COMSIG_QDELETING)
marked_atom = null
update_icon()
+3 -3
View File
@@ -52,13 +52,13 @@
if(src.value != value || force)
if(isdatum(src.value))
UnregisterSignal(src.value, COMSIG_PARENT_QDELETING)
UnregisterSignal(src.value, COMSIG_QDELETING)
if(datatype_handler.is_extensive)
src.value = datatype_handler.convert_value_extensive(src, value, force)
else
src.value = datatype_handler.convert_value(src, value, force)
if(isdatum(value))
RegisterSignal(value, COMSIG_PARENT_QDELETING, PROC_REF(null_value))
RegisterSignal(value, COMSIG_QDELETING, PROC_REF(null_value))
SEND_SIGNAL(src, COMSIG_PORT_SET_VALUE, value)
/**
@@ -152,7 +152,7 @@
if(value == source)
value = null
else
stack_trace("Impossible? [src] should only receive COMSIG_PARENT_QDELETING from an atom currently in the port, not [source].")
stack_trace("Impossible? [src] should only receive COMSIG_QDELETING from an atom currently in the port, not [source].")
/**
* # Input Port
+2 -2
View File
@@ -88,13 +88,13 @@
/obj/item/usb_cable/proc/register_circuit_signals()
RegisterSignal(attached_circuit, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
RegisterSignal(attached_circuit, COMSIG_PARENT_QDELETING, PROC_REF(on_circuit_qdeling))
RegisterSignal(attached_circuit, COMSIG_QDELETING, PROC_REF(on_circuit_qdeling))
RegisterSignal(attached_circuit.shell, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
/obj/item/usb_cable/proc/unregister_circuit_signals(obj/item/integrated_circuit/old_circuit)
UnregisterSignal(attached_circuit, list(
COMSIG_MOVABLE_MOVED,
COMSIG_PARENT_QDELETING,
COMSIG_QDELETING,
))
UnregisterSignal(attached_circuit.shell, COMSIG_MOVABLE_MOVED)
+2 -2
View File
@@ -45,9 +45,9 @@
/// Adds a listener to receive inputs when the variable has a value that is set.
/datum/circuit_variable/proc/add_listener(obj/item/circuit_component/to_add)
listeners += to_add
RegisterSignal(to_add, COMSIG_PARENT_QDELETING, PROC_REF(on_listener_qdel))
RegisterSignal(to_add, COMSIG_QDELETING, PROC_REF(on_listener_qdel))
/// Removes a listener to receive inputs when the variable has a value that is set. Listener will usually clean themselves up
/datum/circuit_variable/proc/remove_listener(obj/item/circuit_component/to_remove)
UnregisterSignal(to_remove, COMSIG_PARENT_QDELETING)
UnregisterSignal(to_remove, COMSIG_QDELETING)
listeners -= to_remove