From 5f306940f1bd9ebb41d2131a0d2b5bdddcdc7ad5 Mon Sep 17 00:00:00 2001 From: Ovilum Date: Wed, 12 Jun 2024 16:34:25 -0500 Subject: [PATCH] as says https://github.com/shiptest-ss13/Shiptest/pull/3053 --- code/datums/components/_component.dm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index 1d16391a18e..d76504787b0 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -321,10 +321,12 @@ // all the objects that are receiving the signal get the signal this final time. // AKA: No you can't cancel the signal reception of another object by doing an unregister in the same signal. var/list/queued_calls = list() - for(var/datum/listening_datum as anything in target) - queued_calls[listening_datum] = listening_datum.signal_procs[src][sigtype] - for(var/datum/listening_datum as anything in queued_calls) - . |= call(listening_datum, queued_calls[listening_datum])(arglist(arguments)) + // This should be faster than doing `var/datum/listening_datum as anything in target` as it does not implicitly copy the list + for(var/i in 1 to length(target)) + var/datum/listening_datum = target[i] + queued_calls.Add(listening_datum, listening_datum.signal_procs[src][sigtype]) + for(var/i in 1 to length(queued_calls) step 2) + . |= call(queued_calls[i], queued_calls[i + 1])(arglist(arguments)) // The type arg is casted so initial works, you shouldn't be passing a real instance into this /**