mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
[s] blocks all teleport sources from infinite looping, reverts 24191 (#24213)
* [s] blocks all teleport sources from infinite looping, reverts 24191 * defines it * renames * Update teleporter.dm * drops icon * Update code/game/machinery/teleporter.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * Update code/game/objects/effects/portals.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * Update code/game/objects/effects/portals.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * Update code/game/machinery/teleporter.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> --------- Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
@@ -605,3 +605,5 @@
|
||||
#define TS_INFESTATION_WHITE_SPIDER 3
|
||||
#define TS_INFESTATION_PRINCESS_SPIDER 4
|
||||
#define TS_INFESTATION_QUEEN_SPIDER 5
|
||||
|
||||
#define MAX_ALLOWED_TELEPORTS_PER_PROCESS 20
|
||||
|
||||
@@ -307,9 +307,10 @@
|
||||
|
||||
/obj/machinery/teleport
|
||||
name = "teleport"
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
///Used by the teleporter hub and permament teleporter to track how many teleports have been done this cycle.
|
||||
var/teleports_this_cycle = 0
|
||||
|
||||
/**
|
||||
Internal helper function
|
||||
@@ -363,6 +364,9 @@
|
||||
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
|
||||
RefreshParts()
|
||||
|
||||
/obj/machinery/teleport/hub/process()
|
||||
teleports_this_cycle = 0
|
||||
|
||||
/obj/machinery/teleport/hub/Destroy()
|
||||
if(power_station)
|
||||
power_station.teleporter_hub = null
|
||||
@@ -418,6 +422,8 @@
|
||||
var/obj/machinery/computer/teleporter/com = power_station.teleporter_console
|
||||
if(!com)
|
||||
return
|
||||
if(MAX_ALLOWED_TELEPORTS_PER_PROCESS <= teleports_this_cycle)
|
||||
return
|
||||
if(!com.target)
|
||||
visible_message("<span class='alert'>Cannot authenticate locked on coordinates. Please reinstate coordinate matrix.</span>")
|
||||
return
|
||||
@@ -432,6 +438,7 @@
|
||||
. = do_teleport(M, com.target, bypass_area_flag = com.area_bypass)
|
||||
if(accurate < 3)
|
||||
calibrated = FALSE
|
||||
teleports_this_cycle++
|
||||
|
||||
/obj/machinery/teleport/hub/update_icon_state()
|
||||
if(panel_open)
|
||||
@@ -472,13 +479,16 @@
|
||||
. = ..()
|
||||
update_lighting()
|
||||
|
||||
/obj/machinery/teleport/perma/process()
|
||||
teleports_this_cycle = 0
|
||||
|
||||
/obj/machinery/teleport/perma/RefreshParts()
|
||||
for(var/obj/item/circuitboard/teleporter_perma/C in component_parts)
|
||||
target = C.target
|
||||
var/A = 40
|
||||
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
|
||||
A -= M.rating * 10
|
||||
tele_delay = max(A, 1) // prevents you from teleporting 50000 times in a single tick
|
||||
tele_delay = max(A, 0)
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
|
||||
/obj/machinery/teleport/perma/Crossed(atom/movable/AM, oldloc)
|
||||
@@ -488,13 +498,15 @@
|
||||
to_chat(AM, "You can't use this here.")
|
||||
return
|
||||
|
||||
if(target && !recalibrating && !panel_open && !blockAI(AM))
|
||||
if(target && !recalibrating && !panel_open && !blockAI(AM) && (teleports_this_cycle <= MAX_ALLOWED_TELEPORTS_PER_PROCESS))
|
||||
do_teleport(AM, target)
|
||||
use_power(5000)
|
||||
recalibrating = TRUE
|
||||
update_icon(UPDATE_ICON_STATE | UPDATE_OVERLAYS)
|
||||
update_lighting()
|
||||
addtimer(CALLBACK(src, PROC_REF(CrossedCallback)), max(tele_delay, 1))
|
||||
teleports_this_cycle++
|
||||
if(tele_delay)
|
||||
recalibrating = TRUE
|
||||
update_icon(UPDATE_ICON_STATE | UPDATE_OVERLAYS)
|
||||
update_lighting()
|
||||
addtimer(CALLBACK(src, PROC_REF(CrossedCallback)), tele_delay)
|
||||
|
||||
/obj/machinery/teleport/perma/proc/CrossedCallback()
|
||||
recalibrating = FALSE
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
var/effect_cooldown = 0
|
||||
///Whether or not portal use will cause sparks
|
||||
var/create_sparks = TRUE
|
||||
var/teleports_this_cycle = 0
|
||||
|
||||
/obj/effect/portal/New(loc, turf/_target, obj/creation_object = null, lifespan = 300, mob/creation_mob = null, create_sparks = TRUE)
|
||||
..()
|
||||
@@ -36,6 +37,7 @@
|
||||
else
|
||||
creation_obj_data = list(null, null)
|
||||
creation_mob_ckey = creation_mob?.ckey
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
if(lifespan > 0)
|
||||
QDEL_IN(src, lifespan)
|
||||
@@ -48,8 +50,12 @@
|
||||
target = null
|
||||
if(create_sparks)
|
||||
do_sparks(5, 0, loc)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return ..()
|
||||
|
||||
/obj/effect/portal/process()
|
||||
teleports_this_cycle = 0
|
||||
|
||||
/obj/effect/portal/singularity_pull()
|
||||
return
|
||||
|
||||
@@ -132,6 +138,8 @@
|
||||
return TRUE
|
||||
|
||||
/obj/effect/portal/proc/attempt_teleport(atom/movable/victim, turf/destination, variance = 0, force_teleport = TRUE)
|
||||
if(teleports_this_cycle >= MAX_ALLOWED_TELEPORTS_PER_PROCESS)
|
||||
return
|
||||
var/use_effects = world.time >= effect_cooldown
|
||||
var/effect = null // Will result in the default effect being used
|
||||
if(!use_effects)
|
||||
@@ -141,6 +149,7 @@
|
||||
invalid_teleport()
|
||||
return FALSE
|
||||
effect_cooldown = world.time + EFFECT_COOLDOWN
|
||||
teleports_this_cycle++
|
||||
return TRUE
|
||||
|
||||
/obj/effect/portal/proc/invalid_teleport()
|
||||
|
||||
Reference in New Issue
Block a user