improves pixel screen shakes

This commit is contained in:
MrStonedOne
2015-12-22 02:04:39 -08:00
parent 19fab849c0
commit 5bcc40aeae
2 changed files with 8 additions and 14 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
+8 -13
View File
@@ -187,26 +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)
set waitfor = 0
if(!M || !M.client || M.shakecamera)
if(!M || !M.client || duration <= 0)
return
M.shakecamera = 1
var/client/C = M.client
var/oldx = C.pixel_x
var/oldy = C.pixel_y
var/max = (strength+1)*world.icon_size
var/min = 0-((strength+1)*world.icon_size)
var/max = strength*world.icon_size
var/min = -(strength*world.icon_size)
for(var/i=0, i<duration, i++)
var/newx = rand(min,max)
var/newy = rand(min,max)
for(var/i in 0 to duration-1)
if (i == 0)
animate(C, pixel_x=newx, pixel_y=newy, 1, 1, ELASTIC_EASING)
animate(C, pixel_x=rand(min,max), pixel_y=rand(min,max), time=1)
else
animate(pixel_x=newx, pixel_y=newy, 1, 1, ELASTIC_EASING)
sleep 1
animate(C, pixel_x=oldx, pixel_y=oldy, 1, 1, ELASTIC_EASING)
M.shakecamera = 0
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)