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
@@ -109,21 +109,22 @@
if(open_status == STATION_TUBE_CLOSED)
icon_state = "opening_[base_icon]"
open_status = STATION_TUBE_OPENING
spawn(OPEN_DURATION)
if(open_status == STATION_TUBE_OPENING)
icon_state = "open_[base_icon]"
open_status = STATION_TUBE_OPEN
addtimer(CALLBACK(src, .proc/finish_animation), OPEN_DURATION)
/obj/structure/transit_tube/station/proc/finish_animation()
switch(open_status)
if(STATION_TUBE_OPENING)
icon_state = "open_[base_icon]"
open_status = STATION_TUBE_OPEN
if(STATION_TUBE_CLOSING)
icon_state = "closed_[base_icon]"
open_status = STATION_TUBE_CLOSED
/obj/structure/transit_tube/station/proc/close_animation()
if(open_status == STATION_TUBE_OPEN)
icon_state = "closing_[base_icon]"
open_status = STATION_TUBE_CLOSING
spawn(CLOSE_DURATION)
if(open_status == STATION_TUBE_CLOSING)
icon_state = "closed_[base_icon]"
open_status = STATION_TUBE_CLOSED
addtimer(CALLBACK(src, .proc/finish_animation), CLOSE_DURATION)
/obj/structure/transit_tube/station/proc/launch_pod()
if(launch_cooldown >= world.time)
@@ -145,19 +146,25 @@
/obj/structure/transit_tube/station/pod_stopped(obj/structure/transit_tube_pod/pod, from_dir)
pod_moving = TRUE
spawn(5)
if(reverse_launch)
pod.setDir(tube_dirs[1]) //turning the pod around for next launch.
launch_cooldown = world.time + cooldown_delay
open_animation()
sleep(OPEN_DURATION + 2)
pod_moving = FALSE
if(!QDELETED(pod))
var/datum/gas_mixture/floor_mixture = loc.return_air()
floor_mixture.archive()
pod.air_contents.archive()
pod.air_contents.share(floor_mixture, 1) //mix the pod's gas mixture with the tile it's on
air_update_turf()
addtimer(CALLBACK(src, .proc/start_stopped, pod), 5)
/obj/structure/transit_tube/station/proc/start_stopped(obj/structure/transit_tube_pod/pod)
if(QDELETED(pod))
return
if(reverse_launch)
pod.setDir(tube_dirs[1]) //turning the pod around for next launch.
launch_cooldown = world.time + cooldown_delay
open_animation()
addtimer(CALLBACK(src, .proc/finish_stopped, pod), OPEN_DURATION + 2)
/obj/structure/transit_tube/station/proc/finish_stopped(obj/structure/transit_tube_pod/pod)
pod_moving = FALSE
if(!QDELETED(pod))
var/datum/gas_mixture/floor_mixture = loc.return_air()
floor_mixture.archive()
pod.air_contents.archive()
pod.air_contents.share(floor_mixture, 1) //mix the pod's gas mixture with the tile it's on
air_update_turf()
/obj/structure/transit_tube/station/init_tube_dirs()
switch(dir)