From a94a0e727cc0a0bf2195121b404e4a1edf57173b Mon Sep 17 00:00:00 2001 From: Cameron Lennox Date: Wed, 28 Jan 2026 21:56:00 -0500 Subject: [PATCH] Fixes tsci infinite teleport (#19104) * Fixes tsci infinite teleport * Update telesci_computer.dm * use COOLER COOLDOWN --- code/modules/telesci/telesci_computer.dm | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm index fed37f47d21..85fb0c83bd7 100644 --- a/code/modules/telesci/telesci_computer.dm +++ b/code/modules/telesci/telesci_computer.dm @@ -20,7 +20,7 @@ var/distance = 5 // Based on the distance used - var/teleport_cooldown = 0 + COOLDOWN_DECLARE(teleport_cooldown) var/teleporting = 0 var/starting_crystals = 0 var/max_crystals = 4 @@ -101,7 +101,7 @@ data["insertedGps"] = inserted_gps data["rotation"] = rotation data["currentZ"] = z_co - data["cooldown"] = max(0, min(100, round(teleport_cooldown - world.time) / 10)) + data["cooldown"] = max(0, min(100, COOLDOWN_TIMELEFT(src, teleport_cooldown) / 10)) data["crystalCount"] = crystals.len data["maxCrystals"] = max_crystals data["maxPossibleDistance"] = FLOOR((max_crystals * powerCoefficient * 6), 1); // max efficiency is 6 @@ -154,9 +154,9 @@ if(last_target && inserted_gps) // TODO - What was this even supposed to do?? //inserted_gps.locked_location = last_target - temp_msg = "Location saved." + temp_msg = "Function Deprecated. No action taken." else - temp_msg = "ERROR! No data was stored." + temp_msg = "Function Deprecated. No action taken." if("send") sending = 1 @@ -188,6 +188,7 @@ return /obj/machinery/computer/telescience/proc/telefail() + COOLDOWN_START(src, teleport_cooldown, (2 SECONDS)) switch(rand(99)) if(0 to 80) sparks() @@ -232,9 +233,7 @@ /obj/machinery/computer/telescience/proc/doteleport(mob/user) - if(teleport_cooldown > world.time) - return - if(teleporting) + if(!COOLDOWN_FINISHED(src, teleport_cooldown)) return if(telepad) @@ -270,7 +269,7 @@ if(telepad.inoperable()) return teleporting = 0 - teleport_cooldown = world.time + (spawn_time * 2) + COOLDOWN_START(src, teleport_cooldown, (spawn_time * 2)) teles_left -= 1 // use a lot of power @@ -348,6 +347,12 @@ updateDialog() /obj/machinery/computer/telescience/proc/teleport(mob/user) + if(!COOLDOWN_FINISHED(src, teleport_cooldown)) + temp_msg = "ERROR! Teleportation console is cooling down. Please wait." + return + if(teleporting) + temp_msg = "ERROR! Teleportation in progress. Please wait." + return distance = CLAMP(distance, 0, get_max_allowed_distance()) if(rotation == null || distance == null || z_co == null) temp_msg = "ERROR! Set a distance, rotation and sector."