From e01e081cbba107c52dfe052cfa39d001422128b0 Mon Sep 17 00:00:00 2001 From: Ccomp5950 Date: Tue, 22 Jul 2014 19:05:04 -0500 Subject: [PATCH] screen_shake (meteors, etc.) made more robust and works with aiEyes Before: multiple screen_shake's could queue up prior to screenshake being set on the mob setting oldeye on the last one to queue up to be the random location from the previous screen shake so sometimes peoples clients were stuck on a location instead of back on the mob. Now we set screenshake before the spawn so we don't spawn up multiple screen_shakes on the same mob. Test: Be ghost, hammer the spawn meteors secret 10 times or so, watch as your camera returns back to your mob. Yay. --- code/modules/mob/mob_helpers.dm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 314a4026ab1..f6a61887944 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -329,17 +329,25 @@ It's fairly easy to fix if dealing with single letters but not so much with comp /proc/shake_camera(mob/M, duration, strength=1) - if(!M || !M.client || M.shakecamera) + if(!M || !M.client || M.shakecamera) return + M.shakecamera = 1 spawn(1) - var/oldeye=M.client.eye + + var/atom/oldeye=M.client.eye + var/aiEyeFlag = 0 + if(istype(oldeye, /mob/aiEye)) + aiEyeFlag = 1 + var/x - M.shakecamera = 1 for(x=0; x