mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-23 03:37:08 +01:00
tl;dr level collections that can easily be logically restructured/moved as necessary will eventually be used for radio and overmaps location resolution. this is the last part of https://github.com/Citadel-Station-13/Citadel-Station-13-RP/pull/4841 that has not yet been integrated. this will be a draft for a while. --------- Co-authored-by: LetterN <24603524+LetterN@users.noreply.github.com>
41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
SUBSYSTEM_DEF(turbolifts)
|
|
name = "Turbolifts"
|
|
subsystem_flags = SS_NO_INIT
|
|
wait = 1 SECONDS
|
|
var/static/list/moving_lifts = list()
|
|
var/list/currentrun
|
|
|
|
/datum/controller/subsystem/turbolifts/fire(resumed)
|
|
if (!resumed)
|
|
currentrun = moving_lifts.Copy()
|
|
|
|
for(var/liftref in currentrun)
|
|
currentrun -= liftref
|
|
if(world.time < currentrun[liftref])
|
|
continue
|
|
var/datum/turbolift/lift = locate(liftref)
|
|
if(lift.busy) // shouldn't happen as currentrun should contain valid, non-busy ones
|
|
continue
|
|
|
|
lift.busy = TRUE
|
|
var/floor_delay
|
|
if(!(floor_delay = lift.do_move()))
|
|
// we are done, remove ourself from the lift queue
|
|
moving_lifts[liftref] = null
|
|
moving_lifts -= liftref
|
|
if(lift.target_floor)
|
|
lift.target_floor.ext_panel.reset()
|
|
lift.target_floor = null
|
|
else
|
|
lift_is_moving(lift,floor_delay)
|
|
lift.busy = FALSE
|
|
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
|
|
/datum/controller/subsystem/turbolifts/proc/lift_is_moving(datum/turbolift/lift, floor_delay)
|
|
var/lift_ref = "[REF(lift)]"
|
|
moving_lifts[lift_ref] = world.time + floor_delay
|
|
if(currentrun[lift_ref])
|
|
currentrun[lift_ref] = world.time + floor_delay
|