Replaces the emergency shuttle control console

Replaces the old emergency shuttle control console with a nice new
NanoUI one. Improves the NanoUI for the docking controllers.
This commit is contained in:
mwerezak
2014-06-23 21:49:10 -04:00
parent 9e0562b16c
commit e17b8bffab
9 changed files with 346 additions and 62 deletions

View File

@@ -21,6 +21,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
var/auto_recall_time //the time at which the shuttle will be auto-recalled
var/evac = 0 //1 = emergency evacuation, 0 = crew transfer
var/wait_for_launch = 0 //if the shuttle is waiting to launch
var/autopilot = 1 //set to 0 to disable the shuttle automatically launching
var/deny_shuttle = 0 //allows admins to prevent the shuttle from being called
var/departed = 0 //if the shuttle has left the station at least once
@@ -76,32 +77,23 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
if (world.time >= launch_time) //time to launch the shuttle
stop_launch_countdown()
//set the travel time
if (!shuttle.location) //leaving from the station
//launch the pods!
for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods)
pod.launch(src)
shuttle.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN
else
shuttle.travel_time = SHUTTLE_TRANSIT_DURATION
shuttle.launch(src)
if(autopilot)
shuttle.launch(src)
//called when the shuttle has arrived.
/datum/emergency_shuttle_controller/proc/shuttle_arrived()
if (!shuttle.location) //at station
if (!shuttle.location && autopilot) //at station
set_launch_countdown(SHUTTLE_LEAVETIME) //get ready to return
//begins the launch countdown and sets the amount of time left until launch
//if the launch countdown has already been set then this may reduce the countdown time, but not extend it
//to reset for a later time, just stop the timer first
/datum/emergency_shuttle_controller/proc/set_launch_countdown(var/seconds)
if (wait_for_launch)
launch_time = min(world.time + seconds*10, launch_time)
else
wait_for_launch = 1
launch_time = world.time + seconds*10
wait_for_launch = 1
launch_time = world.time + seconds*10
/datum/emergency_shuttle_controller/proc/stop_launch_countdown()
wait_for_launch = 0
@@ -111,6 +103,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
if(!can_call()) return
//set the launch timer
autopilot = 1
set_launch_countdown(get_shuttle_prep_time())
auto_recall_time = rand(world.time + 300, launch_time - 300)
@@ -126,10 +119,11 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
if(!can_call()) return
//set the launch timer
autopilot = 1
set_launch_countdown(get_shuttle_prep_time())
auto_recall_time = rand(world.time + 300, launch_time - 300)
captain_announce("A crew transfer has been initiated. The shuttle has been called. It will arrive in [round(estimate_arrival_time()/60)] minutes.")
captain_announce("A crew transfer has been initiated. The shuttle has been called. It will arrive in approximately [round(estimate_arrival_time()/60)] minutes.")
//recalls the shuttle
/datum/emergency_shuttle_controller/proc/recall()
@@ -192,10 +186,10 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
//returns the time left until the shuttle arrives at it's destination, in seconds
/datum/emergency_shuttle_controller/proc/estimate_arrival_time()
var/eta
if (isnull(shuttle.jump_time))
eta = launch_time + shuttle.travel_time
if (isnull(shuttle.last_move_time))
eta = launch_time + shuttle.travel_time*10
else
eta = shuttle.jump_time + shuttle.travel_time
eta = shuttle.last_move_time + shuttle.travel_time*10
return (eta - world.time)/10
//returns the time left until the shuttle launches, in seconds
@@ -286,8 +280,3 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
S.direction = spawndir
spawn()
S.startmove()
#undef SHUTTLE_PREPTIME
#undef SHUTTLE_LEAVETIME
#undef SHUTTLE_TRANSIT_DURATION
#undef SHUTTLE_TRANSIT_DURATION_RETURN

View File

@@ -130,19 +130,19 @@ var/global/datum/shuttle_controller/shuttle_controller
VS.origin = /area/shuttle/vox/station
VS.destinations = list(
"Fore Starboard Solars" = /area/vox_station/northeast_solars,
"Fore Port Solars" = /area/vox_station/northwest_solars,
"Aft Starboard Solars" = /area/vox_station/southeast_solars,
"Aft Port Solars" = /area/vox_station/southwest_solars,
"Mining asteroid" = /area/vox_station/mining
"Fore Starboard Solars" = locate(/area/vox_station/northeast_solars),
"Fore Port Solars" = locate(/area/vox_station/northwest_solars),
"Aft Starboard Solars" = locate(/area/vox_station/southeast_solars),
"Aft Port Solars" = locate(/area/vox_station/southwest_solars),
"Mining asteroid" = locate(/area/vox_station/mining)
)
VS.announcer = "NSV Icarus"
VS.arrival_message = "Attention, Exodus, we just tracked a small target bypassing our defensive perimeter. Can't fire on it without hitting the station - you've got incoming visitors, like it or not."
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.interim = locate(/area/vox_station/transit)
VS.warmup_time = 10
VS.warmup_time = 0
shuttles["Vox Skipjack"] = VS
//Nuke Ops shuttle.
@@ -150,22 +150,22 @@ var/global/datum/shuttle_controller/shuttle_controller
MS.origin = /area/syndicate_station/start
MS.destinations = list(
"Northwest of the station" = /area/syndicate_station/northwest,
"North of the station" = /area/syndicate_station/north,
"Northeast of the station" = /area/syndicate_station/northeast,
"Southwest of the station" = /area/syndicate_station/southwest,
"South of the station" = /area/syndicate_station/south,
"Southeast of the station" = /area/syndicate_station/southeast,
"Telecomms Satellite" = /area/syndicate_station/commssat,
"Mining Asteroid" = /area/syndicate_station/mining
"Northwest of the station" = locate(/area/syndicate_station/northwest),
"North of the station" = locate(/area/syndicate_station/north),
"Northeast of the station" = locate(/area/syndicate_station/northeast),
"Southwest of the station" = locate(/area/syndicate_station/southwest),
"South of the station" = locate(/area/syndicate_station/south),
"Southeast of the station" = locate(/area/syndicate_station/southeast),
"Telecomms Satellite" = locate(/area/syndicate_station/commssat),
"Mining Asteroid" = locate(/area/syndicate_station/mining)
)
MS.announcer = "NSV Icarus"
MS.arrival_message = "Attention, Exodus, you have a large signature approaching the station - looks unarmed to surface scans. We're too far out to intercept - brace for visitors."
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.interim = locate(/area/syndicate_station/transit)
MS.warmup_time = 10
MS.warmup_time = 0
shuttles["Syndicate"] = MS

View File

@@ -21,6 +21,7 @@
"processing" = airlock_program.memory["processing"],
"docking_status" = docking_program.get_docking_status(),
"airlock_disabled" = !(docking_program.undocked() || docking_program.override_enabled),
"override_enabled" = docking_program.override_enabled,
)
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)

View File

@@ -57,7 +57,7 @@
if (destination == area_station) location = 0
if (destination == area_offsite) location = 1
//if this is a long_jump retain the location we were last at until we get to the new one
//if this is a long_jump retain the location we were last at until we get to the new one
/datum/shuttle/ferry/proc/get_location_area(location_id = null)
if (isnull(location_id))
@@ -73,7 +73,7 @@
if (skip_docking_checks() || docking_controller.can_launch())
if (travel_time && area_transition)
long_jump(null, null, area_transition, travel_time)
long_jump(interim=area_transition, travel_time=travel_time)
else
short_jump()
@@ -115,9 +115,10 @@
else
short_jump()
process_state = WAIT_ARRIVE
/datum/shuttle/ferry/proc/cancel_launch(var/obj/machinery/computer/shuttle_control/user)
/datum/shuttle/ferry/proc/cancel_launch(var/user)
if (!can_cancel()) return
moving_status = SHUTTLE_IDLE
@@ -165,7 +166,6 @@
var/shuttle_tag // Used to coordinate data in shuttle controller.
var/hacked = 0 // Has been emagged, no access restrictions.
var/launch_override = 0
/obj/machinery/computer/shuttle_control/attack_hand(user as mob)
@@ -238,7 +238,7 @@
if(href_list["force"])
shuttle.force_launch(src)
else if(href_list["cancel"])
shuttle.cancel_launch()
shuttle.cancel_launch(src)
/obj/machinery/computer/shuttle_control/attackby(obj/item/weapon/W as obj, mob/user as mob)

View File

@@ -1,22 +1,227 @@
/datum/shuttle/ferry/emergency
var/jump_time = null //the time at which the shuttle last jumped. Used for ETAs
var/last_move_time = null //the time at which the shuttle last moved. Used for ETAs
/datum/shuttle/ferry/emergency/arrived()
emergency_shuttle.shuttle_arrived()
/datum/shuttle/ferry/emergency/long_jump(var/area/departing,var/area/destination,var/area/interim,var/travel_time)
if (!location)
travel_time = SHUTTLE_TRANSIT_DURATION_RETURN
else
travel_time = SHUTTLE_TRANSIT_DURATION
..()
/*
/area/shuttle/escape/centcom/verb/shuttle_long_jump(var/area/A as area, var/area/B as area, var/area/I as area, var/travel_time as num)
set category = "Debug"
//set src in world
var/datum/shuttle/ferry/emergency/E = shuttle_controller.shuttles["Escape"]
E.long_jump(A, B, I, travel_time)
/area/shuttle/escape/centcom/verb/shuttle_move(var/area/A as area, var/area/B as area)
set category = "Debug"
//set src in world
var/datum/shuttle/ferry/emergency/E = shuttle_controller.shuttles["Escape"]
E.long_jump(A, B)
*/
/datum/shuttle/ferry/emergency/move(var/area/origin,var/area/destination)
if (destination == area_transition)
jump_time = world.time
last_move_time = world.time
else
jump_time = null
last_move_time = null
if (!location) //leaving the station
emergency_shuttle.departed = 1
captain_announce("The Emergency Shuttle has left the station. Estimate [round(emergency_shuttle.estimate_arrival_time()/60,1)] minutes until the shuttle docks at Central Command.")
..(origin, destination)
/datum/shuttle/ferry/emergency/launch(var/user)
if (!can_launch()) 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 (!C.has_authorization())
return
if (emergency_shuttle.autopilot)
emergency_shuttle.autopilot = 0
world << "\blue <B>Alert: The shuttle autopilot has been overridden. Launch sequence initiated!</B>"
..(user)
/datum/shuttle/ferry/emergency/force_launch(var/user)
if (!can_force()) 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 (!C.has_authorization())
return
if (emergency_shuttle.autopilot)
emergency_shuttle.autopilot = 0
world << "\blue <B>Alert: The shuttle autopilot has been overridden. Bluespace drive engaged!</B>"
..(user)
/datum/shuttle/ferry/emergency/cancel_launch(var/user)
if (!can_cancel()) 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 (!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
var/req_authorizations = 3
var/list/authorized = list()
/obj/machinery/computer/shuttle_control/emergency/proc/has_authorization()
return (authorized.len >= req_authorizations || emagged)
//returns 1 if the ID was accepted and a new authorization was added, 0 otherwise
/obj/machinery/computer/shuttle_control/emergency/proc/read_authorization(var/ident)
if (authorized.len >= req_authorizations)
return 0 //don't need any more
var/list/access
var/auth_name
var/dna_hash
if(istype(ident, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/ID = ident
access = ID.access
auth_name = "[ID.registered_name] ([ID.assignment])"
dna_hash = ID.dna_hash
if(istype(ident, /obj/item/device/pda))
var/obj/item/device/pda/PDA = ident
access = PDA.id.access
auth_name = "[PDA.id.registered_name] ([PDA.id.assignment])"
dna_hash = PDA.id.dna_hash
if (!access || !istype(access))
return 0 //not an ID
if (dna_hash in authorized)
src.visible_message("[src] buzzes. That ID has already been scanned.")
return 0
if (!(access_heads in access))
src.visible_message("[src] buzzes, rejecting [ident].")
return 0
src.visible_message("[src] beeps as it scans [ident].")
authorized[dna_hash] = auth_name
if (req_authorizations - authorized.len)
world << "\blue <B>Alert: [req_authorizations - authorized.len] authorization\s needed override the shuttle autopilot.</B>"
return 1
/obj/machinery/computer/shuttle_control/emergency/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/card/emag) && !emagged)
user << "\blue You short out the [src]'s authorization protocols."
emagged = 1
return
read_authorization(W)
..()
/obj/machinery/computer/shuttle_control/emergency/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
var/data[0]
var/datum/shuttle/ferry/emergency/shuttle = shuttle_controller.shuttles[shuttle_tag]
if (!istype(shuttle))
return
var/shuttle_state
switch(shuttle.moving_status)
if(SHUTTLE_IDLE) shuttle_state = "idle"
if(SHUTTLE_WARMUP) shuttle_state = "warmup"
if(SHUTTLE_INTRANSIT) shuttle_state = "in_transit"
var/shuttle_status
switch (shuttle.process_state)
if(IDLE_STATE)
if (shuttle.in_use)
shuttle_status = "Busy."
else if (!shuttle.location)
shuttle_status = "Standing-by at [station_name]."
else
shuttle_status = "Standing-by at Central Command."
if(WAIT_LAUNCH)
shuttle_status = "Shuttle has recieved command and will depart shortly."
if(WAIT_ARRIVE)
shuttle_status = "Proceeding to destination."
if(WAIT_FINISH)
shuttle_status = "Arriving at destination now."
//build a list of authorizations
var/list/auth_list[req_authorizations]
if (!emagged)
var/i = 1
for (var/dna_hash in authorized)
auth_list[i++] = list("auth_name"=authorized[dna_hash], "auth_hash"=dna_hash)
while (i <= req_authorizations) //for some reason dream maker gives warnings if you use for(; i <= req_authorizations; i++) here.
auth_list[i++] = list("auth_name"="", "auth_hash"=-1)
else
for (var/i = 1; i <= req_authorizations; i++)
auth_list[i] = list("auth_name"="<font color=\"red\">ERROR</font>", "auth_hash"=-1)
var/has_auth = has_authorization()
data = list(
"shuttle_status" = shuttle_status,
"shuttle_state" = shuttle_state,
"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() && has_auth,
"can_cancel" = shuttle.can_cancel() && has_auth,
"can_force" = shuttle.can_force() && has_auth,
"auth_list" = auth_list,
"has_auth" = has_auth,
"user" = debug? user : null,
)
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.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/obj/machinery/computer/shuttle_control/emergency/Topic(href, href_list)
if(..())
return
if(href_list["auth"])
if (!emagged && href_list["auth"] == -1)
//They selected an empty entry. Try to scan their id.
if (ishuman(usr))
var/mob/living/carbon/human/H = usr
if (!read_authorization(H.get_active_hand())) //try to read what's in their hand first
read_authorization(H.wear_id)
else
//remove the authorization
var/dna_hash = href_list["auth"]
authorized -= dna_hash
/datum/shuttle/ferry/escape_pod
//pass

View File

@@ -7525,7 +7525,7 @@
"cOK" = (/turf/unsimulated/beach/sand{tag = "icon-seashallow"; icon_state = "seashallow"},/area/centcom/ferry)
"cOL" = (/obj/machinery/air_sensor{frequency = 1441; id_tag = "engine_sensor"; output = 63},/turf/simulated/floor/plating{dir = 2; icon_state = "warnplate"},/area/engine/engine_room)
"cOM" = (/obj/structure/stool/bed/chair{dir = 1},/turf/simulated/shuttle/floor,/area/shuttle/escape/centcom)
"cON" = (/obj/machinery/computer/shuttle,/turf/simulated/shuttle/floor,/area/shuttle/escape/centcom)
"cON" = (/obj/machinery/computer/shuttle_control/emergency,/turf/simulated/shuttle/floor,/area/shuttle/escape/centcom)
"cOO" = (/turf/unsimulated/beach/sand{tag = "icon-beachcorner"; icon_state = "beachcorner"},/area/centcom/ferry)
"cOP" = (/turf/unsimulated/beach/sand{tag = "icon-beach (SOUTHEAST)"; icon_state = "beach"; dir = 6},/area/centcom/ferry)
"cOQ" = (/obj/structure/shuttle/engine/propulsion{icon_state = "burst_r"; dir = 4},/turf/space,/area/shuttle/specops/centcom)

View File

@@ -5,42 +5,51 @@
</div>
{{if docking_status == "docked"}}
<div class="itemContent" style="float:left">
{{if airlock_disabled}}
{{if !override_enabled}}
<span class="good" style="float:left">DOCKED</span>
{{else}}
<span class="bad" style="float:left">DOCKED-OVERRIDE ENABLED</span>
{{/if}}
<span style="float:right">
{{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, airlock_disabled ? null : 'redBackground')}}
{{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}}
</span>
</div>
{{else docking_status == "docking"}}
<div class="itemContent" style="float:left">
{{if airlock_disabled}}
{{if !override_enabled}}
<span class="average" style="float:left">DOCKING</span>
{{else}}
<span class="bad" style="float:left">DOCKING-OVERRIDE ENABLED</span>
{{/if}}
<span style="float:right">
{{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, airlock_disabled ? null : 'redBackground')}}
{{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}}
</span>
</div>
{{else docking_status == "undocking"}}
<div class="itemContent" style="float:left">
{{if airlock_disabled}}
{{if !override_enabled}}
<span class="average" style="float:left">UNDOCKING</span>
{{else}}
<span class="bad" style="float:left">UNDOCKING-OVERRIDE ENABLED</span>
{{/if}}
<span style="float:right">
{{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, airlock_disabled ? null : 'redBackground')}}
{{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}}
</span>
</div>
{{else docking_status == "undocked"}}
<span class="idle">NOT IN USE</span>
<div class="itemContent" style="float:left">
{{if !override_enabled}}
<span class="idle" style="float:left">NOT IN USE</span>
{{else}}
<span class="bad" style="float:left">OVERRIDE ENABLED</span>
{{/if}}
<span style="float:right">
{{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}}
</span>
</div>
{{else}}
<span class="bad">ERROR</span>
{{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, airlock_disabled ? null : 'redBackground')}}
{{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}}
{{/if}}
</div>
</div>

View File

@@ -0,0 +1,80 @@
<h3>Shuttle Status</h3>
<div class="item" style="padding-top: 10px">
<div class="item">
{{:shuttle_status}}
</div>
</div>
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemLabel">
Bluespace Drive:
</div>
<div class="itemContent">
{{if shuttle_state == "idle"}}
<span class="idle">IDLE</span>
{{else shuttle_state == "warmup"}}
<span style="font-weight: bold;color: #336699">SPINNING UP</span>
{{else shuttle_state == "in_transit"}}
<span style="font-weight: bold;color: #336699">ENGAGED</span>
{{else}}
<span class="bad">ERROR</span>
{{/if}}
</div>
</div>
</div>
{{if has_docking}}
<div class="item" style="padding-top: 10px">
<div class="item">
<div class="itemLabel">
Docking Status:
</div>
<div class="itemContent">
{{if docking_status == "docked"}}
<span class="good">DOCKED</span>
{{else docking_status == "docking"}}
{{if !docking_override}}
<span class="average">DOCKING</span>
{{else}}
<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>
{{/if}}
<h3>Shuttle Authorization</h3>
<div class="item">
<div class="item">
{{if has_auth}}
Access Granted. Shuttle controls unlocked.
{{else}}
Additional authorization required.
{{/if}}
</div>
</div>
<div class="item" style="padding-top: 10px">
{{for auth_list}}
{{:~link(auth_name, 'eject', {'auth' : auth_hash}, null, 'itemContentWide')}}
{{/for}}
</div>
<h3>Shuttle Control</h3>
<div class="item" style="padding-top: 10px">
<div class="item">
<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)}}
{{:~link('Force Launch', 'alert', {'force' : '1'}, can_force? null : 'disabled' , can_force? 'redBackground' : null)}}
</div>
</div>
</div>

View File

@@ -24,9 +24,9 @@
{{/if}}
{{else docking_status == "undocked"}}
{{if !override_enabled}}
<span class="idle">UNDOCKED</span>
<span class="idle">NOT IN USE</span>
{{else}}
<span class="bad">UNDOCKED-OVERRIDE ENABLED</span>
<span class="bad" style="float:left">OVERRIDE ENABLED</span>
{{/if}}
{{else}}
<span class="bad">ERROR</span>