diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index d898ba2213..c2482f6fbf 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -197,6 +197,7 @@ #define COMPONENT_DELETE_OLD_IMPLANT 4 #define COMSIG_IMPLANT_EXISTING_UPLINK "implant_uplink_exists" //called on implants being implanted into someone with an uplink implant: (datum/component/uplink) //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 #define COMSIG_PDA_CHANGE_RINGTONE "pda_change_ringtone" //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 e50eeb8619..0e6a059c7b 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 + 6000 < 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 e7b55d53f5..0786172f25 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() diff --git a/code/game/objects/items/teleportation.dm b/code/game/objects/items/teleportation.dm index 5fa0624c0a..e16b0dd690 100644 --- a/code/game/objects/items/teleportation.dm +++ b/code/game/objects/items/teleportation.dm @@ -187,8 +187,13 @@ user.show_message("\The [src] is recharging!") return var/atom/T = L[t1] + var/implantcheckmate = FALSE + if(isliving(T)) + var/mob/living/M = T + if(!locate(/obj/item/implant/tracking) in M.implants) //The user was too slow and let the target mob's tracking implant expire or get removed. + implantcheckmate = TRUE var/area/A = get_area(T) - if(A.noteleport) + if(A.noteleport || implantcheckmate) to_chat(user, "\The [src] is malfunctioning.") return current_location = get_turf(user) //Recheck.