animation refresh - huge unatomized bundle of fixes and tweaks to numerous animations in the game

This commit is contained in:
deathride58
2022-05-31 19:22:30 -04:00
parent f34e268a1c
commit 1a918ed8db
26 changed files with 88 additions and 113 deletions
+11 -5
View File
@@ -229,17 +229,23 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
return copytext_char(sanitize(.),1,MAX_MESSAGE_LEN)
/proc/shake_camera(mob/M, duration, strength=1)
if(!M || !M.client || duration < 1)
set waitfor = FALSE
if(!M || !M.client || duration <= 0)
return
var/client/C = M.client
if (C.prefs.screenshake==0)
return
var/oldx = C.pixel_x
var/oldy = C.pixel_y
var/max = strength*world.icon_size
var/min = -(strength*world.icon_size)
var/clientscreenshake = (C.prefs.screenshake * 0.01)
var/max = (strength*clientscreenshake) * world.icon_size
var/min = -((strength*clientscreenshake) * world.icon_size)
var/roundedduration = -round(-duration) // round() with only one arg will always round down. so uh. this is Something all right
for(var/i in 0 to duration-1)
for(var/i in 0 to roundedduration-1)
duration--
if (i == 0)
animate(C, pixel_x=rand(min,max), pixel_y=rand(min,max), time=1)
animate(C, pixel_x=(rand(min,max)*duration), pixel_y=(rand(min,max)*duration), 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)