163c84344b
* Orbit is now less reliant on Animate(), for most ghosts this means 36 calls to Animate, vs the previous INFINITE, for those of you with potato computers, this should ease the pain and crashing. * Orbits can now be something different to circles! * Ghosts Byond Members can now choose between orbits! (Circle, Triangle, Square, Hexagon)
27 lines
878 B
Plaintext
27 lines
878 B
Plaintext
/matrix/proc/TurnTo(old_angle, new_angle)
|
|
. = new_angle - old_angle
|
|
Turn(.) //BYOND handles cases such as -270, 360, 540 etc. DOES NOT HANDLE 180 TURNS WELL, THEY TWEEN AND LOOK LIKE SHIT
|
|
|
|
|
|
/atom/proc/SpinAnimation(speed = 10, loops = -1, clockwise = 1, segments = 3)
|
|
if(!segments)
|
|
return
|
|
var/segment = 360/segments
|
|
if(!clockwise)
|
|
segment = -segment
|
|
var/list/matrices = list()
|
|
for(var/i in 1 to segments-1)
|
|
var/matrix/M = matrix(transform)
|
|
M.Turn(segment*i)
|
|
matrices += M
|
|
var/matrix/last = matrix(transform)
|
|
matrices += last
|
|
|
|
speed /= segments
|
|
|
|
animate(src, transform = matrices[1], time = speed, loops)
|
|
for(var/i in 2 to segments) //2 because 1 is covered above
|
|
animate(transform = matrices[i], time = speed)
|
|
//doesn't have an object argument because this is "Stacking" with the animate call above
|
|
//3 billion% intentional
|