mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
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.
37 lines
981 B
Plaintext
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
|