From d3a61455a271ff510dbbd2bf89e5e7afa22d0d9a Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Thu, 10 Sep 2015 23:13:28 -0700 Subject: [PATCH 1/5] Ghost follow is now an orbit! --- code/modules/mob/dead/observer/observer.dm | 26 +++++++--------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 54d992c080a..10dd6348a92 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -106,6 +106,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/Move(NewLoc, direct) + if (orbiting) + stop_orbit() if(NewLoc) loc = NewLoc for(var/obj/effect/step_trigger/S in NewLoc) @@ -200,8 +202,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/verb/follow() set category = "Ghost" - set name = "Follow" // "Haunt" - set desc = "Follow and haunt a mob." + set name = "Orbit" // "Haunt" + set desc = "Follow and orbit a mob." var/list/mobs = getmobs() var/input = input("Please, select a mob!", "Haunt", null, null) as null|anything in mobs @@ -211,22 +213,10 @@ 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(following && following == target) + if(orbiting && orbiting == target) return - following = target - src << "Now following [target]." - spawn(0) - var/turf/pos = get_turf(src) - while(loc == pos && target && following == target && client) - var/turf/T = get_turf(target) - if(!T) - break - // To stop the ghost flickering. - if(loc != T) - loc = T - pos = loc - sleep(15) - if (target == following) following = null + src << "Now orbiting [target]." + orbit(target,24,0) /mob/dead/observer/verb/jumptomob() //Moves the ghost instead of just changing the ghosts's eye -Nodrak @@ -377,4 +367,4 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(istype(target) && (target != src)) ManualFollow(target) if(href_list["reenter"]) - reenter_corpse() \ No newline at end of file + reenter_corpse() From 28e550d8c1c74243e259fa56dfc39616784d736e Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Thu, 10 Sep 2015 23:17:27 -0700 Subject: [PATCH 2/5] Fixes bug where orbiting while orbiting would break orbits --- code/__HELPERS/unsorted.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index e6b19171e31..ad46187cf73 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1423,6 +1423,9 @@ B --><-- A /atom/movable/proc/orbit(atom/A, radius = 10, clockwise = 1, angle_increment = 15) if(!istype(A)) return + if (orbiting) + stop_orbit() + sleep 1 //sadly this is the only way to ensure the original orbit proc stops and resets the mob's transform. orbiting = A var/angle = 0 var/matrix/initial_transform = matrix(transform) From fa735248040e6a4392f71ef265eaf4b217dc5bae Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Fri, 11 Sep 2015 07:33:30 -0700 Subject: [PATCH 3/5] Some code clean up --- code/__HELPERS/unsorted.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index ad46187cf73..11d5fa2b25d 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1425,7 +1425,9 @@ B --><-- A return if (orbiting) stop_orbit() - sleep 1 //sadly this is the only way to ensure the original orbit proc stops and resets the mob's transform. + sleep(1) //sadly this is the only way to ensure the original orbit proc stops and resets the atom's transform. + if (orbiting) + return //mutiple calls to orbit can happen and create oddness orbiting = A var/angle = 0 var/matrix/initial_transform = matrix(transform) From 144402c8c72da7145628925f6cc0c64a295c994b Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Fri, 11 Sep 2015 09:19:04 -0700 Subject: [PATCH 4/5] I slept so I should make sure A still exists --- code/__HELPERS/unsorted.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 11d5fa2b25d..75c579855ad 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1426,8 +1426,8 @@ B --><-- A if (orbiting) stop_orbit() sleep(1) //sadly this is the only way to ensure the original orbit proc stops and resets the atom's transform. - if (orbiting) - return //mutiple calls to orbit can happen and create oddness + if (orbiting || !istype(A)) //post sleep re-check + return orbiting = A var/angle = 0 var/matrix/initial_transform = matrix(transform) From cf390ae1ef22d37a615b6fc6b7623e237941f74a Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Sun, 13 Sep 2015 08:35:22 -0700 Subject: [PATCH 5/5] Fixes orbiting a deleted atom sending you to null space This also handles the garbage collection issues. As far as i'm concerned, if its been qdeled, but loc isn't null, it's fair game for orbits. --- code/__HELPERS/unsorted.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 75c579855ad..a00e139c27a 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1432,7 +1432,7 @@ B --><-- A var/angle = 0 var/matrix/initial_transform = matrix(transform) spawn - while(orbiting) + while(orbiting && orbiting.loc) loc = orbiting.loc angle += angle_increment