From 8f98f3111049ec6f5ba306c273d38b41602c1a28 Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Fri, 2 Oct 2015 07:14:43 -0700 Subject: [PATCH 1/5] Orbit tweaks! Removes spawn from orbit proc, This allows atoms to override their orbit and use ..() to have code run before and after the orbit. Things that needed the spawn can spawn on their own. Tweaks orbit's pre-orbit sleep to take into account the animation of the inital transform. Ghost orbits have been given less checks, You can now re-orbit something and orbit yourself; Because why the fuck not. Ghost orbits now change the orbit radius based on the icon size of the thing they are orbiting.(for orbiting the singulo) There is a few bugs with this, but they are byond bugs, and only come out at higher fpses. --- code/__HELPERS/unsorted.dm | 33 +++++++++++----------- code/modules/mob/dead/observer/observer.dm | 23 +++++++++++---- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index f447c378f65..88d3d1dd6b7 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1346,30 +1346,31 @@ B --><-- A var/myid = orbitid if (orbiting) stop_orbit() - //sadly this is the only way to ensure the original orbit proc stops and resets the atom's transform. - sleep(1) + //sadly this is the only way to ensure the original orbit proc stops + //and resets the atom's transform before we continue. + //time is based on the sleep in the loop and the time for the final animation of initial_transform. + sleep(2.6+world.tick_lag) if (orbiting || !istype(A) || orbitid != myid) //post sleep re-check return orbiting = A var/lastloc = loc var/angle = 0 var/matrix/initial_transform = matrix(transform) - spawn - while(orbiting && orbiting.loc && orbitid == myid && (!lockinorbit || loc == lastloc)) - loc = get_turf(orbiting.loc) - lastloc = loc - angle += angle_increment - var/matrix/shift = matrix(initial_transform) - shift.Translate(radius,0) - if(clockwise) - shift.Turn(angle) - else - shift.Turn(-angle) - animate(src,transform = shift,2) + while(orbiting && orbiting.loc && orbitid == myid && (lockinorbit || loc == lastloc)) + loc = get_turf(orbiting.loc) + lastloc = loc + angle += angle_increment - sleep(0.6) //the effect breaks above 0.6 delay - animate(src,transform = initial_transform,2) + var/matrix/shift = matrix(initial_transform) + shift.Translate(radius,0) + if(clockwise) + shift.Turn(angle) + else + shift.Turn(-angle) + animate(src,transform = shift,2) + sleep(0.6) //the effect breaks above 0.6 delay + animate(src,transform = initial_transform,2) /atom/movable/proc/stop_orbit() diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index b6649aada21..7077cecaed4 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -206,12 +206,25 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp // This is the ghost's follow verb with an argument /mob/dead/observer/proc/ManualFollow(atom/movable/target) - if(target && target != src) - if(orbiting && orbiting == target) - return - src << "Now orbiting [target]." - orbit(target,24,0) + if (!istype(target)) + return + var/icon/I = icon(target.icon,target.icon_state,target.dir) + + var/orbitsize = (I.Width()+I.Height())/2 + orbitsize -= (orbitsize/32)*8 + + if(orbiting != target) + src << "Now orbiting [target]." + + orbit(target,orbitsize,0) + +/mob/dead/observer/orbit() + ..() + //restart our floating animation after orbit is done. + pixel_y = 0 + spawn (2) //orbit sets up a 2ds animation when it finishes, so we wait for that to end + animate(src, pixel_y = 2, time = 10, loop = -1) /mob/dead/observer/verb/jumptomob() //Moves the ghost instead of just changing the ghosts's eye -Nodrak set category = "Ghost" From de216b049a2b6284d4d4b271d3a0d9ef2f2112be Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Fri, 2 Oct 2015 07:34:34 -0700 Subject: [PATCH 2/5] CHANGELOG --- html/changelogs/mso-orbittweaks.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 html/changelogs/mso-orbittweaks.yml diff --git a/html/changelogs/mso-orbittweaks.yml b/html/changelogs/mso-orbittweaks.yml new file mode 100644 index 00000000000..4e9f91034b0 --- /dev/null +++ b/html/changelogs/mso-orbittweaks.yml @@ -0,0 +1,10 @@ +author: MrStonedOne + +delete-after: True + +changes: + - rscdel: "Removed feature where quick consecutive ghost orbits while moving could be used to fuck with your sprite" + - bugfix: "Fixed ghosts losing floating animation when returning from an orbit" + - bugfix: "Fixed logic error that prevented orbit's automatic cancel when the orbiting thing moved in certain situations." + - rscadd: "Ghost Orbit size now changes based on the icon size of the thing they are orbiting (for that sweet sweet singulo orbiting action)" + - tweak: "Removed needless checks in ghost orbit, you can now orbit yourself and restart an orbit around the thing you are already orbiting" From 0c67263e1d5c33aedc5e1255af1fd580aa616eaf Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Fri, 2 Oct 2015 08:32:42 -0700 Subject: [PATCH 3/5] Tweaks ghost orbit size math to be better --- code/modules/mob/dead/observer/observer.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 7077cecaed4..fa48cec8c55 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -211,8 +211,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/icon/I = icon(target.icon,target.icon_state,target.dir) - var/orbitsize = (I.Width()+I.Height())/2 - orbitsize -= (orbitsize/32)*8 + var/orbitsize = (I.Width()+I.Height())*0.5 + orbitsize -= (orbitsize/world.icon_size)*(world.icon_size*0.25) if(orbiting != target) src << "Now orbiting [target]." From d57e5aa2842db27f9deb907563b287d995686695 Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Fri, 2 Oct 2015 08:33:18 -0700 Subject: [PATCH 4/5] Ghost orbit: Replaces a spawn with a sleep and adds a post-sleep check --- code/modules/mob/dead/observer/observer.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index fa48cec8c55..8aff7d634e1 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -223,7 +223,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp ..() //restart our floating animation after orbit is done. pixel_y = 0 - spawn (2) //orbit sets up a 2ds animation when it finishes, so we wait for that to end + sleep 2 //orbit sets up a 2ds animation when it finishes, so we wait for that to end + if (!orbiting) //make sure another orbit hasn't started animate(src, pixel_y = 2, time = 10, loop = -1) /mob/dead/observer/verb/jumptomob() //Moves the ghost instead of just changing the ghosts's eye -Nodrak From 96f9df96bb607be62feb674abd9a285898c4b7a5 Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Fri, 2 Oct 2015 09:36:41 -0700 Subject: [PATCH 5/5] Ghost orbits: fixes an edge case with ghost animation on orbit exit --- code/modules/mob/dead/observer/observer.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 8aff7d634e1..194277ff065 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -222,9 +222,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/orbit() ..() //restart our floating animation after orbit is done. - pixel_y = 0 sleep 2 //orbit sets up a 2ds animation when it finishes, so we wait for that to end if (!orbiting) //make sure another orbit hasn't started + pixel_y = 0 animate(src, pixel_y = 2, time = 10, loop = -1) /mob/dead/observer/verb/jumptomob() //Moves the ghost instead of just changing the ghosts's eye -Nodrak