mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 02:54:41 +01:00
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. Conflicts: code/modules/mob/mob_helpers.dm
This commit is contained in:
@@ -364,17 +364,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)
|
||||
spawn(0)
|
||||
if(!M || !M.client || M.shakecamera)
|
||||
return
|
||||
var/oldeye=M.client.eye
|
||||
if(!M || !M.client || M.shakecamera)
|
||||
return
|
||||
M.shakecamera = 1
|
||||
spawn(1)
|
||||
|
||||
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<duration, x++)
|
||||
M.client.eye = locate(dd_range(1,M.loc.x+rand(-strength,strength),world.maxx),dd_range(1,M.loc.y+rand(-strength,strength),world.maxy),M.loc.z)
|
||||
if(aiEyeFlag)
|
||||
M.client.eye = locate(dd_range(1,oldeye.loc.x+rand(-strength,strength),world.maxx),dd_range(1,oldeye.loc.y+rand(-strength,strength),world.maxy),oldeye.loc.z)
|
||||
else
|
||||
M.client.eye = locate(dd_range(1,M.loc.x+rand(-strength,strength),world.maxx),dd_range(1,M.loc.y+rand(-strength,strength),world.maxy),M.loc.z)
|
||||
sleep(1)
|
||||
M.shakecamera = 0
|
||||
M.client.eye=oldeye
|
||||
M.shakecamera = 0
|
||||
|
||||
|
||||
/proc/findname(msg)
|
||||
|
||||
Reference in New Issue
Block a user