mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
Updates signaler investigate code | Adds some nice QOL changes for signalers | Enforces cooldown on signaler circuitry (#78974)
## About The Pull Request See title. If someone was abusing signalers previously to cause server lag, going into list signalers would actually cause even worse lag as byond sat there and processed thousands of items into a string over and over, which would cause string format operations on longer and longer strings, resulting in more and more overhead. This is bad. So instead there is now a limit to the size of the list, currently I have that set to 500 although I am open to increasing and even reducing the number. I have also made signalers slightly more intuitive by having the cooldown actually displayed in the ui as a tooltip instead of just being a secret feature you didnt know about unless you code dived. Also made the cooldown actually respected by things such as circuitry where it didnt even implement the cooldown and would happily send as many signals as you had items connected to your proximity circuit. ## Why It's Good For The Game Admins won't accidentally kill the server by trying to parse a lag machines signal list. Players lagging the server? No, how about the admins trying to fix it! ## Changelog 🆑 qol: signalers now tell you their cooldown and also use balloon alerts /🆑
This commit is contained in:
@@ -28,8 +28,17 @@
|
||||
/// The ckey of the user who used the shell we were placed in, important for signalling logs.
|
||||
var/owner_ckey = null
|
||||
|
||||
/// The radio connection we are using to receive signals.
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/// How long of a cooldown we have before we can send another signal.
|
||||
var/signal_cooldown_time = 1 SECONDS
|
||||
|
||||
/obj/item/circuit_component/radio/Initialize(mapload)
|
||||
. = ..()
|
||||
if(signal_cooldown_time > 0)
|
||||
desc = "[desc] It has a [signal_cooldown_time * 0.1] second cooldown between sending signals."
|
||||
|
||||
/obj/item/circuit_component/radio/register_shell(atom/movable/shell)
|
||||
parent_shell = shell
|
||||
var/potential_fingerprints = shell.fingerprintslast
|
||||
@@ -65,8 +74,10 @@
|
||||
INVOKE_ASYNC(src, PROC_REF(handle_radio_input), port)
|
||||
|
||||
/obj/item/circuit_component/radio/proc/handle_radio_input(datum/port/input/port)
|
||||
var/frequency = freq.value
|
||||
if(!TIMER_COOLDOWN_CHECK(parent, COOLDOWN_SIGNALLER_SEND))
|
||||
return
|
||||
|
||||
var/frequency = freq.value
|
||||
if(frequency != current_freq)
|
||||
SSradio.remove_object(src, current_freq)
|
||||
radio_connection = SSradio.add_object(src, frequency, RADIO_SIGNALER)
|
||||
@@ -84,7 +95,8 @@
|
||||
loggable_strings += "<B>:</B> The last fingerprints on the containing shell was [parent_shell.fingerprintslast]."
|
||||
|
||||
var/loggable_string = loggable_strings.Join(" ")
|
||||
GLOB.lastsignalers.Add(loggable_string)
|
||||
add_to_signaler_investigate_log(loggable_string)
|
||||
TIMER_COOLDOWN_START(parent, COOLDOWN_SIGNALLER_SEND, signal_cooldown_time)
|
||||
|
||||
var/datum/signal/signal = new(list("code" = signal_code, "key" = parent?.owner_id), logging_data = loggable_string)
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
Reference in New Issue
Block a user