[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:
Qwertytoforty
2024-02-17 21:54:25 -05:00
committed by GitHub
parent 0fab01814a
commit bc5f3de1cf
3 changed files with 30 additions and 7 deletions
+9
View File
@@ -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()