Merge pull request #9510 from Ghommie/Ghommie-cit240

Fixing tracking implant teleport issues.
This commit is contained in:
kevinz000
2019-10-17 13:05:15 -07:00
committed by GitHub
4 changed files with 38 additions and 3 deletions

View File

@@ -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)

View File

@@ -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, "<span class='alert'>No active connected stations located.</span>")
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)

View File

@@ -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()

View File

@@ -187,8 +187,13 @@
user.show_message("<span class='notice'>\The [src] is recharging!</span>")
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, "<span class='notice'>\The [src] is malfunctioning.</span>")
return
current_location = get_turf(user) //Recheck.