Merge pull request #5463 from mwerezak/emergency-shuttle

Fixes shuttle ETA blanking out on launch, allows escape pods to be armed by breaking into the pod.
This commit is contained in:
Chinsky
2014-07-03 05:10:35 +04:00
13 changed files with 178 additions and 189 deletions
@@ -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()
+1 -1
View File
@@ -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
@@ -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
..()
@@ -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
+4 -4
View File
@@ -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"
+1 -1
View File
@@ -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
+4 -4
View File
@@ -315,7 +315,7 @@ var/list/mechtoys = list(
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
if (shuttle)
dat += {"<BR><B>Supply shuttle</B><HR>
Location: [shuttle.has_eta() ? "Moving to station ([shuttle.eta_minutes()] Mins.)":shuttle.at_station() ? "Docked":"Away"]<BR>
Location: [shuttle.has_arrive_time() ? "Moving to station ([shuttle.eta_minutes()] Mins.)":shuttle.at_station() ? "Docked":"Away"]<BR>
<HR>Supply points: [supply_controller.points]<BR>
<BR>\n<A href='?src=\ref[src];order=categories'>Request items</A><BR><BR>
<A href='?src=\ref[src];vieworders=1'>View approved orders</A><BR><BR>
@@ -443,7 +443,7 @@ var/list/mechtoys = list(
if (shuttle)
dat += "<BR><B>Supply shuttle</B><HR>"
dat += "\nLocation: "
if (shuttle.has_eta())
if (shuttle.has_arrive_time())
dat += "In transit ([shuttle.eta_minutes()] Mins.)<BR>"
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<BR>"
if ("undocked") dat += "Undocked from station<BR>"
if ("docking") dat += "Docking with station [shuttle.can_force()? "<span class='warning'><A href='?src=\ref[src];force_send=1'>OVERRIDE</A></span>" : ""]<BR>"
if ("undocking") dat += "Undocking from station [shuttle.can_force()? "<span class='warning'><A href='?src=\ref[src];force_send=1'>OVERRIDE</A></span>" : ""]<BR>"
if ("docking") dat += "Docking with station [shuttle.can_force()? "<span class='warning'><A href='?src=\ref[src];force_send=1'>Force Launch</A></span>" : ""]<BR>"
if ("undocking") dat += "Undocking from station [shuttle.can_force()? "<span class='warning'><A href='?src=\ref[src];force_send=1'>Force Launch</A></span>" : ""]<BR>"
else
dat += "Station<BR>"
+33 -19
View File
@@ -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 <B>Alert: The shuttle autopilot has been overridden. Launch sequence initiated!</B>"
@@ -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 <B>Alert: The shuttle autopilot has been overridden. Bluespace drive engaged!</B>"
@@ -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 <B>Alert: The shuttle autopilot has been overridden. Launch sequence aborted!</B>"
..(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)
+5 -1
View File
@@ -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()
-4
View File
@@ -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)
@@ -0,0 +1,42 @@
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemLabel">
Escape Pod Status:
</div>
<div class="itemContent">
{{if docking_status == "docked"}}
{{if armed}}
<span class="average">ARMED</span>
{{else}}
<span class="good">SYSTEMS OK</span>
{{/if}}
{{else docking_status == "undocking"}}
<span class="average">EJECTING-STAND CLEAR!</span>
{{else docking_status == "undocked"}}
<span class="idle">POD EJECTED</span>
{{else docking_status == "docking"}}
<span class="good">INITIALIZING...</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
</div>
</div>
</div>
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemContent" style="padding-top: 2px; width: 100%">
{{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}}
</div>
</div>
</div>
+67 -14
View File
@@ -5,17 +5,67 @@
</div>
<div class="itemContent">
{{if docking_status == "docked"}}
{{if armed}}
{{if is_armed}}
<span class="average">ARMED</span>
{{else}}
<span class="good">SYSTEMS OK</span>
{{/if}}
{{else docking_status == "undocking"}}
<span class="average">EJECTING-STAND CLEAR!</span>
<span class="average">EJECTING</span>
{{else docking_status == "undocked"}}
<span class="idle">POD EJECTED</span>
{{else docking_status == "docking"}}
<span class="average">INITIALIZING...</span>
<span class="average">DOCKING</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
</div>
</div>
</div>
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemLabel">
Docking Hatch:
</div>
<div class="itemContent">
{{if docking_status == "docked"}}
{{if door_state == "open"}}
<span class="good">OPEN</span>
{{else door_state == "closed"}}
<span class="good">CLOSED</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
{{else docking_status == "docking"}}
{{if door_state == "open"}}
<span class="good">OPEN</span>
{{else door_state == "closed" && door_lock == "locked"}}
<span class="good">SECURED</span>
{{else door_state == "closed" && door_lock == "unlocked"}}
<span class="good">UNSECURED</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
{{else docking_status == "undocking"}}
{{if door_state == "open"}}
<span class="average">OPEN</span>
{{else door_state == "closed" && door_lock == "locked"}}
<span class="good">SECURED</span>
{{else door_state == "closed" && door_lock == "unlocked"}}
<span class="average">UNSECURED</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
{{else docking_status == "undocked"}}
{{if door_state == "open"}}
<span class="bad">OPEN</span>
{{else door_state == "closed" && door_lock == "locked"}}
<span class="good">SECURED</span>
{{else door_state == "closed" && door_lock == "unlocked"}}
<span class="bad">UNSECURED</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
{{else}}
<span class="bad">ERROR</span>
{{/if}}
@@ -25,18 +75,21 @@
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemContent" style="padding-top: 2px; width: 100%">
{{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}}
</div>
</div>
</div>
</div>
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemContent" style="padding-top: 2px; width: 100%">
{{:~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)}}
</div>
</div>
</div>
@@ -1,110 +0,0 @@
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemLabel">
Docking Port Status:
</div>
<div class="itemContent">
{{if docking_status == "docked"}}
{{if !override_enabled}}
<span class="good">DOCKED</span>
{{else}}
<span class="bad">DOCKED-OVERRIDE ENABLED</span>
{{/if}}
{{else docking_status == "docking"}}
{{if !override_enabled}}
<span class="average">DOCKING</span>
{{else}}
<span class="bad">DOCKING-OVERRIDE ENABLED</span>
{{/if}}
{{else docking_status == "undocking"}}
{{if !override_enabled}}
<span class="average">UNDOCKING</span>
{{else}}
<span class="bad">UNDOCKING-OVERRIDE ENABLED</span>
{{/if}}
{{else docking_status == "undocked"}}
{{if !override_enabled}}
<span class="idle">NOT IN USE</span>
{{else}}
<span class="bad" style="float:left">OVERRIDE ENABLED</span>
{{/if}}
{{else}}
<span class="bad">ERROR</span>
{{/if}}
</div>
</div>
</div>
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemLabel">
Docking Hatch:
</div>
<div class="itemContent">
{{if docking_status == "docked"}}
{{if door_state == "open"}}
<span class="good">OPEN</span>
{{else door_state == "closed"}}
<span class="good">CLOSED</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
{{else docking_status == "docking"}}
{{if door_state == "open"}}
<span class="good">OPEN</span>
{{else door_state == "closed" && door_lock == "locked"}}
<span class="good">SECURED</span>
{{else door_state == "closed" && door_lock == "unlocked"}}
<span class="good">UNSECURED</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
{{else docking_status == "undocking"}}
{{if door_state == "open"}}
<span class="average">OPEN</span>
{{else door_state == "closed" && door_lock == "locked"}}
<span class="good">SECURED</span>
{{else door_state == "closed" && door_lock == "unlocked"}}
<span class="average">UNSECURED</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
{{else docking_status == "undocked"}}
{{if door_state == "open"}}
<span class="bad">OPEN</span>
{{else door_state == "closed" && door_lock == "locked"}}
<span class="good">SECURED</span>
{{else door_state == "closed" && door_lock == "unlocked"}}
<span class="bad">UNSECURED</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
{{else}}
<span class="bad">ERROR</span>
{{/if}}
</div>
</div>
</div>
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemContent" style="padding-top: 2px; width: 100%">
{{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}}
</div>
</div>
</div>
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemContent" style="padding-top: 2px; width: 100%">
{{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}}
</div>
</div>
</div>