Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orbit fix #11243

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions code/modules/mob/living/deity/deity_tracking.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
stop_follow()
eyeobj.setLoc(get_turf(L))
to_chat(src, "<span class='notice'>You begin to follow \the [L].</span>")
following = L
register_signal(L, SIGNAL_MOVED, /mob/living/deity/proc/keep_following)
register_signal(L, SIGNAL_QDELETING, /mob/living/deity/proc/stop_follow)
register_signal(L, SIGNAL_MOB_DEATH, /mob/living/deity/proc/stop_follow)
Expand All @@ -34,7 +33,6 @@
unregister_signal(following, SIGNAL_QDELETING)
unregister_signal(following, SIGNAL_MOB_DEATH)
to_chat(src, "<span class='notice'>You stop following \the [following].</span>")
following = null

/mob/living/deity/proc/keep_following(atom/movable/moving_instance, atom/old_loc, atom/new_loc)
eyeobj.setLoc(new_loc)
5 changes: 2 additions & 3 deletions code/modules/mob/mob_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,8 @@
var/datum/orbit/O = thing
O.Check()

var/datum/orbit/orbit = orbiting?.resolve()
if(istype(orbit))
orbit.Check()
if(istype(orbiting))
orbiting.Check()

SEND_SIGNAL(src, SIGNAL_MOVED, src, old_loc, loc)

Expand Down
23 changes: 9 additions & 14 deletions code/modules/mob/observer/ghost/ghost.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ GLOBAL_LIST_EMPTY(ghost_sightless_images)
var/started_as_observer //This variable is set to 1 when you enter the game as an observer.
//If you died in the game and are a ghost - this will remain as null.
//Note that this is not a reliable way to determine if admins started as observers, since they change mobs a lot.
var/atom/movable/following = null
var/glide_before_follow = 0

var/admin_ghosted = FALSE
Expand Down Expand Up @@ -442,14 +441,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/observer/ghost/proc/ManualFollow(atom/movable/target)
if(!target || target == following || target == src)
if(!istype(target) || target == src)
return

stop_following()
following = target
register_signal(following, SIGNAL_MOVED, nameof(/atom/movable.proc/move_to_turf))
register_signal(following, SIGNAL_DIR_SET, nameof(/atom/proc.recursive_dir_set))
register_signal(following, SIGNAL_QDELETING, nameof(.proc/stop_following))

var/orbitsize
if(target.icon)
Expand All @@ -459,25 +454,25 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
orbitsize = world.icon_size
orbitsize -= (orbitsize / world.icon_size) * (world.icon_size * 0.25)

var/datum/orbit/orbit = orbiting?.resolve()
if(istype(orbit) && orbit.orbiting != target)
to_chat(src, "<span class='notice'>Now following \the [target].</span>")
glide_before_follow = src.glide_size
src.glide_size = target.glide_size

forceMove(target)
orbit(target, orbitsize, FALSE, 20, 36)

if(orbiting)
to_chat(src, SPAN_NOTICE("Now following \the [target]."))

/mob/dead/observer/orbit()
set_dir(WEST) // Reset dir so the right directional sprites show up
..()

/mob/observer/ghost/proc/stop_following()
if(orbiting)
to_chat(src, SPAN_NOTICE("No longer following \the [orbiting.orbiting]."))
stop_orbit()
to_chat(src, SPAN_NOTICE("No longer following \the [following]."))
unregister_signal(following, SIGNAL_MOVED)
unregister_signal(following, SIGNAL_DIR_SET)
unregister_signal(following, SIGNAL_QDELETING)
following = null
glide_size = glide_before_follow
glide_before_follow = 0

/mob/observer/ghost/move_to_turf(atom/movable/am, old_loc, new_loc)
var/turf/T = get_turf(new_loc)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/orbit/orbit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
return TRUE

/atom/movable
var/weakref/orbiting = null
var/datum/orbit/orbiting = null
var/cached_transform = null

/atom
Expand Down Expand Up @@ -104,7 +104,7 @@

/atom/movable/proc/stop_orbit()
SpinAnimation(0, 0)
qdel(orbiting)
QDEL_NULL(orbiting)
transform = cached_transform

/atom/Destroy()
Expand Down
Loading