From dffe949c3ad00fcfba27d40270cc180cf157d57e Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 21 May 2017 18:00:52 -0400 Subject: [PATCH] Fix teleporter discovery of hub and station requiring specific facing. * Teleporter would only search in the direction it was facing. As long as computers have no directional sprites this is fine, but otherwise it is a problem. Might as well do the sensible thing and search adjacent turfs. --- code/game/machinery/teleporter.dm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index 013001e388..b3c2c23f64 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -19,18 +19,24 @@ /obj/machinery/computer/teleporter/initialize() ..() - var/obj/machinery/teleport/station/station = locate(/obj/machinery/teleport/station, get_step(src, dir)) + var/obj/machinery/teleport/station/station var/obj/machinery/teleport/hub/hub - if(station) - hub = locate(/obj/machinery/teleport/hub, get_step(station, dir)) + + // Search surrounding turfs for the station, and then search the station's surrounding turfs for the hub. + for(var/direction in cardinal) + station = locate(/obj/machinery/teleport/station, get_step(src, direction)) + if(station) + for(direction in cardinal) + hub = locate(/obj/machinery/teleport/hub, get_step(station, direction)) + if(hub) + break + break if(istype(station)) station.com = hub - station.set_dir(dir) if(istype(hub)) hub.com = src - hub.set_dir(dir) /obj/machinery/computer/teleporter/attackby(I as obj, mob/living/user as mob) if(istype(I, /obj/item/weapon/card/data/))