Files
CHOMPStation2/code/modules/turbolift/turbolift_process.dm
Arokha Sieyes 248e5ca503 Allow turbolift specific-floor delays
If one floor is 'taller' than the others, or otherwise takes longer to traverse, you can set delay_time on the area to have it wait a different time there. Or, wait even less time, though less than 1 second isn't possible since the controller only fires every second.
2017-04-24 16:10:03 -04:00

37 lines
981 B
Plaintext

var/datum/controller/process/turbolift/turbolift_controller
/datum/controller/process/turbolift
var/list/moving_lifts = list()
/datum/controller/process/turbolift/New()
..()
turbolift_controller = src
/datum/controller/process/turbolift/setup()
name = "turbolift controller"
schedule_interval = 10
/datum/controller/process/turbolift/doWork()
for(var/liftref in moving_lifts)
if(world.time < moving_lifts[liftref])
continue
var/datum/turbolift/lift = locate(liftref)
if(lift.busy)
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
SCHECK
/datum/controller/process/turbolift/proc/lift_is_moving(var/datum/turbolift/lift,var/floor_delay)
moving_lifts["\ref[lift]"] = world.time + floor_delay