diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm
index db510a33cdb..1bc6978f701 100644
--- a/code/__HELPERS/unsorted.dm
+++ b/code/__HELPERS/unsorted.dm
@@ -1423,11 +1423,16 @@ 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 atom's transform.
+ if (orbiting || !istype(A)) //post sleep re-check
+ return
orbiting = A
var/angle = 0
var/matrix/initial_transform = matrix(transform)
spawn
- while(orbiting)
+ while(orbiting && orbiting.loc)
loc = orbiting.loc
angle += angle_increment
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()