Merge pull request #13843 from MrStonedOne/justshakeitoff

Smooth pixel screens shakes!
This commit is contained in:
Jordie
2015-12-22 21:50:18 +11:00
2 changed files with 15 additions and 15 deletions
-1
View File
@@ -78,7 +78,6 @@
var/stunned = 0
var/weakened = 0
var/losebreath = 0//Carbon
var/shakecamera = 0
var/a_intent = "help"//Living
var/m_intent = "run"//Living
var/lastKnownIP = null
+15 -14
View File
@@ -187,20 +187,21 @@ 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
var/x
M.shakecamera = 1
for(x=0; x<duration, x++)
if(M && M.client)
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)
if(M)
M.shakecamera = 0
if(M.client)
M.client.eye=oldeye
if(!M || !M.client || duration <= 0)
return
var/client/C = M.client
var/oldx = C.pixel_x
var/oldy = C.pixel_y
var/max = strength*world.icon_size
var/min = -(strength*world.icon_size)
for(var/i in 0 to duration-1)
if (i == 0)
animate(C, pixel_x=rand(min,max), pixel_y=rand(min,max), time=1)
else
animate(pixel_x=rand(min,max), pixel_y=rand(min,max), time=1)
animate(pixel_x=oldx, pixel_y=oldy, time=1)
/proc/findname(msg)