From f85a275834027f23c4cbc73fcd6e193c50837ddd Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 17 Oct 2019 13:05:15 -0700 Subject: [PATCH] Merge pull request #9510 from Ghommie/Ghommie-cit240 Fixing tracking implant teleport issues. --- code/__DEFINES/dcs/signals.dm | 2 +- code/game/machinery/computer/teleporter.dm | 30 ++++++++++++++++++++- code/game/objects/items/implants/implant.dm | 3 ++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 8f02e79e..18a11e9c 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -499,7 +499,7 @@ ///called on implants being implanted into someone with an uplink implant: (datum/component/uplink) #define COMSIG_IMPLANT_EXISTING_UPLINK "implant_uplink_exists" //This uses all return values of COMSIG_IMPLANT_OTHER - +#define COMSIG_IMPLANT_REMOVING "implant_removing" //from base of /obj/item/implant/proc/removed() (list/args) // /obj/item/pda signals ///called on pda when the user changes the ringtone: (mob/living/user, new_ringtone) diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm index d0517c67..895b00ad 100644 --- a/code/game/machinery/computer/teleporter.dm +++ b/code/game/machinery/computer/teleporter.dm @@ -10,6 +10,7 @@ var/obj/machinery/teleport/station/power_station var/calibrating var/turf/target + var/obj/item/implant/imp_t /obj/machinery/computer/teleporter/Initialize() . = ..() @@ -109,6 +110,9 @@ /obj/machinery/computer/teleporter/proc/reset_regime() target = null + if(imp_t) + UnregisterSignal(imp_t, COMSIG_IMPLANT_REMOVING) + imp_t = null if(regime_set == "Teleporter") regime_set = "Gate" else @@ -132,10 +136,24 @@ if(M.timeofdeath + I.lifespan_postmortem < world.time) continue if(is_eligible(M)) - L[avoid_assoc_duplicate_keys(M.real_name, areaindex)] = I + L[avoid_assoc_duplicate_keys(M.real_name, areaindex)] = M var/desc = input("Please select a location to lock in.", "Locking Computer") as null|anything in L + if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERY)) //check if we are still around + return target = L[desc] + if(imp_t) + UnregisterSignal(imp_t, COMSIG_IMPLANT_REMOVING) + imp_t = null + if(isliving(target)) //make sure the living mob is still implanted to be a valid target + var/mob/living/M = target + var/obj/item/implant/tracking/I = locate() in M.implants + if(I) + RegisterSignal(I, COMSIG_IMPLANT_REMOVING, .proc/untarget_implant) + imp_t = I + else + target = null + return var/turf/T = get_turf(target) log_game("[key_name(user)] has set the teleporter target to [target] at [AREACOORD(T)]") @@ -149,6 +167,8 @@ to_chat(user, "No active connected stations located.") return var/desc = input("Please select a station to lock in.", "Locking Computer") as null|anything in L + if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERY)) //again, check if we are still around + return var/obj/machinery/teleport/station/target_station = L[desc] if(!target_station || !target_station.teleporter_hub) return @@ -164,6 +184,14 @@ target_station.teleporter_console.stat &= ~NOPOWER target_station.teleporter_console.update_icon() +/obj/machinery/computer/teleporter/proc/untarget_implant() //untargets from mob the racker was once implanted in to prevent issues. + target = null + if(power_station) + power_station.engaged = FALSE + power_station.teleporter_hub?.update_icon() + UnregisterSignal(imp_t, COMSIG_IMPLANT_REMOVING) + imp_t = null + /obj/machinery/computer/teleporter/proc/is_eligible(atom/movable/AM) var/turf/T = get_turf(AM) if(!T) diff --git a/code/game/objects/items/implants/implant.dm b/code/game/objects/items/implants/implant.dm index 47d0b804..2e25b487 100644 --- a/code/game/objects/items/implants/implant.dm +++ b/code/game/objects/items/implants/implant.dm @@ -89,11 +89,12 @@ return TRUE /obj/item/implant/proc/removed(mob/living/source, silent = FALSE, special = 0) + SEND_SIGNAL(src, COMSIG_IMPLANT_REMOVING, args) imp_in = null source.implants -= src for(var/X in actions) var/datum/action/A = X - A.Grant(source) + A.Remove(source) if(ishuman(source)) var/mob/living/carbon/human/H = source H.sec_hud_set_implants()