Refactors the keys_held rolling buffer (#53773)

* rolling key rip

* category

* comment

* oops
This commit is contained in:
Rohesie
2020-09-20 15:01:21 -07:00
committed by GitHub
parent 87e833a225
commit 8b224ef13e
7 changed files with 34 additions and 26 deletions
+10
View File
@@ -192,3 +192,13 @@
/// rate limiting for the crew manifest
var/crew_manifest_delay
/// A buffer of currently held keys.
var/list/keys_held = list()
/*
** These next two vars are to apply movement for keypresses and releases made while move delayed.
** Because discarding that input makes the game less responsive.
*/
/// On next move, add this dir to the move that would otherwise be done
var/next_move_dir_add
/// On next move, subtract this dir from the move that would otherwise be done
var/next_move_dir_sub
@@ -0,0 +1,11 @@
/**
* Manually clears any held keys, in case due to lag or other undefined behavior a key gets stuck.
*
* Hardcoded to the ESC key.
*/
/client/verb/reset_held_keys()
set name = "Reset Held Keys"
set hidden = TRUE
for(var/key in keys_held)
keyUp(key)