Fixes the Teleporter Console not updating the target list (#15295)

* Teleporter list fix

* . = ..()

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
This commit is contained in:
SabreML
2021-01-16 20:45:22 +00:00
committed by GitHub
co-authored by AffectedArc07
parent 9480211187
commit 787b2ad39a
2 changed files with 25 additions and 27 deletions
+2 -2
View File
@@ -33,8 +33,8 @@
/obj/machinery/computer/process()
if(stat & (NOPOWER|BROKEN))
return 0
return 1
return FALSE
return TRUE
/obj/machinery/computer/extinguish_light()
set_light(0)
+23 -25
View File
@@ -8,13 +8,17 @@
icon_screen = "teleport"
icon_keyboard = "teleport_key"
circuit = /obj/item/circuitboard/teleporter
var/obj/item/gps/locked = null /// A GPS with a locked destination
var/regime = REGIME_TELEPORT /// Switches mode between teleporter, gate and gps
/// A GPS with a locked destination
var/obj/item/gps/locked = null
/// Switches mode between teleporter, gate and gps
var/regime = REGIME_TELEPORT
var/id = null
var/obj/machinery/teleport/station/power_station /// The power station that's connected to the console
var/calibrating = FALSE /// Whether calibration is in progress or not. Calibration prevents changes.
var/turf/target ///The target turf of the teleporter
var/target_list ///lists of suitable teleport targets, dependent on regime. Used in the UI
/// The power station that's connected to the console
var/obj/machinery/teleport/station/power_station
/// Whether calibration is in progress or not. Calibration prevents changes.
var/calibrating = FALSE
/// The target turf of the teleporter
var/turf/target
/* var/area_bypass is for one-time-use teleport cards (such as clown planet coordinates.)
Setting this to TRUE will set var/obj/item/gps/locked to null after a player enters the portal and will not allow hand-teles to open portals to that location.
@@ -22,17 +26,11 @@
var/area_bypass = FALSE
var/cc_beacon = FALSE
/obj/machinery/computer/teleporter/New()
src.id = "[rand(1000, 9999)]"
link_power_station()
..()
return
/obj/machinery/computer/teleporter/Initialize()
..()
. = ..()
link_power_station()
update_icon()
target_list = targets_teleport()
id = "[rand(1000, 9999)]"
/obj/machinery/computer/teleporter/Destroy()
if(power_station)
@@ -98,7 +96,14 @@
data["target"] = (!target || !targetarea) ? "None" : sanitize(targetarea.name)
data["calibrating"] = calibrating
data["locked"] = locked ? TRUE : FALSE
data["targetsTeleport"] = target_list
data["targetsTeleport"] = null
switch(regime)
if(REGIME_TELEPORT)
data["targetsTeleport"] = targets_teleport()
if(REGIME_GATE)
data["targetsTeleport"] = targets_gate()
if(REGIME_GPS)
data["targetsTeleport"] = null //clears existing entries, target is added by load action
return data
/obj/machinery/computer/teleporter/ui_act(action, params)
@@ -118,21 +123,15 @@
if("eject") //eject gps device
eject()
if("load") //load gps coordinates
target = locate(locked.locked_location.x,locked.locked_location.y,locked.locked_location.z)
target = locate(locked.locked_location.x, locked.locked_location.y, locked.locked_location.z)
if("setregime")
regime = text2num(params["regime"])
if(regime == REGIME_TELEPORT)
target_list = targets_teleport()
if(regime == REGIME_GATE)
target_list = targets_gate()
if(regime == REGIME_GPS)
target_list = null //clears existing entries, target is added by load action
resetPowerstation()
target = null
if("settarget")
resetPowerstation()
var/turf/tmpTarget = locate(text2num(params["x"]),text2num(params["y"]),text2num(params["z"]))
if(!istype(tmpTarget, /turf))
var/turf/tmpTarget = locate(text2num(params["x"]), text2num(params["y"]), text2num(params["z"]))
if(!isturf(tmpTarget))
atom_say("No valid targets available.")
return
target = tmpTarget
@@ -188,7 +187,6 @@
locked.loc = loc
locked = null
regime = REGIME_TELEPORT
target_list = targets_teleport()
/**
* Creates a list of viable targets for the teleport. Helper function of ui_data