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
This commit is contained in:
Viz
2022-07-10 13:48:53 +02:00
committed by GitHub
parent 8288219cbf
commit a02c0cb651
+31 -49
View File
@@ -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, "<span class='warning'>Your [name] is still too hot to use again!</span>")
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("<span class='disarm'>[user] blinds [M] with the flash!</span>")
to_chat(user, "<span class='danger'>You blind [M] with the flash!</span>")
to_chat(M, "<span class='userdanger'>[user] blinds you with the flash!</span>")
M.drop_l_hand()
M.drop_r_hand()
visible_message("<span class='disarm'>[user] blinds [M] with [src]!</span>")
to_chat(user, "<span class='danger'>You blind [M] with [src]!</span>")
to_chat(M, "<span class='userdanger'>[user] blinds you with [src]!</span>")
else
visible_message("<span class='disarm'>[user] fails to blind [M] with the flash!</span>")
to_chat(user, "<span class='warning'>You fail to blind [M] with the flash!</span>")
to_chat(M, "<span class='danger'>[user] fails to blind you with the flash!</span>")
visible_message("<span class='disarm'>[user] fails to blind [M] with [src]!</span>")
to_chat(user, "<span class='warning'>You fail to blind [M] with [src]!</span>")
to_chat(M, "<span class='danger'>[user] fails to blind you with [src]!</span>")
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("<span class='disarm'>[user]'s [src] emits a blinding light!</span>", "<span class='danger'>Your [src] emits a blinding light!</span>")
user.visible_message("<span class='disarm'>[user]'s [name] emits a blinding light!</span>", "<span class='danger'>Your [name] emits a blinding light!</span>")
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, "<span class='warning'>\The [src] needs time to recharge!</span>")
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, "<span class='warning'>\The [src] needs time to recharge!</span>")
return
/obj/item/flash/cameraflash/try_use_flash(mob/user = null)
if(!flash_cur_charges)
to_chat(user, "<span class='warning'>[src] needs time to recharge!</span>")
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, "<span class='warning'>Your [name] implant overheats and deactivates!</span>")
I.Retract()
/obj/item/flash/armimplant/Destroy()
I = null
return ..()
/obj/item/flash/armimplant/burn_out()
if(I && I.owner)
to_chat(I.owner, "<span class='warning'>Your photon projector implant overheats and deactivates!</span>")
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, "<span class='warning'>Your photon projector is running too hot to be used again so quickly!</span>")
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