From 3d5138261ff951526e5cb7715946398caec93745 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 2 Sep 2020 03:16:39 +0200 Subject: [PATCH] [MIRROR] The great Spectral Blade permanent ghost trap unGBJing - 10/10 ghosts currently hate this blade (#622) * The great Spectral Blade permanent ghost trap unGBJing - 10/10 ghosts currently hate this blade (#53324) Fixes a bug caused by transferring an orbiter component to a parent where one already exists. Causing the old original orbiter to update the added ghosts positions when the parent moves, but not allowing them to ever break orbit and also setting the ref to null for the component on the whole due to old signals it would seem. Also tweaks the blades use in hand ghost notification message to remove the redundant (Orbit) link. * The great Spectral Blade permanent ghost trap unGBJing - 10/10 ghosts currently hate this blade Co-authored-by: Wayland-Smithy <64715958+Wayland-Smithy@users.noreply.github.com> --- code/datums/components/orbiter.dm | 15 ++++++++++++--- code/modules/mining/lavaland/necropolis_chests.dm | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/code/datums/components/orbiter.dm b/code/datums/components/orbiter.dm index 5c8242f2895..f645ed830e8 100644 --- a/code/datums/components/orbiter.dm +++ b/code/datums/components/orbiter.dm @@ -25,13 +25,15 @@ tracker = new(target, CALLBACK(src, .proc/move_react)) /datum/component/orbiter/UnregisterFromParent() + UnregisterSignal(parent, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE) var/atom/target = parent target.orbiters = null QDEL_NULL(tracker) /datum/component/orbiter/Destroy() var/atom/master = parent - master.orbiters = null + if(master.orbiters == src) + master.orbiters = null for(var/i in orbiters) end_orbit(i) orbiters = null @@ -39,10 +41,19 @@ /datum/component/orbiter/InheritComponent(datum/component/orbiter/newcomp, original, atom/movable/orbiter, radius, clockwise, rotation_speed, rotation_segments, pre_rotation) if(!newcomp) + RegisterSignal(parent, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, .proc/orbiter_glide_size_update) begin_orbit(arglist(args.Copy(3))) return // The following only happens on component transfers + for(var/o in newcomp.orbiters) + var/atom/movable/incoming_orbiter = o + incoming_orbiter.orbiting = src + // It is important to transfer the signals so we don't get locked to the new orbiter component for all time + newcomp.UnregisterSignal(incoming_orbiter, COMSIG_MOVABLE_MOVED) + RegisterSignal(incoming_orbiter, COMSIG_MOVABLE_MOVED, .proc/orbiter_move_react) + orbiters += newcomp.orbiters + newcomp.orbiters = null /datum/component/orbiter/PostTransfer() if(!isatom(parent) || isarea(parent) || !get_turf(parent)) @@ -58,7 +69,6 @@ orbiters[orbiter] = TRUE orbiter.orbiting = src RegisterSignal(orbiter, COMSIG_MOVABLE_MOVED, .proc/orbiter_move_react) - RegisterSignal(parent, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, .proc/orbiter_glide_size_update) SEND_SIGNAL(parent, COMSIG_ATOM_ORBIT_BEGIN, orbiter) @@ -94,7 +104,6 @@ if(!orbiters[orbiter]) return UnregisterSignal(orbiter, COMSIG_MOVABLE_MOVED) - UnregisterSignal(parent, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE) SEND_SIGNAL(parent, COMSIG_ATOM_ORBIT_STOP, orbiter) orbiter.SpinAnimation(0, 0) if(istype(orbiters[orbiter],/matrix)) //This is ugly. diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index 7464b9f46e1..882dabdcf4f 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -853,7 +853,7 @@ notify_ghosts("[user] is raising [user.p_their()] [src], calling for your help!", enter_link="(Click to help)", - source = user, action=NOTIFY_ORBIT, ignore_key = POLL_IGNORE_SPECTRAL_BLADE, header = "Spectral blade") + source = user, ignore_key = POLL_IGNORE_SPECTRAL_BLADE, header = "Spectral blade") summon_cooldown = world.time + 600