diff --git a/code/controllers/emergency_shuttle_controller.dm b/code/controllers/emergency_shuttle_controller.dm index 33eab20ddcc..51a063057c0 100644 --- a/code/controllers/emergency_shuttle_controller.dm +++ b/code/controllers/emergency_shuttle_controller.dm @@ -139,22 +139,18 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle return SHUTTLE_PREPTIME * 3 //15 minutes return SHUTTLE_PREPTIME - + + /* These procs are not really used by the controller itself, but are for other parts of the game whose logic depends on the emergency shuttle. */ //returns 1 if the shuttle is docked at the station and waiting to leave -//The shuttle cannot be launched without swiping authorization if this is true /datum/emergency_shuttle_controller/proc/waiting_to_leave() if (shuttle.location) return 0 //not at station - if (!wait_for_launch) - return 0 //not going anywhere - if (shuttle.moving_status == SHUTTLE_INTRANSIT) - return 0 - return 1 + return (wait_for_launch || shuttle.moving_status != SHUTTLE_INTRANSIT) //so we don't have emergency_shuttle.shuttle.location everywhere /datum/emergency_shuttle_controller/proc/location() diff --git a/code/controllers/shuttle_controller.dm b/code/controllers/shuttle_controller.dm index 0fa5a9d0345..93ba5cc4c79 100644 --- a/code/controllers/shuttle_controller.dm +++ b/code/controllers/shuttle_controller.dm @@ -271,7 +271,7 @@ var/global/datum/shuttle_controller/shuttle_controller dock_controller_map -= C.id_tag //escape pods - if(istype(C, /obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod)) + if(istype(C, /obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod) && istype(shuttle, /datum/shuttle/ferry/escape_pod)) var/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/EPC = C EPC.pod = shuttle diff --git a/code/game/machinery/embedded_controller/escape_pod_docking_controller.dm b/code/game/machinery/embedded_controller/escape_pod_docking_controller.dm index 5571ef2fc58..f84fbf0b323 100644 --- a/code/game/machinery/embedded_controller/escape_pod_docking_controller.dm +++ b/code/game/machinery/embedded_controller/escape_pod_docking_controller.dm @@ -1,6 +1,6 @@ //This controller goes on the escape pod itself /obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod - var/datum/shuttle/ferry/pod + var/datum/shuttle/ferry/escape_pod/pod /obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) var/data[0] @@ -11,36 +11,28 @@ "door_state" = docking_program.memory["door_status"]["state"], "door_lock" = docking_program.memory["door_status"]["lock"], "can_force" = pod.can_force(), + "is_armed" = pod.arming_controller.armed, ) ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) if (!ui) - ui = new(user, src, ui_key, "simple_docking_console_pod.tmpl", name, 470, 290) + ui = new(user, src, ui_key, "escape_pod_console.tmpl", name, 470, 290) ui.set_initial_data(data) ui.open() ui.set_auto_update(1) /obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/Topic(href, href_list) - if(..()) - return + if(..()) //I hate this "return 1 to indicate they are not allowed to use the controller" crap, but not sure how else to do it without being able to call machinery/Topic() directly. + return 1 - usr.set_machine(src) - src.add_fingerprint(usr) - - var/clean = 0 - switch(href_list["command"]) //anti-HTML-hacking checks - if("force_door") - clean = 1 - if("toggle_override") - clean = 1 - if("force_launch") - pod.force_launch(src) - - if(clean) - program.receive_user_command(href_list["command"]) + if("manual_arm") + pod.arming_controller.arm() + if("force_launch") + pod.force_launch(src) + + return 0 - return 1 //This controller is for the escape pod berth (station side) @@ -69,7 +61,7 @@ ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) if (!ui) - ui = new(user, src, ui_key, "escape_pod_console.tmpl", name, 470, 290) + ui = new(user, src, ui_key, "escape_pod_berth_console.tmpl", name, 470, 290) ui.set_initial_data(data) ui.open() ui.set_auto_update(1) @@ -78,11 +70,13 @@ if (istype(W, /obj/item/weapon/card/emag) && !emagged) user << "\blue You emag the [src], arming the escape pod!" emagged = 1 - if (istype(docking_program, /datum/computer/file/embedded_program/docking/simple/escape_pod)) var/datum/computer/file/embedded_program/docking/simple/escape_pod/P = docking_program - P.arm() + if (!P.armed) + P.arm() return + + ..() diff --git a/code/game/machinery/embedded_controller/simple_docking_controller.dm b/code/game/machinery/embedded_controller/simple_docking_controller.dm index 60c12b24c1e..877247799bd 100644 --- a/code/game/machinery/embedded_controller/simple_docking_controller.dm +++ b/code/game/machinery/embedded_controller/simple_docking_controller.dm @@ -29,7 +29,7 @@ /obj/machinery/embedded_controller/radio/simple_docking_controller/Topic(href, href_list) if(..()) - return + return 1 usr.set_machine(src) src.add_fingerprint(usr) @@ -44,7 +44,7 @@ if(clean) program.receive_user_command(href_list["command"]) - return 1 + return 0 //A docking controller program for a simple door based docking port diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 7f020c46e2f..c779bf85ca7 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -77,7 +77,7 @@ if(emergency_shuttle.waiting_to_leave()) var/line1 = "-ETD-" var/line2 - if (emergency_shuttle.shuttle.moving_status == SHUTTLE_WARMUP) + if (emergency_shuttle.shuttle.is_launching()) line2 = "Launch" else line2 = get_shuttle_timer_departure() @@ -121,11 +121,11 @@ var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (!shuttle) line2 = "Error" - else if(shuttle.has_eta()) + else if(shuttle.has_arrive_time()) line2 = get_supply_shuttle_timer() if(lentext(line2) > CHARS_PER_LINE) line2 = "Error" - else if (shuttle.moving_status == SHUTTLE_WARMUP) + else if (shuttle.is_launching()) if (shuttle.at_station()) line2 = "Launch" else @@ -187,7 +187,7 @@ if (!shuttle) return "Error" - if(shuttle.has_eta()) + if(shuttle.has_arrive_time()) var/timeleft = round((shuttle.arrive_time - world.time) / 10,1) if(timeleft < 0) return "Late" diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm index 9262c943bfb..8aa7dbe4cb3 100644 --- a/code/game/objects/items/devices/PDA/cart.dm +++ b/code/game/objects/items/devices/PDA/cart.dm @@ -413,7 +413,7 @@ var/supplyData[0] var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (shuttle) - supplyData["shuttle_moving"] = shuttle.has_eta() + supplyData["shuttle_moving"] = shuttle.has_arrive_time() supplyData["shuttle_eta"] = shuttle.eta_minutes() supplyData["shuttle_loc"] = shuttle.at_station() ? "Station" : "Dock" var/supplyOrderCount = 0 diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index ef6dbf2c5f8..e6d6425624f 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -315,7 +315,7 @@ var/list/mechtoys = list( var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (shuttle) dat += {"
Supply shuttle
- Location: [shuttle.has_eta() ? "Moving to station ([shuttle.eta_minutes()] Mins.)":shuttle.at_station() ? "Docked":"Away"]
+ Location: [shuttle.has_arrive_time() ? "Moving to station ([shuttle.eta_minutes()] Mins.)":shuttle.at_station() ? "Docked":"Away"]

Supply points: [supply_controller.points]

\nRequest items

View approved orders

@@ -443,7 +443,7 @@ var/list/mechtoys = list( if (shuttle) dat += "
Supply shuttle
" dat += "\nLocation: " - if (shuttle.has_eta()) + if (shuttle.has_arrive_time()) dat += "In transit ([shuttle.eta_minutes()] Mins.)
" else if (shuttle.at_station()) @@ -451,8 +451,8 @@ var/list/mechtoys = list( switch(shuttle.docking_controller.get_docking_status()) if ("docked") dat += "Docked at station
" if ("undocked") dat += "Undocked from station
" - if ("docking") dat += "Docking with station [shuttle.can_force()? "OVERRIDE" : ""]
" - if ("undocking") dat += "Undocking from station [shuttle.can_force()? "OVERRIDE" : ""]
" + if ("docking") dat += "Docking with station [shuttle.can_force()? "Force Launch" : ""]
" + if ("undocking") dat += "Undocking from station [shuttle.can_force()? "Force Launch" : ""]
" else dat += "Station
" diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm index 95663388a8b..a16b98db1e4 100644 --- a/code/modules/shuttles/shuttle_emergency.dm +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -32,14 +32,34 @@ ..(origin, destination) +/datum/shuttle/ferry/emergency/can_launch(var/user) + if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) + var/obj/machinery/computer/shuttle_control/emergency/C = user + if (!C.has_authorization()) + return 0 + return ..() + +/datum/shuttle/ferry/emergency/can_force(var/user) + if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) + var/obj/machinery/computer/shuttle_control/emergency/C = user + + //initiating or cancelling a launch ALWAYS requires authorization, but if we are already set to launch anyways than forcing does not. + //this is so that people can force launch if the docking controller cannot safely undock without needing X heads to swipe. + if (process_state != WAIT_LAUNCH && !C.has_authorization()) + return 0 + return ..() + +/datum/shuttle/ferry/emergency/can_cancel(var/user) + if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) + var/obj/machinery/computer/shuttle_control/emergency/C = user + if (!C.has_authorization()) + return 0 + return ..() + /datum/shuttle/ferry/emergency/launch(var/user) - if (!can_launch()) return + if (!can_launch(user)) return if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console - var/obj/machinery/computer/shuttle_control/emergency/C = user - if (emergency_shuttle.waiting_to_leave() && !C.has_authorization()) - return //need authorization to launch early - if (emergency_shuttle.autopilot) emergency_shuttle.autopilot = 0 world << "\blue Alert: The shuttle autopilot has been overridden. Launch sequence initiated!" @@ -47,13 +67,9 @@ ..(user) /datum/shuttle/ferry/emergency/force_launch(var/user) - if (!can_force()) return + if (!can_force(user)) return if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console - var/obj/machinery/computer/shuttle_control/emergency/C = user - if (emergency_shuttle.waiting_to_leave() && !C.has_authorization()) - return //need authorization to launch early - if (emergency_shuttle.autopilot) emergency_shuttle.autopilot = 0 world << "\blue Alert: The shuttle autopilot has been overridden. Bluespace drive engaged!" @@ -61,19 +77,17 @@ ..(user) /datum/shuttle/ferry/emergency/cancel_launch(var/user) - if (!can_cancel()) return + if (!can_cancel(user)) return if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console - var/obj/machinery/computer/shuttle_control/emergency/C = user - if (emergency_shuttle.waiting_to_leave() && !C.has_authorization()) - return - if (emergency_shuttle.autopilot) emergency_shuttle.autopilot = 0 world << "\blue Alert: The shuttle autopilot has been overridden. Launch sequence aborted!" ..(user) + + /obj/machinery/computer/shuttle_control/emergency shuttle_tag = "Escape" var/debug = 0 @@ -189,9 +203,9 @@ "has_docking" = shuttle.docking_controller? 1 : 0, "docking_status" = shuttle.docking_controller? shuttle.docking_controller.get_docking_status() : null, "docking_override" = shuttle.docking_controller? shuttle.docking_controller.override_enabled : null, - "can_launch" = shuttle.can_launch() && (!emergency_shuttle.waiting_to_leave() || has_auth), - "can_cancel" = shuttle.can_cancel() && (!emergency_shuttle.waiting_to_leave() || has_auth), - "can_force" = shuttle.can_force() && (!emergency_shuttle.waiting_to_leave() || has_auth), + "can_launch" = shuttle.can_launch(src), + "can_cancel" = shuttle.can_cancel(src), + "can_force" = shuttle.can_force(src), "auth_list" = auth_list, "has_auth" = has_auth, "user" = debug? user : null, @@ -200,7 +214,7 @@ ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) if (!ui) - ui = new(user, src, ui_key, "escape_shuttle_control_console.tmpl", "Shuttle Control", 470, 380) + ui = new(user, src, ui_key, "escape_shuttle_control_console.tmpl", "Shuttle Control", 470, 420) ui.set_initial_data(data) ui.open() ui.set_auto_update(1) diff --git a/code/modules/shuttles/shuttle_ferry.dm b/code/modules/shuttles/shuttle_ferry.dm index f77894ae579..8d6d1594279 100644 --- a/code/modules/shuttles/shuttle_ferry.dm +++ b/code/modules/shuttles/shuttle_ferry.dm @@ -3,7 +3,7 @@ #define WAIT_ARRIVE 2 #define WAIT_FINISH 3 -#define DOCK_ATTEMPT_TIMEOUT 450 //how long in ticks we wait before assuming the docking controller is broken or blown up. +#define DOCK_ATTEMPT_TIMEOUT 200 //how long in ticks we wait before assuming the docking controller is broken or blown up. /datum/shuttle/ferry var/location = 0 //0 = at area_station, 1 = at area_offsite @@ -154,6 +154,10 @@ return 1 return 0 +//returns 1 if the shuttle is getting ready to move, but is not in transit yet +/datum/shuttle/ferry/proc/is_launching() + return (moving_status == SHUTTLE_WARMUP || process_state == WAIT_LAUNCH) + //This gets called when the shuttle finishes arriving at it's destination //This can be used by subtypes to do things when the shuttle arrives. /datum/shuttle/ferry/proc/arrived() diff --git a/code/modules/shuttles/shuttle_supply.dm b/code/modules/shuttles/shuttle_supply.dm index 70901a513f9..a9e240c5e96 100644 --- a/code/modules/shuttles/shuttle_supply.dm +++ b/code/modules/shuttles/shuttle_supply.dm @@ -67,10 +67,6 @@ /datum/shuttle/ferry/supply/proc/at_station() return (!location) -//returns 1 if the shuttle is moving and we can show valid ETAs -/datum/shuttle/ferry/supply/proc/has_eta() - return (moving_status == SHUTTLE_INTRANSIT) - //returns 1 if the shuttle is idle and we can still mess with the cargo shopping list /datum/shuttle/ferry/supply/proc/idle() return (moving_status == SHUTTLE_IDLE) diff --git a/nano/templates/escape_pod_berth_console.tmpl b/nano/templates/escape_pod_berth_console.tmpl new file mode 100644 index 00000000000..756ab7e6568 --- /dev/null +++ b/nano/templates/escape_pod_berth_console.tmpl @@ -0,0 +1,42 @@ +
+
+
+ Escape Pod Status: +
+
+ {{if docking_status == "docked"}} + {{if armed}} + ARMED + {{else}} + SYSTEMS OK + {{/if}} + {{else docking_status == "undocking"}} + EJECTING-STAND CLEAR! + {{else docking_status == "undocked"}} + POD EJECTED + {{else docking_status == "docking"}} + INITIALIZING... + {{else}} + ERROR + {{/if}} +
+
+
+
+
+
+ {{if armed}} + {{if docking_status == "docked"}} + {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', null)}} + {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}} + {{else}} + {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', override_enabled? 'redBackground' : null)}} + {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : 'yellowBackground')}} + {{/if}} + {{else}} + {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, 'disabled', null)}} + {{:~link('Override', 'alert', {'command' : 'toggle_override'}, 'disabled', null)}} + {{/if}} +
+
+
\ No newline at end of file diff --git a/nano/templates/escape_pod_console.tmpl b/nano/templates/escape_pod_console.tmpl index d81b20a5765..90346af30ee 100644 --- a/nano/templates/escape_pod_console.tmpl +++ b/nano/templates/escape_pod_console.tmpl @@ -5,17 +5,67 @@
{{if docking_status == "docked"}} - {{if armed}} + {{if is_armed}} ARMED {{else}} SYSTEMS OK {{/if}} {{else docking_status == "undocking"}} - EJECTING-STAND CLEAR! + EJECTING {{else docking_status == "undocked"}} POD EJECTED {{else docking_status == "docking"}} - INITIALIZING... + DOCKING + {{else}} + ERROR + {{/if}} +
+ + +
+
+
+ Docking Hatch: +
+
+ {{if docking_status == "docked"}} + {{if door_state == "open"}} + OPEN + {{else door_state == "closed"}} + CLOSED + {{else}} + ERROR + {{/if}} + {{else docking_status == "docking"}} + {{if door_state == "open"}} + OPEN + {{else door_state == "closed" && door_lock == "locked"}} + SECURED + {{else door_state == "closed" && door_lock == "unlocked"}} + UNSECURED + {{else}} + ERROR + {{/if}} + {{else docking_status == "undocking"}} + {{if door_state == "open"}} + OPEN + {{else door_state == "closed" && door_lock == "locked"}} + SECURED + {{else door_state == "closed" && door_lock == "unlocked"}} + UNSECURED + {{else}} + ERROR + {{/if}} + {{else docking_status == "undocked"}} + {{if door_state == "open"}} + OPEN + {{else door_state == "closed" && door_lock == "locked"}} + SECURED + {{else door_state == "closed" && door_lock == "unlocked"}} + UNSECURED + {{else}} + ERROR + {{/if}} {{else}} ERROR {{/if}} @@ -25,18 +75,21 @@
- {{if armed}} - {{if docking_status == "docked"}} - {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', null)}} - {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}} - {{else}} - {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', override_enabled? 'redBackground' : null)}} - {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : 'yellowBackground')}} - {{/if}} + {{if docking_status == "docked"}} + {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', null)}} + {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}} {{else}} - {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, 'disabled', null)}} - {{:~link('Override', 'alert', {'command' : 'toggle_override'}, 'disabled', null)}} + {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', override_enabled? 'redBackground' : null)}} + {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : 'yellowBackground')}} {{/if}}
-
\ No newline at end of file +
+
+
+
+ {{:~link('ARM', 'alert', {'command' : 'manual_arm'}, is_armed ? 'disabled' : null, is_armed ? 'redBackground' : 'yellowBackground')}} + {{:~link('MANUAL EJECT', 'alert', {'command' : 'force_launch'}, can_force ? null : 'disabled', can_force ? 'yellowBackground' : null)}} +
+
+
diff --git a/nano/templates/simple_docking_console_pod.tmpl b/nano/templates/simple_docking_console_pod.tmpl deleted file mode 100644 index 676d2a1496f..00000000000 --- a/nano/templates/simple_docking_console_pod.tmpl +++ /dev/null @@ -1,110 +0,0 @@ -
-
-
- Docking Port Status: -
-
- {{if docking_status == "docked"}} - {{if !override_enabled}} - DOCKED - {{else}} - DOCKED-OVERRIDE ENABLED - {{/if}} - {{else docking_status == "docking"}} - {{if !override_enabled}} - DOCKING - {{else}} - DOCKING-OVERRIDE ENABLED - {{/if}} - {{else docking_status == "undocking"}} - {{if !override_enabled}} - UNDOCKING - {{else}} - UNDOCKING-OVERRIDE ENABLED - {{/if}} - {{else docking_status == "undocked"}} - {{if !override_enabled}} - NOT IN USE - {{else}} - OVERRIDE ENABLED - {{/if}} - {{else}} - ERROR - {{/if}} -
-
-
-
-
-
- Docking Hatch: -
-
- {{if docking_status == "docked"}} - {{if door_state == "open"}} - OPEN - {{else door_state == "closed"}} - CLOSED - {{else}} - ERROR - {{/if}} - {{else docking_status == "docking"}} - {{if door_state == "open"}} - OPEN - {{else door_state == "closed" && door_lock == "locked"}} - SECURED - {{else door_state == "closed" && door_lock == "unlocked"}} - UNSECURED - {{else}} - ERROR - {{/if}} - {{else docking_status == "undocking"}} - {{if door_state == "open"}} - OPEN - {{else door_state == "closed" && door_lock == "locked"}} - SECURED - {{else door_state == "closed" && door_lock == "unlocked"}} - UNSECURED - {{else}} - ERROR - {{/if}} - {{else docking_status == "undocked"}} - {{if door_state == "open"}} - OPEN - {{else door_state == "closed" && door_lock == "locked"}} - SECURED - {{else door_state == "closed" && door_lock == "unlocked"}} - UNSECURED - {{else}} - ERROR - {{/if}} - {{else}} - ERROR - {{/if}} -
-
-
-
-
-
- {{if docking_status == "docked"}} - {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', null)}} - {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}} - {{else}} - {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', override_enabled? 'redBackground' : null)}} - {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : 'yellowBackground')}} - {{/if}} -
-
-
-
-
-
- {{if docking_status == "docked"}} - {{:~link('MANUAL EJECT', 'alert', {'command' : 'force_launch'}, 'disabled', null)}} - {{else}} - {{:~link('MANUAL EJECT', 'alert', {'command' : 'force_launch'}, can_force ? null : 'disabled', can_force ? 'redBackground' : null)}} - {{/if}} -
-
-