From 7e3a8124601c63405bff8d1a7738afc62f4c6f97 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Tue, 15 Oct 2019 21:32:01 +0200
Subject: [PATCH 1/5] Fixing tracking implant teleport issues.
---
code/__DEFINES/components.dm | 1 +
code/game/machinery/computer/teleporter.dm | 17 ++++++++++++++++-
code/game/objects/items/implants/implant.dm | 3 ++-
code/game/objects/items/teleportation.dm | 7 ++++++-
4 files changed, 25 insertions(+), 3 deletions(-)
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..2682c60144 100644
--- a/code/game/machinery/computer/teleporter.dm
+++ b/code/game/machinery/computer/teleporter.dm
@@ -132,10 +132,18 @@
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
target = L[desc]
+ if(isliving(target)) //we need to 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, 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)]")
@@ -164,6 +172,13 @@
target_station.teleporter_console.stat &= ~NOPOWER
target_station.teleporter_console.update_icon()
+/obj/machinery/computer/teleporter/proc/untarget_implant(obj/item/implant/I) //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(I, COMSIG_IMPLANT_REMOVING)
+
/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.
From 839f324c99a777660ccb5d4450c169a56d8ddb17 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Tue, 15 Oct 2019 21:39:13 +0200
Subject: [PATCH 2/5] I need a code quality test.
---
code/game/machinery/computer/teleporter.dm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm
index 2682c60144..33cf26b896 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()
. = ..()
@@ -115,6 +116,9 @@
regime_set = "Teleporter"
/obj/machinery/computer/teleporter/proc/set_target(mob/user)
+ if(imp_t)
+ UnregisterSignal(imp_t, COMSIG_IMPLANT_REMOVING)
+ imp_t = null
var/list/L = list()
var/list/areaindex = list()
if(regime_set == "Teleporter")
@@ -135,12 +139,16 @@
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(!desc)
+ target = null
+ return
target = L[desc]
if(isliving(target)) //we need to 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, I)
+ imp_t = I
else
target = null
return
From 32013f2aebbb0dad19aef7c41f14e4889d2b89b3 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Tue, 15 Oct 2019 21:59:27 +0200
Subject: [PATCH 3/5] More whacky situations.
---
code/game/machinery/computer/teleporter.dm | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm
index 33cf26b896..e605f0cdeb 100644
--- a/code/game/machinery/computer/teleporter.dm
+++ b/code/game/machinery/computer/teleporter.dm
@@ -110,15 +110,15 @@
/obj/machinery/computer/teleporter/proc/reset_regime()
target = null
+ if(imp_t)
+ UnregisterSignal(imp_t, COMSIG_IMPLANT_REMOVING)
+ impt_t = null
if(regime_set == "Teleporter")
regime_set = "Gate"
else
regime_set = "Teleporter"
/obj/machinery/computer/teleporter/proc/set_target(mob/user)
- if(imp_t)
- UnregisterSignal(imp_t, COMSIG_IMPLANT_REMOVING)
- imp_t = null
var/list/L = list()
var/list/areaindex = list()
if(regime_set == "Teleporter")
@@ -139,11 +139,13 @@
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(!desc)
- target = null
+ if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERY)) //check if we are still around
return
target = L[desc]
- if(isliving(target)) //we need to make sure the living mob is still implanted to be a valid target
+ if(imp_t)
+ UnregisterSignal(imp_t, COMSIG_IMPLANT_REMOVING)
+ impt_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)
@@ -165,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
From 80ba44e5a219fcad70241193296ecf02c827b75a Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Tue, 15 Oct 2019 22:03:38 +0200
Subject: [PATCH 4/5] Smells like work in progress
---
code/game/machinery/computer/teleporter.dm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm
index e605f0cdeb..0d8602334b 100644
--- a/code/game/machinery/computer/teleporter.dm
+++ b/code/game/machinery/computer/teleporter.dm
@@ -149,7 +149,7 @@
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, I)
+ RegisterSignal(I, COMSIG_IMPLANT_REMOVING, .proc/untarget_implant)
imp_t = I
else
target = null
@@ -184,12 +184,13 @@
target_station.teleporter_console.stat &= ~NOPOWER
target_station.teleporter_console.update_icon()
-/obj/machinery/computer/teleporter/proc/untarget_implant(obj/item/implant/I) //untargets from mob the racker was once implanted in to prevent issues.
+/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(I, COMSIG_IMPLANT_REMOVING)
+ 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)
From e8b777f16231aee749da3cd89b7ac50b35e7d2e2 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Wed, 16 Oct 2019 05:10:44 +0200
Subject: [PATCH 5/5] typo fixes
---
code/game/machinery/computer/teleporter.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm
index 0d8602334b..0e6a059c7b 100644
--- a/code/game/machinery/computer/teleporter.dm
+++ b/code/game/machinery/computer/teleporter.dm
@@ -112,7 +112,7 @@
target = null
if(imp_t)
UnregisterSignal(imp_t, COMSIG_IMPLANT_REMOVING)
- impt_t = null
+ imp_t = null
if(regime_set == "Teleporter")
regime_set = "Gate"
else
@@ -144,7 +144,7 @@
target = L[desc]
if(imp_t)
UnregisterSignal(imp_t, COMSIG_IMPLANT_REMOVING)
- impt_t = null
+ 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