Files
Bubberstation/code/modules/keybindings/bindings_atom.dm
SkyratBot 2cef943f6f [MIRROR] Revert "Prevent SSinput from constantly requesting moving in-place" (#6352)
* Revert "prevent SSinput from constantly reporting null movements (#59558)" (#59650)

This reverts commit 6c2d17bb15.

Fucky movement fix oranges is literally threatening me.

I feel like I've messed up somewhere here...

Either way this is causing movements to be a bit fucky where one input counts as two in a direction.

* Revert "Prevent SSinput from constantly requesting moving in-place"

Co-authored-by: brotherbeyondd <68032262+brotherbeyondd@users.noreply.github.com>
2021-06-16 22:23:09 +01:00

25 lines
1.1 KiB
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(movement_dir) //If we're not moving, don't compensate, as byond will auto-fill dir otherwise
movement_dir = turn(movement_dir, -dir2angle(user.dir)) //By doing this we ensure that our input direction is offset by the client (camera) direction
if(user.movement_locked)
keybind_face_direction(movement_dir)
else
user.Move(get_step(src, movement_dir), movement_dir)