Makes locking movement a hotkey (#53771)

* kinda done

* Update code/datums/keybinding/mob.dm

Co-authored-by: Rohesie <rohesie@gmail.com>

* Update code/datums/keybinding/mob.dm

Co-authored-by: Rohesie <rohesie@gmail.com>

* Update code/datums/keybinding/mob.dm

Co-authored-by: Rohesie <rohesie@gmail.com>

* Update code/datums/keybinding/mob.dm

Co-authored-by: Rohesie <rohesie@gmail.com>

Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
Qustinnus
2020-09-18 22:15:02 -04:00
committed by GitHub
co-authored by Rohesie
parent 28a3c64c93
commit fc75f2cb51
5 changed files with 30 additions and 8 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
// Only way to do that is to tie the behavior into the focus's keyLoop().
/atom/movable/keyLoop(client/user)
if(!user.keys_held["Ctrl"])
if(!user.movement_locked)
var/movement_dir = NONE
for(var/_key in user.keys_held)
movement_dir = movement_dir | user.movement_keys[_key]
+2 -2
View File
@@ -41,13 +41,13 @@
winset(src, null, "input.focus=true ; input.text=[url_encode(_key)]")
return
//offset by 1 because the buffer address is 0 indexed because the math was simpler
//offset by 1 because the buffer address is 0 indexed because the math was simpler
keys_held[current_key_address + 1] = _key
//the time a key was pressed isn't actually used anywhere (as of 2019-9-10) but this allows easier access usage/checking
keys_held[_key] = world.time
current_key_address = ((current_key_address + 1) % HELD_KEY_BUFFER_LENGTH)
var/movement = movement_keys[_key]
if(!(next_move_dir_sub & movement) && !keys_held["Ctrl"])
if(!(next_move_dir_sub & movement) && !movement_locked)
next_move_dir_add |= movement
// Client-level keybindings are ones anyone should be able to do at any time