From a02c0cb6511cff512893e4d64cf6a61b25cbd1f2 Mon Sep 17 00:00:00 2001
From: Viz <107632879+Inadvizable@users.noreply.github.com>
Date: Sun, 10 Jul 2022 13:48:53 +0200
Subject: [PATCH] Removes the stun from flashes and gives them a cooldown
(#18275)
* Like a tider in headlights
* witty commit name about cooldowns
* Chees- MY EYES!
* when your the the your the
* The name the the
---
code/game/objects/items/devices/flash.dm | 80 +++++++++---------------
1 file changed, 31 insertions(+), 49 deletions(-)
diff --git a/code/game/objects/items/devices/flash.dm b/code/game/objects/items/devices/flash.dm
index 73c25be78f0..b498314563c 100644
--- a/code/game/objects/items/devices/flash.dm
+++ b/code/game/objects/items/devices/flash.dm
@@ -19,6 +19,10 @@
var/battery_panel = 0 //whether the flash can be modified with a cell or not
var/overcharged = 0 //if overcharged the flash will set people on fire then immediately burn out (does so even if it doesn't blind them).
var/can_overcharge = TRUE //set this to FALSE if you don't want your flash to be overcharge capable
+ ///This tracks the world.time until the flash can be used again
+ var/cooldown
+ ///This is the duration of the cooldown
+ var/cooldown_duration = 5 SECONDS
var/use_sound = 'sound/weapons/flash.ogg'
/obj/item/flash/proc/clown_check(mob/user)
@@ -69,6 +73,10 @@
/obj/item/flash/proc/try_use_flash(mob/user = null)
+ if(cooldown >= world.time)
+ to_chat(user, "Your [name] is still too hot to use again!")
+ return FALSE
+ cooldown = world.time + cooldown_duration
flash_recharge(user)
if(broken)
@@ -93,14 +101,15 @@
if(M.flash_eyes(1, 1))
M.AdjustConfused(power)
terrible_conversion_proc(M, user)
- M.Stun(2 SECONDS)
- visible_message("[user] blinds [M] with the flash!")
- to_chat(user, "You blind [M] with the flash!")
- to_chat(M, "[user] blinds you with the flash!")
+ M.drop_l_hand()
+ M.drop_r_hand()
+ visible_message("[user] blinds [M] with [src]!")
+ to_chat(user, "You blind [M] with [src]!")
+ to_chat(M, "[user] blinds you with [src]!")
else
- visible_message("[user] fails to blind [M] with the flash!")
- to_chat(user, "You fail to blind [M] with the flash!")
- to_chat(M, "[user] fails to blind you with the flash!")
+ visible_message("[user] fails to blind [M] with [src]!")
+ to_chat(user, "You fail to blind [M] with [src]!")
+ to_chat(M, "[user] fails to blind you with [src]!")
return
if(M.flash_eyes())
@@ -128,7 +137,7 @@
/obj/item/flash/attack_self(mob/living/carbon/user, flag = 0, emp = 0)
if(!try_use_flash(user))
return 0
- user.visible_message("[user]'s [src] emits a blinding light!", "Your [src] emits a blinding light!")
+ user.visible_message("[user]'s [name] emits a blinding light!", "Your [name] emits a blinding light!")
for(var/mob/living/carbon/M in oviewers(3, null))
flash_carbon(M, user, 6 SECONDS, 0)
@@ -216,23 +225,14 @@
flash_cur_charges = min(flash_cur_charges+1, flash_max_charges)
return TRUE
-/obj/item/flash/cameraflash/attack(mob/living/M, mob/user)
- if(flash_cur_charges > 0)
- flash_cur_charges -= 1
- to_chat(user, "[src] now has [flash_cur_charges] charge\s.")
- ..()
- else
- to_chat(user, "\The [src] needs time to recharge!")
- return
-
-/obj/item/flash/cameraflash/attack_self(mob/living/carbon/user, flag = 0)
- if(flash_cur_charges > 0)
- flash_cur_charges -= 1
- to_chat(user, "[src] now has [flash_cur_charges] charge\s.")
- ..()
- else
- to_chat(user, "\The [src] needs time to recharge!")
- return
+/obj/item/flash/cameraflash/try_use_flash(mob/user = null)
+ if(!flash_cur_charges)
+ to_chat(user, "[src] needs time to recharge!")
+ return FALSE
+ . = ..()
+ if(.)
+ flash_cur_charges--
+ to_chat(user, "[src] now has [flash_cur_charges] charge\s.")
/obj/item/flash/memorizer
name = "memorizer"
@@ -243,34 +243,16 @@
/obj/item/flash/armimplant
name = "photon projector"
desc = "A high-powered photon projector implant normally used for lighting purposes, but also doubles as a flashbulb weapon. Self-repair protocols fix the flashbulb if it ever burns out."
- var/flashcd = 20
- var/overheat = 0
+ cooldown_duration = 2 SECONDS
var/obj/item/organ/internal/cyberimp/arm/flash/I = null
+/obj/item/flash/armimplant/burn_out()
+ if(I && I.owner)
+ to_chat(I.owner, "Your [name] implant overheats and deactivates!")
+ I.Retract()
+
/obj/item/flash/armimplant/Destroy()
I = null
return ..()
-/obj/item/flash/armimplant/burn_out()
- if(I && I.owner)
- to_chat(I.owner, "Your photon projector implant overheats and deactivates!")
- I.Retract()
- overheat = FALSE
- addtimer(CALLBACK(src, .proc/cooldown), flashcd * 2)
-
-/obj/item/flash/armimplant/try_use_flash(mob/user = null)
- if(overheat)
- if(I && I.owner)
- to_chat(I.owner, "Your photon projector is running too hot to be used again so quickly!")
- return FALSE
- overheat = TRUE
- addtimer(CALLBACK(src, .proc/cooldown), flashcd)
- playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1)
- update_icon(1)
- return TRUE
-
-/obj/item/flash/armimplant/proc/cooldown()
- overheat = FALSE
-
-
/obj/item/flash/synthetic //just a regular flash now