Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make turbolift pauseable #6861

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions code/controllers/subsystem/turbolift.dm
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
SUBSYSTEM_DEF(turbolifts)
name = "Turbolifts"
subsystem_flags = SS_NO_TICK_CHECK | SS_NO_INIT
subsystem_flags = SS_NO_INIT
wait = 10
var/static/list/moving_lifts = list()
var/list/currentrun

/datum/controller/subsystem/turbolifts/fire(resumed)
for(var/liftref in moving_lifts)
if(world.time < moving_lifts[liftref])
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)
if(lift.busy) // shouldn't happen as currentrun should contain valid, non-busy ones
continue
spawn(0)
lift.busy = 1
var/floor_delay
if(!(floor_delay = lift.do_move()))
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 = 0

/datum/controller/subsystem/turbolifts/proc/lift_is_moving(var/datum/turbolift/lift,var/floor_delay)
moving_lifts["\ref[lift]"] = world.time + floor_delay
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)
moving_lifts["[REF(lift)]"] = world.time + floor_delay
Loading