Remove spawn in favour of timers (#50562)

* Remove spawn in favour of timers

* aaaaaa

* Qdels

Co-Authored-By: Rohesie <rohesie@gmail.com>

Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
spookydonut
2020-04-27 02:15:36 -03:00
committed by GitHub
co-authored by Rohesie
parent eb90d1e20b
commit d18dbc8226
11 changed files with 197 additions and 158 deletions
+5 -3
View File
@@ -1081,9 +1081,11 @@ GLOBAL_LIST_EMPTY(PDAs)
for(var/atom/A in src)
A.emp_act(severity)
if (!(. & EMP_PROTECT_SELF))
emped += 1
spawn(200 * severity)
emped -= 1
emped++
addtimer(CALLBACK(src, .proc/emp_end), 200 * severity)
/obj/item/pda/proc/emp_end()
emped--
/proc/get_viewable_pdas(sort_by_job = FALSE)
. = list()
@@ -88,20 +88,19 @@ effective or pretty fucking useless.
var/cooldown = get_cooldown()
used = TRUE
icon_state = "health1"
handle_cooldown(cooldown) // splits off to handle the cooldown while handling wavelength
addtimer(VARSET_CALLBACK(src, used, FALSE), cooldown)
addtimer(VARSET_CALLBACK(src, icon_state, "health"), cooldown)
to_chat(user, "<span class='warning'>Successfully irradiated [M].</span>")
spawn((wavelength+(intensity*4))*5)
if(M)
if(intensity >= 5)
M.apply_effect(round(intensity/0.075), EFFECT_UNCONSCIOUS)
M.rad_act(intensity*10)
addtimer(CALLBACK(src, .proc/radiation_aftereffect, M), (wavelength+(intensity*4))*5)
else
to_chat(user, "<span class='warning'>The radioactive microlaser is still recharging.</span>")
/obj/item/healthanalyzer/rad_laser/proc/handle_cooldown(cooldown)
spawn(cooldown)
used = FALSE
icon_state = "health"
/obj/item/healthanalyzer/rad_laser/proc/radiation_aftereffect(mob/living/M)
if(QDELETED(M))
return
if(intensity >= 5)
M.apply_effect(round(intensity/0.075), EFFECT_UNCONSCIOUS)
M.rad_act(intensity*10)
/obj/item/healthanalyzer/rad_laser/proc/get_cooldown()
return round(max(10, (stealth*30 + intensity*5 - wavelength/4)))