Files
Bubberstation/code/modules/keybindings/bindings_atom.dm
SkyratBot d21d28c3af [MIRROR] Block movement now locks turning, migrate old save files to Ctrl (#932)
* Block movement now locks turning, migrate old save files to Ctrl (#53871)

The block movement key now correctly locks turning like it used to.

Old save files are now migrated to Ctrl if they didn't bind it to anything before. This correctly replicates the old behavior.

* Block movement now locks turning, migrate old save files to Ctrl

Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
2020-09-23 14:45:44 +02:00

22 lines
830 B
Plaintext

// You might be wondering why this isn't client level. If focus is null, we don't want you to move.
// Only way to do that is to tie the behavior into the focus's keyLoop().
/atom/movable/keyLoop(client/user)
var/movement_dir = NONE
for(var/_key in user.keys_held)
movement_dir = movement_dir | user.movement_keys[_key]
if(user.next_move_dir_add)
movement_dir |= user.next_move_dir_add
if(user.next_move_dir_sub)
movement_dir &= ~user.next_move_dir_sub
// Sanity checks in case you hold left and right and up to make sure you only go up
if((movement_dir & NORTH) && (movement_dir & SOUTH))
movement_dir &= ~(NORTH|SOUTH)
if((movement_dir & EAST) && (movement_dir & WEST))
movement_dir &= ~(EAST|WEST)
if(user.movement_locked)
setDir(movement_dir)
else
user.Move(get_step(src, movement_dir), movement_dir)