|
65 | 65 | animate(transform = transforms[2], time = 0.1) |
66 | 66 | animate(transform = transforms[3], time = 0.2) |
67 | 67 | animate(transform = transforms[4], time = 0.3) |
| 68 | + |
| 69 | + |
| 70 | +/** |
| 71 | + * Proc called when you want the atom to spin around the center of its icon (or where it would be if its transform var is translated) |
| 72 | + * By default, it makes the atom spin forever and ever at a speed of 60 rpm. |
| 73 | + * |
| 74 | + * Arguments: |
| 75 | + * * speed: how much it takes for the atom to complete one 360° rotation |
| 76 | + * * loops: how many times do we want the atom to rotate |
| 77 | + * * clockwise: whether the atom ought to spin clockwise or counter-clockwise |
| 78 | + * * segments: in how many animate calls the rotation is split. Probably unnecessary, but you shouldn't set it lower than 3 anyway. |
| 79 | + * * parallel: whether the animation calls have the ANIMATION_PARALLEL flag, necessary for it to run alongside concurrent animations. |
| 80 | + */ |
| 81 | +/atom/proc/SpinAnimation(speed = 1 SECONDS, loops = -1, clockwise = TRUE, segments = 3, parallel = TRUE) |
| 82 | + if(!segments) |
| 83 | + return |
| 84 | + var/segment = 360/segments |
| 85 | + if(!clockwise) |
| 86 | + segment = -segment |
| 87 | + SEND_SIGNAL(src, COMSIG_ATOM_SPIN_ANIMATION, speed, loops, segments, segment) |
| 88 | + do_spin_animation(speed, loops, segments, segment, parallel) |
| 89 | + |
| 90 | +/atom/proc/DabAnimation(speed = 1, loops = 1, direction = 1 , hold_seconds = 0 , angle = 1 , stay = FALSE) // Hopek 2019 |
| 91 | + // By making this in atom/proc everything in the game can potentially dab. You have been warned. |
| 92 | + if(hold_seconds > 9999) // if you need to hold a dab for more than 2 hours intentionally let me know. |
| 93 | + return |
| 94 | + if(hold_seconds > 0) |
| 95 | + hold_seconds = hold_seconds * 10 // Converts seconds to deciseconds |
| 96 | + if(angle == 1) //if angle is 1: random angle. Else take angle |
| 97 | + angle = rand(25,50) |
| 98 | + if(direction == 1) // direciton:: 1 for random pick, 2 for clockwise , 3 for anti-clockwise |
| 99 | + direction = pick(2,3) |
| 100 | + if(direction == 3) // if 3 then counter clockwise |
| 101 | + angle = angle * -1 |
| 102 | + if(speed == 1) // if speed is 1 choose random speed from list |
| 103 | + speed = rand(3,5) |
| 104 | + |
| 105 | + // dab matrix here |
| 106 | + var/matrix/DAB_COMMENCE = matrix(transform) |
| 107 | + var/matrix/DAB_RETURN = matrix(transform) |
| 108 | + DAB_COMMENCE.Turn(angle) // dab angle to matrix |
| 109 | + |
| 110 | + // Dab animation |
| 111 | + animate(src, transform = DAB_COMMENCE, time = speed, loops ) // dab to hold angle |
| 112 | + if(hold_seconds > 0) |
| 113 | + sleep(hold_seconds) // time to hold the dab before going back |
| 114 | + if(!stay) // if stay param is true dab doesn't return |
| 115 | + animate(transform = DAB_RETURN, time = speed * 1.5, loops ) // reverse dab to starting position , slower |
| 116 | + //doesn't have an object argument because this is "Stacking" with the animate call above |
| 117 | + //3 billion% intentional |
0 commit comments