From faadd3c29eb54ec303f3afe47195ebc34aedecd0 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 19 Dec 2020 13:09:52 +0100 Subject: [PATCH] [MIRROR] Kills twitching corpses dead (#2243) * Kills twitching corpses dead (#55600) * is this legal * softcrit is okay * Kills twitching corpses dead Co-authored-by: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com> --- code/game/atoms_movable.dm | 8 ++++++++ code/modules/keybindings/bindings_atom.dm | 2 +- code/modules/mob/living/living_movement.dm | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 5c58a275130..073e6202c93 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -1075,3 +1075,11 @@ animate(I, alpha = 175, pixel_x = to_x, pixel_y = to_y, time = 3, transform = M, easing = CUBIC_EASING) sleep(1) animate(I, alpha = 0, transform = matrix(), time = 1) + +/** +* A wrapper for setDir that should only be able to fail by living mobs. +* +* Called from [/atom/movable/proc/keyLoop], this exists to be overwritten by living mobs with a check to see if we're actually alive enough to change directions +*/ +/atom/movable/proc/keybind_face_direction(direction) + setDir(direction) diff --git a/code/modules/keybindings/bindings_atom.dm b/code/modules/keybindings/bindings_atom.dm index c4b2169712d..f9f95ebeca1 100644 --- a/code/modules/keybindings/bindings_atom.dm +++ b/code/modules/keybindings/bindings_atom.dm @@ -19,6 +19,6 @@ 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) - setDir(movement_dir) + keybind_face_direction(movement_dir) else user.Move(get_step(src, movement_dir), movement_dir) diff --git a/code/modules/mob/living/living_movement.dm b/code/modules/mob/living/living_movement.dm index 629b3e5a6e1..d2701416be4 100644 --- a/code/modules/mob/living/living_movement.dm +++ b/code/modules/mob/living/living_movement.dm @@ -57,3 +57,8 @@ /mob/living/canZMove(dir, turf/target) return can_zTravel(target, dir) && (movement_type & FLYING | FLOATING) + +/mob/living/keybind_face_direction(direction) + if(stat > SOFT_CRIT) + return + return ..()