From 293e85f94bbd2dea29683edc40f2f5c0e3e720f4 Mon Sep 17 00:00:00 2001 From: Kylerace Date: Tue, 6 Dec 2022 00:59:11 -0800 Subject: [PATCH] fixes & increases SSinput click delay threshold & moves it and average_click_delay to deciseconds (#71520) ## About The Pull Request theres an issue with SSinput calculating the average_click_delay that made it skip queuing clicks much faster than it should have. now it should work. also moves everything to deciseconds for consistency (except for the statpanel display, which changes it to per second). also i increased the click delay threshold to 1 tick in deciseconds because really we should only be refusing to queue if SSinput is being skipped for whatever reason or each tick is receiving massive non input overtime ## Why It's Good For The Game feex queuing clicks to lower overtime when the server is overloaded ## Changelog :cl: fix: queuing clicks should work correctly now /:cl: --- code/__DEFINES/input.dm | 2 +- code/controllers/subsystem/input.dm | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/input.dm b/code/__DEFINES/input.dm index 57fb22a81e9..7ec645990d7 100644 --- a/code/__DEFINES/input.dm +++ b/code/__DEFINES/input.dm @@ -1,2 +1,2 @@ ///if the running average click latency is above this amount then clicks will never queue and will execute immediately -#define MAXIMUM_CLICK_LATENCY (20 MILLISECONDS) +#define MAXIMUM_CLICK_LATENCY (0.5 DECISECONDS) diff --git a/code/controllers/subsystem/input.dm b/code/controllers/subsystem/input.dm index 3cbceaa0d17..c39712771be 100644 --- a/code/controllers/subsystem/input.dm +++ b/code/controllers/subsystem/input.dm @@ -53,7 +53,7 @@ VERB_MANAGER_SUBSYSTEM_DEF(input) if(control != "mapwindow.map") return FALSE - if(average_click_delay >= MAXIMUM_CLICK_LATENCY || !..()) + if(average_click_delay > MAXIMUM_CLICK_LATENCY || !..()) current_clicks++ average_click_delay = MC_AVG_FAST_UP_SLOW_DOWN(average_click_delay, 0) return FALSE @@ -82,7 +82,7 @@ VERB_MANAGER_SUBSYSTEM_DEF(input) stack_trace("non /datum/callback/verb_callback instance inside SSinput's verb_queue!") continue - average_click_delay = MC_AVG_FAST_UP_SLOW_DOWN(average_click_delay, TICKS2DS((DS2TICKS(world.time) - queued_click.creation_time)) SECONDS) + average_click_delay = MC_AVG_FAST_UP_SLOW_DOWN(average_click_delay, TICKS2DS((DS2TICKS(world.time) - queued_click.creation_time))) queued_click.InvokeAsync() current_clicks++ @@ -96,5 +96,5 @@ VERB_MANAGER_SUBSYSTEM_DEF(input) /datum/controller/subsystem/verb_manager/input/stat_entry(msg) . = ..() - . += "M/S:[round(movements_per_second,0.01)] | C/S:[round(clicks_per_second,0.01)] ([round(delayed_clicks_per_second,0.01)] | CD: [round(average_click_delay,0.01)])" + . += "M/S:[round(movements_per_second,0.01)] | C/S:[round(clicks_per_second,0.01)] ([round(delayed_clicks_per_second,0.01)] | CD: [round(average_click_delay / (1 SECONDS),0.01)])"