mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-02 13:34:49 +00:00
Shuttle console refactoring
Also adjusted the way undocking signals were used.
This commit is contained in:
@@ -53,8 +53,6 @@ obj/machinery/door/airlock/receive_signal(datum/signal/signal)
|
||||
|
||||
|
||||
obj/machinery/door/airlock/proc/send_status()
|
||||
if (!can_radio()) return
|
||||
|
||||
if(radio_connection)
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
|
||||
@@ -109,11 +109,6 @@
|
||||
/datum/computer/file/embedded_program/docking/airlock/ready_for_undocking()
|
||||
return airlock_program.check_doors_secured()
|
||||
|
||||
/datum/computer/file/embedded_program/docking/airlock/reset()
|
||||
airlock_program.stop_cycling()
|
||||
airlock_program.close_doors()
|
||||
..()
|
||||
|
||||
//An airlock controller to be used by the airlock-based docking port controller.
|
||||
//Same as a regular airlock controller but allows disabling of the regular airlock functions when docking
|
||||
/datum/computer/file/embedded_program/airlock/docking
|
||||
@@ -132,7 +127,7 @@
|
||||
if (master_prog.undocked() || master_prog.override_enabled) //only allow the port to be used as an airlock if nothing is docked here or the override is enabled
|
||||
..(target)
|
||||
|
||||
/*** DEBUG VERBS ***
|
||||
/*** DEBUG VERBS ***/
|
||||
|
||||
/datum/computer/file/embedded_program/docking/proc/print_state()
|
||||
world << "id_tag: [id_tag]"
|
||||
@@ -171,4 +166,5 @@
|
||||
set category = "Debug"
|
||||
set src in view(1)
|
||||
src.program:initiate_undocking()
|
||||
*/
|
||||
|
||||
/**/
|
||||
@@ -14,7 +14,7 @@
|
||||
MODE_CLIENT|STATE_UNDOCKED sent a request for docking and now waiting for a reply.
|
||||
MODE_CLIENT|STATE_DOCKING server told us they are OK to dock, waiting for our docking port to be ready.
|
||||
MODE_CLIENT|STATE_DOCKED idle - docked as client.
|
||||
MODE_CLIENT|STATE_UNDOCKING we are either waiting for our docking port to be ready or for the server to give us the OK to undock.
|
||||
MODE_CLIENT|STATE_UNDOCKING we are either waiting for our docking port to be ready or for the server to give us the OK to finish undocking.
|
||||
|
||||
MODE_SERVER|STATE_UNDOCKED should never happen.
|
||||
MODE_SERVER|STATE_DOCKING someone requested docking, we are waiting for our docking port to be ready.
|
||||
@@ -34,7 +34,7 @@
|
||||
launches is not the docking controller's responsibility). In this case it is up to the players to manually get the docking port into a good state to undock
|
||||
(which usually just means closing and locking the doors).
|
||||
|
||||
In line with this, docking controllers should prevent players from manually doing things when the override is disabled.
|
||||
In line with this, docking controllers should prevent players from manually doing things when the override is NOT enabled.
|
||||
*/
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
/datum/computer/file/embedded_program/docking/process()
|
||||
switch(dock_state)
|
||||
if (STATE_DOCKING) //waiting for our docking port to be ready for docking
|
||||
if (ready_for_docking() || override_enabled)
|
||||
if (ready_for_docking())
|
||||
if (!response_sent)
|
||||
send_docking_command(tag_target, "confirm_dock") //tell the other guy we're ready
|
||||
response_sent = 1
|
||||
@@ -107,13 +107,14 @@
|
||||
finish_docking() //client done docking!
|
||||
response_sent = 0
|
||||
if (STATE_UNDOCKING)
|
||||
if (ready_for_undocking() || override_enabled)
|
||||
if (ready_for_undocking())
|
||||
if (control_mode == MODE_CLIENT)
|
||||
if (!response_sent)
|
||||
send_docking_command(tag_target, "request_undock") //tell the server we want to undock now.
|
||||
response_sent = 1
|
||||
else if (control_mode == MODE_SERVER)
|
||||
send_docking_command(tag_target, "confirm_undock") //tell the client we are OK to undock.
|
||||
|
||||
if (!override_enabled)
|
||||
finish_undocking()
|
||||
reset() //server is done undocking!
|
||||
@@ -147,8 +148,7 @@
|
||||
if (!override_enabled)
|
||||
prepare_for_undocking()
|
||||
|
||||
send_docking_command(tag_target, "request_undock")
|
||||
|
||||
//send_docking_command(tag_target, "request_undock")
|
||||
|
||||
//tell the docking port to start getting ready for docking - e.g. pressurize
|
||||
/datum/computer/file/embedded_program/docking/proc/prepare_for_docking()
|
||||
@@ -187,6 +187,7 @@
|
||||
response_sent = 0
|
||||
|
||||
/datum/computer/file/embedded_program/docking/proc/force_undock()
|
||||
world << "[id_tag]: forcing undock"
|
||||
if (tag_target)
|
||||
send_docking_command(tag_target, "dock_error")
|
||||
reset()
|
||||
|
||||
@@ -127,11 +127,7 @@
|
||||
/datum/computer/file/embedded_program/docking/simple/ready_for_undocking()
|
||||
return (memory["door_status"]["state"] == "closed" && memory["door_status"]["lock"] == "locked")
|
||||
|
||||
/datum/computer/file/embedded_program/docking/simple/reset()
|
||||
close_door()
|
||||
..()
|
||||
|
||||
/*** DEBUG VERBS ***
|
||||
/*** DEBUG VERBS ***/
|
||||
|
||||
/obj/machinery/embedded_controller/radio/simple_docking_controller/verb/view_state()
|
||||
set category = "Debug"
|
||||
@@ -157,4 +153,5 @@
|
||||
set category = "Debug"
|
||||
set src in view(1)
|
||||
src.program:initiate_undocking()
|
||||
*/
|
||||
|
||||
/**/
|
||||
@@ -8,23 +8,16 @@
|
||||
var/global/list/shuttles
|
||||
|
||||
/datum/shuttle
|
||||
var/location = 0 //0 = at area_station, 1 = at area_offsite
|
||||
var/warmup_time = 0
|
||||
var/moving_status = SHUTTLE_IDLE //prevents people from doing things they shouldn't when the shuttle is in transit
|
||||
var/in_use = 0 //this mutex ensures that only one console can be doing things with the shuttle at a time.
|
||||
var/area_station
|
||||
var/area_offsite
|
||||
|
||||
var/docking_controller_tag //tag of the controller used to coordinate docking
|
||||
var/datum/computer/file/embedded_program/docking/docking_controller //the controller itself
|
||||
//TODO: change location to a string and use a mapping for area and dock targets.
|
||||
var/dock_target_station
|
||||
var/dock_target_offsite
|
||||
|
||||
|
||||
/datum/shuttle/proc/short_jump(var/datum/shuttle/shuttle,var/area/origin,var/area/destination)
|
||||
/datum/shuttle/proc/short_jump(var/area/origin,var/area/destination)
|
||||
if(moving_status != SHUTTLE_IDLE) return
|
||||
|
||||
//it would be cool to play a sound here
|
||||
moving_status = SHUTTLE_WARMUP
|
||||
spawn(warmup_time*10)
|
||||
if (moving_status == SHUTTLE_IDLE)
|
||||
@@ -33,11 +26,11 @@ var/global/list/shuttles
|
||||
move(origin, destination)
|
||||
moving_status = SHUTTLE_IDLE
|
||||
|
||||
/datum/shuttle/proc/long_jump(var/shuttle_tag,var/area/departing,var/area/destination,var/area/interim,var/travel_time)
|
||||
/datum/shuttle/proc/long_jump(var/area/departing,var/area/destination,var/area/interim,var/travel_time)
|
||||
if(moving_status != SHUTTLE_IDLE) return
|
||||
|
||||
//it would be cool to play a sound here
|
||||
moving_status = SHUTTLE_WARMUP
|
||||
|
||||
spawn(warmup_time*10)
|
||||
if (moving_status == SHUTTLE_IDLE)
|
||||
return //someone cancelled the launch
|
||||
@@ -68,40 +61,22 @@ var/global/list/shuttles
|
||||
docking_controller.initiate_undocking()
|
||||
|
||||
/datum/shuttle/proc/current_dock_target()
|
||||
var/dock_target
|
||||
if (!location) //station
|
||||
dock_target = dock_target_station
|
||||
else
|
||||
dock_target = dock_target_offsite
|
||||
return dock_target
|
||||
return null
|
||||
|
||||
/datum/shuttle/proc/skip_docking_checks()
|
||||
if (!docking_controller || !current_dock_target())
|
||||
return 1 //shuttles without docking controllers or at locations without docking ports act like old-style shuttles
|
||||
return 0
|
||||
|
||||
//just moves the shuttle from A to B, if it can be moved
|
||||
/datum/shuttle/proc/move(var/area/origin,var/area/destination)
|
||||
|
||||
//world << "move_shuttle() called for [shuttle_tag] leaving [origin] en route to [destination]."
|
||||
if(isnull(location))
|
||||
return
|
||||
|
||||
var/area/area_going_to
|
||||
if(destination)
|
||||
//world << "Using supplied destination [destination]."
|
||||
area_going_to = destination
|
||||
else
|
||||
//world << "Using controller value [(cur_location[shuttle_tag] == 1 ? areas_station[shuttle_tag] : areas_offsite[shuttle_tag])]."
|
||||
area_going_to = (location == 1 ? area_station : area_offsite)
|
||||
|
||||
var/area/area_coming_from
|
||||
if(origin)
|
||||
//world << "Using supplied origin [origin]."
|
||||
area_coming_from = origin
|
||||
else
|
||||
//world << "Using controller value [(cur_location[shuttle_tag] == 1 ? areas_offsite[shuttle_tag] : areas_station[shuttle_tag])]."
|
||||
area_coming_from = (location == 1 ? area_offsite : area_station)
|
||||
|
||||
//world << "area_coming_from: [area_coming_from]"
|
||||
//world << "area_going_to: [area_going_to]"
|
||||
//world << "destination: [destination]"
|
||||
|
||||
if(area_coming_from == area_going_to)
|
||||
if(origin == destination)
|
||||
//world << "cancelling move, shuttle will overlap."
|
||||
return
|
||||
|
||||
@@ -110,7 +85,7 @@ var/global/list/shuttles
|
||||
var/list/dstturfs = list()
|
||||
var/throwy = world.maxy
|
||||
|
||||
for(var/turf/T in area_going_to)
|
||||
for(var/turf/T in destination)
|
||||
dstturfs += T
|
||||
if(T.y < throwy)
|
||||
throwy = T.y
|
||||
@@ -122,17 +97,15 @@ var/global/list/shuttles
|
||||
if(istype(T, /turf/simulated))
|
||||
del(T)
|
||||
|
||||
for(var/mob/living/carbon/bug in area_going_to)
|
||||
for(var/mob/living/carbon/bug in destination)
|
||||
bug.gib()
|
||||
|
||||
for(var/mob/living/simple_animal/pest in area_going_to)
|
||||
for(var/mob/living/simple_animal/pest in destination)
|
||||
pest.gib()
|
||||
|
||||
area_coming_from.move_contents_to(area_going_to)
|
||||
origin.move_contents_to(destination)
|
||||
|
||||
location = !location //this needs to change.
|
||||
|
||||
for(var/mob/M in area_going_to)
|
||||
for(var/mob/M in destination)
|
||||
if(M.client)
|
||||
spawn(0)
|
||||
if(M.buckled)
|
||||
@@ -152,48 +125,48 @@ var/global/list/shuttles
|
||||
/proc/setup_shuttles()
|
||||
shuttles = list()
|
||||
|
||||
var/datum/shuttle/shuttle
|
||||
var/datum/shuttle/ferry/shuttle
|
||||
|
||||
//Supply and escape shuttles.
|
||||
shuttle = new/datum/shuttle()
|
||||
shuttle = new()
|
||||
shuttle.location = 1
|
||||
shuttle.area_offsite = locate(/area/supply/dock)
|
||||
shuttle.area_station = locate(/area/supply/station)
|
||||
shuttles["Supply"] = shuttle
|
||||
|
||||
// Admin shuttles.
|
||||
shuttle = new/datum/shuttle()
|
||||
shuttle = new()
|
||||
shuttle.location = 1
|
||||
shuttle.area_offsite = locate(/area/shuttle/transport1/centcom)
|
||||
shuttle.area_station = locate(/area/shuttle/transport1/station)
|
||||
shuttles["Centcom"] = shuttle
|
||||
|
||||
shuttle = new/datum/shuttle()
|
||||
shuttle = new()
|
||||
shuttle.location = 1
|
||||
shuttle.area_offsite = locate(/area/shuttle/administration/centcom)
|
||||
shuttle.area_station = locate(/area/shuttle/administration/station)
|
||||
shuttles["Administration"] = shuttle
|
||||
|
||||
shuttle = new/datum/shuttle()
|
||||
shuttle = new()
|
||||
shuttle.area_offsite = locate(/area/shuttle/alien/base)
|
||||
shuttle.area_station = locate(/area/shuttle/alien/mine)
|
||||
shuttles["Alien"] = shuttle
|
||||
|
||||
// Public shuttles
|
||||
shuttle = new/datum/shuttle()
|
||||
shuttle = new()
|
||||
shuttle.location = 1
|
||||
shuttle.warmup_time = 10
|
||||
shuttle.area_offsite = locate(/area/shuttle/constructionsite/site)
|
||||
shuttle.area_station = locate(/area/shuttle/constructionsite/station)
|
||||
shuttles["Engineering"] = shuttle
|
||||
|
||||
shuttle = new/datum/shuttle()
|
||||
shuttle = new()
|
||||
shuttle.warmup_time = 10
|
||||
shuttle.area_offsite = locate(/area/shuttle/mining/outpost)
|
||||
shuttle.area_station = locate(/area/shuttle/mining/station)
|
||||
shuttles["Mining"] = shuttle
|
||||
|
||||
shuttle = new/datum/shuttle()
|
||||
shuttle = new()
|
||||
shuttle.warmup_time = 10
|
||||
shuttle.area_offsite = locate(/area/shuttle/research/outpost)
|
||||
shuttle.area_station = locate(/area/shuttle/research/station)
|
||||
@@ -219,7 +192,6 @@ var/global/list/shuttles
|
||||
VS.departure_message = "Your guests are pulling away, Exodus - moving too fast for us to draw a bead on them. Looks like they're heading out of the system at a rapid clip."
|
||||
VS.interim = /area/vox_station/transit
|
||||
|
||||
VS.location = 1
|
||||
VS.warmup_time = 10
|
||||
shuttles["Vox Skipjack"] = VS
|
||||
|
||||
@@ -243,7 +215,6 @@ var/global/list/shuttles
|
||||
MS.departure_message = "Your visitors are on their way out of the system, Exodus, burning delta-v like it's nothing. Good riddance."
|
||||
MS.interim = /area/syndicate_station/transit
|
||||
|
||||
MS.location = 1
|
||||
MS.warmup_time = 10
|
||||
shuttles["Syndicate"] = MS
|
||||
|
||||
|
||||
@@ -4,6 +4,132 @@
|
||||
#define WAIT_FINISH 3
|
||||
|
||||
|
||||
/datum/shuttle/ferry
|
||||
var/location = 0 //0 = at area_station, 1 = at area_offsite
|
||||
var/process_state = IDLE_STATE
|
||||
|
||||
//this mutex ensures that only one console is processing the shuttle's controls at a time
|
||||
var/obj/machinery/computer/shuttle_control/in_use = null
|
||||
|
||||
var/area_station
|
||||
var/area_offsite
|
||||
//TODO: change location to a string and use a mapping for area and dock targets.
|
||||
var/dock_target_station
|
||||
var/dock_target_offsite
|
||||
|
||||
/datum/shuttle/ferry/short_jump(var/area/origin,var/area/destination)
|
||||
if(isnull(location))
|
||||
return
|
||||
|
||||
if(!destination)
|
||||
destination = (location == 1 ? area_station : area_offsite)
|
||||
if(!origin)
|
||||
origin = (location == 1 ? area_offsite : area_station)
|
||||
|
||||
if (docking_controller)
|
||||
docking_controller.force_undock()
|
||||
|
||||
..(origin, destination)
|
||||
|
||||
/datum/shuttle/ferry/long_jump(var/area/departing,var/area/destination,var/area/interim,var/travel_time)
|
||||
if(isnull(location))
|
||||
return
|
||||
|
||||
if(!destination)
|
||||
destination = (location == 1 ? area_station : area_offsite)
|
||||
if(!departing)
|
||||
departing = (location == 1 ? area_offsite : area_station)
|
||||
|
||||
if (docking_controller)
|
||||
docking_controller.force_undock()
|
||||
|
||||
..(departing, destination, interim, travel_time)
|
||||
|
||||
/datum/shuttle/ferry/move(var/area/origin,var/area/destination)
|
||||
..(origin, destination)
|
||||
location = !location
|
||||
|
||||
/datum/shuttle/ferry/proc/process_shuttle()
|
||||
switch(process_state)
|
||||
if (WAIT_LAUNCH)
|
||||
if (skip_docking_checks() || docking_controller.can_launch())
|
||||
|
||||
//once you have a transition area, making ferry shuttles have a transition would merely requre replacing this with
|
||||
//if (transition_area) long_jump(...)
|
||||
//else short_jump ()
|
||||
short_jump()
|
||||
|
||||
process_state = WAIT_ARRIVE
|
||||
if (WAIT_ARRIVE)
|
||||
if (moving_status == SHUTTLE_IDLE)
|
||||
dock()
|
||||
process_state = WAIT_FINISH
|
||||
if (WAIT_FINISH)
|
||||
if (skip_docking_checks() || docking_controller.docked())
|
||||
process_state = IDLE_STATE
|
||||
in_use = null //release lock
|
||||
|
||||
/datum/shuttle/ferry/current_dock_target()
|
||||
var/dock_target
|
||||
if (!location) //station
|
||||
dock_target = dock_target_station
|
||||
else
|
||||
dock_target = dock_target_offsite
|
||||
return dock_target
|
||||
|
||||
|
||||
/datum/shuttle/ferry/proc/launch(var/obj/machinery/computer/shuttle_control/user)
|
||||
if (!can_launch()) return
|
||||
|
||||
in_use = user //obtain an exclusive lock on the shuttle
|
||||
|
||||
process_state = WAIT_LAUNCH
|
||||
undock()
|
||||
|
||||
/datum/shuttle/ferry/proc/force_launch(var/obj/machinery/computer/shuttle_control/user)
|
||||
if (!can_force()) return
|
||||
|
||||
in_use = user //obtain an exclusive lock on the shuttle
|
||||
|
||||
short_jump()
|
||||
|
||||
process_state = WAIT_ARRIVE
|
||||
|
||||
/datum/shuttle/ferry/proc/cancel_launch()
|
||||
if (!can_cancel()) return
|
||||
|
||||
moving_status = SHUTTLE_IDLE
|
||||
process_state = WAIT_FINISH
|
||||
|
||||
if (docking_controller && !docking_controller.undocked())
|
||||
docking_controller.force_undock()
|
||||
|
||||
spawn(10)
|
||||
dock()
|
||||
|
||||
return
|
||||
|
||||
/datum/shuttle/ferry/proc/can_launch()
|
||||
if (moving_status != SHUTTLE_IDLE)
|
||||
return 0
|
||||
|
||||
if (in_use && !skip_docking_checks())
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
/datum/shuttle/ferry/proc/can_force()
|
||||
if (moving_status != SHUTTLE_IDLE && process_state == WAIT_LAUNCH)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/datum/shuttle/ferry/proc/can_cancel()
|
||||
if (moving_status == SHUTTLE_WARMUP || process_state == WAIT_LAUNCH)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
/*
|
||||
I dont really like how much this manipulates shuttle it's docking controller, as it makes this code
|
||||
depend a lot on their current implementation, and also having var/datum/shuttle/shuttle = shuttles[shuttle_tag]
|
||||
@@ -19,90 +145,29 @@
|
||||
|
||||
var/shuttle_tag // Used to coordinate data in shuttle controller.
|
||||
var/hacked = 0 // Has been emagged, no access restrictions.
|
||||
var/launch_override = 0
|
||||
|
||||
var/process_state = IDLE_STATE
|
||||
|
||||
/obj/machinery/computer/shuttle_control/proc/launch_shuttle()
|
||||
if (!can_launch()) return
|
||||
|
||||
var/datum/shuttle/shuttle = shuttles[shuttle_tag]
|
||||
|
||||
shuttle.in_use = 1 //obtain an exclusive lock on the shuttle
|
||||
|
||||
process_state = WAIT_LAUNCH
|
||||
shuttle.undock()
|
||||
|
||||
/obj/machinery/computer/shuttle_control/proc/cancel_launch()
|
||||
if (!can_cancel()) return
|
||||
|
||||
var/datum/shuttle/shuttle = shuttles[shuttle_tag]
|
||||
|
||||
shuttle.moving_status = SHUTTLE_IDLE
|
||||
process_state = WAIT_FINISH
|
||||
|
||||
if (shuttle.docking_controller && !shuttle.docking_controller.undocked())
|
||||
shuttle.docking_controller.force_undock()
|
||||
shuttle.dock()
|
||||
|
||||
shuttle.in_use = 0
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/computer/shuttle_control/proc/can_launch()
|
||||
var/datum/shuttle/shuttle = shuttles[shuttle_tag]
|
||||
|
||||
if (shuttle.moving_status != SHUTTLE_IDLE)
|
||||
return 0
|
||||
|
||||
if (shuttle.in_use && !skip_checks())
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/computer/shuttle_control/proc/can_cancel()
|
||||
var/datum/shuttle/shuttle = shuttles[shuttle_tag]
|
||||
|
||||
if (shuttle.moving_status == SHUTTLE_WARMUP || process_state == WAIT_LAUNCH)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//TODO move this stuff into the shuttle datum itself, instead of manipulating the shuttle's members
|
||||
/obj/machinery/computer/shuttle_control/process()
|
||||
if (!shuttles || !(shuttle_tag in shuttles))
|
||||
return
|
||||
|
||||
var/datum/shuttle/shuttle = shuttles[shuttle_tag]
|
||||
|
||||
switch(process_state)
|
||||
if (WAIT_LAUNCH)
|
||||
if (skip_checks() || shuttle.docking_controller.can_launch())
|
||||
shuttle.short_jump()
|
||||
if (shuttle.docking_controller && !shuttle.docking_controller.undocked())
|
||||
shuttle.docking_controller.force_undock()
|
||||
process_state = WAIT_ARRIVE
|
||||
if (WAIT_ARRIVE)
|
||||
if (shuttle.moving_status == SHUTTLE_IDLE)
|
||||
shuttle.dock()
|
||||
process_state = WAIT_FINISH
|
||||
if (WAIT_FINISH)
|
||||
if (skip_checks() || shuttle.docking_controller.docked())
|
||||
process_state = IDLE_STATE
|
||||
shuttle.in_use = 0 //release lock
|
||||
|
||||
/obj/machinery/computer/shuttle_control/proc/skip_checks()
|
||||
var/datum/shuttle/shuttle = shuttles[shuttle_tag]
|
||||
|
||||
if (!shuttle.docking_controller || !shuttle.current_dock_target())
|
||||
return 1 //shuttles without docking controllers or at locations without docking ports act like old-style shuttles
|
||||
|
||||
return 0
|
||||
var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag]
|
||||
if (!istype(shuttle))
|
||||
return
|
||||
|
||||
if (shuttle.in_use == src)
|
||||
shuttle.process_shuttle()
|
||||
|
||||
/obj/machinery/computer/shuttle_control/Del()
|
||||
var/datum/shuttle/shuttle = shuttles[shuttle_tag]
|
||||
var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag]
|
||||
if (!istype(shuttle))
|
||||
return
|
||||
|
||||
if (process_state != IDLE_STATE)
|
||||
shuttle.in_use = 0 //shuttle may not dock properly if this gets deleted while in transit, but its not a big deal
|
||||
if (shuttle.in_use == src)
|
||||
shuttle.in_use = null //shuttle may not dock properly if this gets deleted while in transit, but its not a big deal
|
||||
|
||||
/obj/machinery/computer/shuttle_control/attack_hand(user as mob)
|
||||
if(..(user))
|
||||
@@ -113,7 +178,9 @@
|
||||
|
||||
/obj/machinery/computer/shuttle_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
var/data[0]
|
||||
var/datum/shuttle/shuttle = shuttles[shuttle_tag]
|
||||
var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag]
|
||||
if (!istype(shuttle))
|
||||
return
|
||||
|
||||
var/shuttle_state
|
||||
switch(shuttle.moving_status)
|
||||
@@ -122,7 +189,7 @@
|
||||
if(SHUTTLE_INTRANSIT) shuttle_state = "in_transit"
|
||||
|
||||
var/shuttle_status
|
||||
switch (process_state)
|
||||
switch (shuttle.process_state)
|
||||
if(IDLE_STATE)
|
||||
if (shuttle.in_use)
|
||||
shuttle_status = "Busy."
|
||||
@@ -142,10 +209,10 @@
|
||||
"shuttle_state" = shuttle_state,
|
||||
"has_docking" = shuttle.docking_controller? 1 : 0,
|
||||
"docking_status" = shuttle.docking_controller? shuttle.docking_controller.get_docking_status() : null,
|
||||
"override_enabled" = shuttle.docking_controller? shuttle.docking_controller.override_enabled : null,
|
||||
"can_launch" = can_launch(),
|
||||
"can_cancel" = can_cancel(),
|
||||
"can_override" = can_override(),
|
||||
"docking_override" = shuttle.docking_controller? shuttle.docking_controller.override_enabled : null,
|
||||
"can_launch" = shuttle.can_launch(),
|
||||
"can_cancel" = shuttle.can_cancel(),
|
||||
"can_force" = shuttle.can_force(),
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
@@ -164,11 +231,16 @@
|
||||
usr.set_machine(src)
|
||||
src.add_fingerprint(usr)
|
||||
|
||||
var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag]
|
||||
if (!istype(shuttle))
|
||||
return
|
||||
|
||||
if(href_list["move"])
|
||||
launch_shuttle()
|
||||
shuttle.launch(src)
|
||||
if(href_list["force"])
|
||||
shuttle.force_launch(src)
|
||||
else if(href_list["cancel"])
|
||||
cancel_launch()
|
||||
shuttle.cancel_launch()
|
||||
|
||||
|
||||
/obj/machinery/computer/shuttle_control/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
Docking Status:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
<!--
|
||||
{{if docking_status == "docked"}}
|
||||
<span class="good">DOCKED</span>
|
||||
{{else docking_status == "docking"}}
|
||||
@@ -40,20 +41,27 @@
|
||||
{{else}}
|
||||
<span class="bad">ERROR</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" style="padding-top: 10px">
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
Docking Control:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
{{if override_enabled}}
|
||||
<span class="average">MANUAL</span>
|
||||
-->
|
||||
{{if docking_status == "docked"}}
|
||||
<span class="good">DOCKED</span>
|
||||
{{else docking_status == "docking"}}
|
||||
{{if !docking_override}}
|
||||
<span class="average">DOCKING</span>
|
||||
{{else}}
|
||||
<span class="good">AUTO</span>
|
||||
<span class="average">DOCKING-MANUAL</span>
|
||||
{{/if}}
|
||||
{{else docking_status == "undocking"}}
|
||||
{{if !docking_override}}
|
||||
<span class="average">UNDOCKING</span>
|
||||
{{else}}
|
||||
<span class="average">UNDOCKING-MANUAL</span>
|
||||
{{/if}}
|
||||
{{else docking_status == "undocked"}}
|
||||
<span class="idle">UNDOCKED</span>
|
||||
{{else}}
|
||||
<span class="bad">ERROR</span>
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -65,9 +73,6 @@
|
||||
<div class="itemContent" style="padding-top: 2px; width: 100%">
|
||||
{{:~link('Launch Shuttle', 'arrowthickstop-1-e', {'move' : '1'}, can_launch? null : 'disabled' , null)}}
|
||||
{{:~link('Cancel Launch', 'cancel', {'cancel' : '1'}, can_cancel? null : 'disabled' , null)}}
|
||||
{{if has_docking}}
|
||||
{{:~link('Override', 'alert', {'override' : '1'}, can_override? null : 'disabled' , (can_override && override_enabled)? 'redBackground' : null)}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user