From c6b3d33b022da8495c596f9d44bc83a246b1f295 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 16 Apr 2022 01:57:53 +0200 Subject: [PATCH] [MIRROR] Bluespace Golems can no longer spam teleport [MDB IGNORE] (#12795) * Bluespace Golems can no longer spam teleport (#66195) Co-authored-by: Kylerace * Bluespace Golems can no longer spam teleport Co-authored-by: Alex Pynnonen Co-authored-by: Kylerace --- .../mob/living/carbon/human/species_types/golems.dm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm index eb8e23fcdfb..1563e36e5f7 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -551,18 +551,22 @@ icon_icon = 'icons/mob/actions/actions_spells.dmi' var/cooldown = 150 var/last_teleport = 0 + ///Set to true upon action activation to prevent spamming teleport callbacks while the first is still occurring. + var/is_charging = FALSE /datum/action/innate/unstable_teleport/IsAvailable() . = ..() if(!.) return - if(world.time > last_teleport + cooldown) + if(world.time > last_teleport + cooldown && !is_charging) return TRUE return FALSE /datum/action/innate/unstable_teleport/Activate() var/mob/living/carbon/human/H = owner H.visible_message(span_warning("[H] starts vibrating!"), span_danger("You start charging your bluespace core...")) + is_charging = TRUE + UpdateButtons() //action icon looks unavailable playsound(get_turf(H), 'sound/weapons/flash.ogg', 25, TRUE) addtimer(CALLBACK(src, .proc/teleport, H), 15) @@ -574,9 +578,8 @@ spark_system.start() do_teleport(H, get_turf(H), 12, asoundin = 'sound/weapons/emitter2.ogg', channel = TELEPORT_CHANNEL_BLUESPACE) last_teleport = world.time - UpdateButtons() //action icon looks unavailable - //action icon looks available again - addtimer(CALLBACK(src, .proc/UpdateButtons), cooldown + 5) + is_charging = FALSE + addtimer(CALLBACK(src, .proc/UpdateButtons), cooldown + 5) //action icon looks available again //honk