mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
[MIRROR] Refactored screen shake effect (#9898)
Co-authored-by: Guti <32563288+TheCaramelion@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
1bb255b664
commit
6272ea3c5c
@@ -115,7 +115,6 @@
|
||||
var/stunned = 0.0
|
||||
var/weakened = 0.0
|
||||
var/losebreath = 0.0//Carbon
|
||||
var/shakecamera = 0
|
||||
var/a_intent = I_HELP//Living
|
||||
var/m_int = null//Living
|
||||
var/m_intent = I_RUN//Living
|
||||
|
||||
@@ -293,28 +293,20 @@ 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 || M.stat || isEye(M) || isAI(M))
|
||||
if(!M || !M.client || duration < 1)
|
||||
return
|
||||
M.shakecamera = 1
|
||||
spawn(1)
|
||||
if(!M.client)
|
||||
return
|
||||
|
||||
var/atom/oldeye=M.client.eye
|
||||
var/aiEyeFlag = 0
|
||||
if(istype(oldeye, /mob/observer/eye/aiEye))
|
||||
aiEyeFlag = 1
|
||||
|
||||
var/x
|
||||
for(x=0; x<duration, x++)
|
||||
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.client.eye=oldeye
|
||||
M.shakecamera = 0
|
||||
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)
|
||||
for(var/mob/M in mob_list)
|
||||
|
||||
Reference in New Issue
Block a user