From c65115a9a5d186277e3df3c78af590c21d791099 Mon Sep 17 00:00:00 2001 From: Gabriel Adamson Date: Wed, 25 Aug 2021 15:08:10 -0500 Subject: [PATCH 1/2] Makes retrieval implants handle lockers --- .../items/implants/implant_teleporter.dm | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/yogstation/code/game/objects/items/implants/implant_teleporter.dm b/yogstation/code/game/objects/items/implants/implant_teleporter.dm index f9d5ef6c8a21..d766ed59002e 100644 --- a/yogstation/code/game/objects/items/implants/implant_teleporter.dm +++ b/yogstation/code/game/objects/items/implants/implant_teleporter.dm @@ -17,13 +17,16 @@ useblacklist = FALSE if(imp_in) - if(!is_centcom_level(imp_in.z)) //teleporting doesn't work on centcom + + var/turf/T = get_turf_global(imp_in) + + if(!is_centcom_level(T.z)) //teleporting doesn't work on centcom if(blacklist.len && useblacklist) var/i = 0 for(var/zlevel in blacklist) i++ - if(zlevel == imp_in.z) + if(zlevel == T.z) if(on && pointofreturn) retrieve_exile() else @@ -31,21 +34,22 @@ else if(!on && i >= blacklist.len) //we've just arrived on a non-blacklisted z, start blocking on = TRUE - pointofreturn = imp_in.loc //we'll teleport back here if we go out of bounds + pointofreturn = T //we'll teleport back here if we go out of bounds if(whitelist.len && usewhitelist) for(var/zlevel in whitelist) - if(zlevel == imp_in.z) + if(zlevel == T.z) if(!on) on = TRUE //we're on a whitelisted z, start blocking - pointofreturn = imp_in.loc //we'll teleport back here if we go out of bounds + pointofreturn = T //we'll teleport back here if we go out of bounds return // we're allowed here, stop if(on && pointofreturn) retrieve_exile() /obj/item/implant/teleporter/proc/retrieve_exile() - if(!is_centcom_level(imp_in.z)) + var/turf/T = get_turf_global(imp_in) + if(!is_centcom_level(T.z)) do_teleport(imp_in, pointofreturn, 0, channel = TELEPORT_CHANNEL_WORMHOLE) say(retrievalmessage) @@ -80,13 +84,13 @@ if(user) log_combat(user, target, "implanted", object="[name]") - + var/turf/T = get_turf_global(imp_in) if(useblacklist && !blacklist.len) - blacklist += imp_in.z + blacklist += T.z if(usewhitelist && !whitelist.len) - whitelist += imp_in.z - pointofreturn = imp_in.loc + whitelist += T.z + pointofreturn = T return 1 From 2de34070a84e29c3f97ada4d3c5f0dde35ed5b8e Mon Sep 17 00:00:00 2001 From: Jamie D <993128+JamieD1@users.noreply.github.com> Date: Mon, 30 Aug 2021 12:33:37 +0100 Subject: [PATCH 2/2] Apply suggestions from code review --- .../code/game/objects/items/implants/implant_teleporter.dm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/yogstation/code/game/objects/items/implants/implant_teleporter.dm b/yogstation/code/game/objects/items/implants/implant_teleporter.dm index d766ed59002e..858140d1b0cf 100644 --- a/yogstation/code/game/objects/items/implants/implant_teleporter.dm +++ b/yogstation/code/game/objects/items/implants/implant_teleporter.dm @@ -17,9 +17,7 @@ useblacklist = FALSE if(imp_in) - var/turf/T = get_turf_global(imp_in) - if(!is_centcom_level(T.z)) //teleporting doesn't work on centcom if(blacklist.len && useblacklist) @@ -43,7 +41,6 @@ on = TRUE //we're on a whitelisted z, start blocking pointofreturn = T //we'll teleport back here if we go out of bounds return // we're allowed here, stop - if(on && pointofreturn) retrieve_exile() @@ -91,7 +88,6 @@ if(usewhitelist && !whitelist.len) whitelist += T.z pointofreturn = T - return 1 /obj/item/implant/teleporter/removed(mob/living/source, silent = 0, special = 0)