[READY]Refactors timestops to use fields (#30858)

* kek

* fixes

* Fixes

* fixes

* throw freeze

* woops

* double woops
This commit is contained in:
kevinz000
2017-09-28 19:46:10 -07:00
committed by CitadelStationBot
parent d25894447e
commit 724fa8ce54
7 changed files with 150 additions and 87 deletions
@@ -542,84 +542,6 @@
log_admin("[key_name(G)] was made a golem by [key_name(user)].")
qdel(src)
/obj/effect/timestop
anchored = TRUE
name = "chronofield"
desc = "ZA WARUDO"
icon = 'icons/effects/160x160.dmi'
icon_state = "time"
layer = FLY_LAYER
pixel_x = -64
pixel_y = -64
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
var/mob/living/immune = list() // the one who creates the timestop is immune
var/list/stopped_atoms = list()
var/freezerange = 2
var/duration = 140
alpha = 125
/obj/effect/timestop/Initialize()
. = ..()
for(var/mob/living/L in GLOB.player_list)
if(locate(/obj/effect/proc_holder/spell/aoe_turf/conjure/timestop) in L.mind.spell_list) //People who can stop time are immune to its effects
immune += L
timestop()
/obj/effect/timestop/proc/timestop()
set waitfor = FALSE
playsound(src, 'sound/magic/timeparadox2.ogg', 75, 1, -1)
for(var/i in 1 to duration-1)
for(var/atom/A in orange (freezerange, src.loc))
if(isliving(A))
var/mob/living/M = A
if(M in immune)
continue
M.Stun(200, 1, 1)
M.anchored = TRUE
if(ishostile(M))
var/mob/living/simple_animal/hostile/H = M
H.AIStatus = AI_OFF
H.LoseTarget()
stopped_atoms |= M
else if(istype(A, /obj/item/projectile))
var/obj/item/projectile/P = A
P.paused = TRUE
stopped_atoms |= P
for(var/mob/living/M in stopped_atoms)
if(get_dist(get_turf(M),get_turf(src)) > freezerange) //If they lagged/ran past the timestop somehow, just ignore them
unfreeze_mob(M)
stopped_atoms -= M
stoplag()
//End
playsound(src, 'sound/magic/timeparadox2.ogg', 75, TRUE, frequency = -1) //reverse!
for(var/mob/living/M in stopped_atoms)
unfreeze_mob(M)
for(var/obj/item/projectile/P in stopped_atoms)
P.paused = FALSE
qdel(src)
return
/obj/effect/timestop/proc/unfreeze_mob(mob/living/M)
M.AdjustStun(-200, 1, 1)
M.anchored = FALSE
if(ishostile(M))
var/mob/living/simple_animal/hostile/H = M
H.AIStatus = initial(H.AIStatus)
/obj/effect/timestop/wizard
duration = 100
/obj/item/stack/tile/bluespace
name = "bluespace floor tile"
singular_name = "floor tile"