Skip to content

Commit

Permalink
Flight records & user fix
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Aug 21, 2023
1 parent 9eafb52 commit dee12ef
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 6 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/ARES.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define ARES_RECORD_SECURITY "Security Update"
#define ARES_RECORD_MAINTENANCE "Maintenance Ticket"
#define ARES_RECORD_ACCESS "Access Ticket"
#define ARES_RECORD_FLIGHT "Flight Record"

/// Not by ARES logged through marine_announcement()
#define ARES_LOG_NONE 0
Expand Down
4 changes: 3 additions & 1 deletion code/game/machinery/ARES/ARES.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@
var/list/records_talking = list()
/// Holds all (/datum/ares_record/requisition_log)s
var/list/records_asrs = list()
/// Holds all (/datum/ares_record/security)s and (/datum/ares_record/antiair)s
/// Holds all (/datum/ares_record/security)s (including AA)
var/list/records_security = list()
/// Holds all (/datum/ares_record/flight)s
var/list/records_flight = list()
/// Is nuke request usable or not?
var/nuke_available = TRUE

Expand Down
25 changes: 21 additions & 4 deletions code/game/machinery/ARES/ARES_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,23 @@ GLOBAL_LIST_INIT(maintenance_categories, list(
/datum/ares_link/proc/log_ares_bioscan(title, input)
interface.records_bioscan.Add(new /datum/ares_record/bioscan(title, input))

/datum/ares_link/proc/log_ares_bombardment(mob/living/user, ob_name, coordinates)
interface.records_bombardment.Add(new /datum/ares_record/bombardment(ob_name, "Bombardment fired at [coordinates].", user))
/datum/ares_link/proc/log_ares_bombardment(mob/user, ob_name, coordinates)
interface.records_bombardment.Add(new /datum/ares_record/bombardment(ob_name, "Bombardment fired at [coordinates].", user.name))

/datum/ares_link/proc/log_ares_announcement(title, message)
interface.records_announcement.Add(new /datum/ares_record/announcement(title, message))

/datum/ares_link/proc/log_ares_requisition(source, details, mob/living/user)
interface.records_asrs.Add(new /datum/ares_record/requisition_log(source, details, user))
/datum/ares_link/proc/log_ares_requisition(source, details, mob/user)
interface.records_asrs.Add(new /datum/ares_record/requisition_log(source, details, user.name))

/datum/ares_link/proc/log_ares_security(title, details)
interface.records_security.Add(new /datum/ares_record/security(title, details))

/datum/ares_link/proc/log_ares_antiair(details)
interface.records_security.Add(new /datum/ares_record/security/antiair(details))

/datum/ares_link/proc/log_ares_flight(mob/user, details)
interface.records_flight.Add(new /datum/ares_record/flight(details, user.name))
// ------ End ARES Logging Procs ------ //

/proc/ares_apollo_talk(broadcast_message)
Expand Down Expand Up @@ -232,6 +235,17 @@ GLOBAL_LIST_INIT(maintenance_categories, list(
logged_alerts += list(current_alert)
data["records_security"] = logged_alerts

var/list/logged_flights = list()
for(var/datum/ares_record/flight/flight_log as anything in records_flight)
var/list/current_flight = list()
current_flight["time"] = flight_log.time
current_flight["title"] = flight_log.title
current_flight["details"] = flight_log.details
current_flight["user"] = flight_log.user
current_flight["ref"] = "\ref[flight_log]"
logged_flights += list(current_flight)
data["records_flight"] = logged_flights

var/list/logged_bioscans = list()
for(var/datum/ares_record/bioscan/scan as anything in records_bioscan)
var/list/current_scan = list()
Expand Down Expand Up @@ -414,6 +428,9 @@ GLOBAL_LIST_INIT(maintenance_categories, list(
if("page_security")
last_menu = current_menu
current_menu = "security"
if("page_flight")
last_menu = current_menu
current_menu = "flight_log"
if("page_requisitions")
last_menu = current_menu
current_menu = "requisitions"
Expand Down
11 changes: 10 additions & 1 deletion code/game/machinery/ARES/ARES_records.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,20 @@
/datum/ares_record/security/antiair
record_name = ARES_RECORD_ANTIAIR

/datum/ares_record/security/antiair/New(details, user)
/datum/ares_record/security/antiair/New(details)
time = worldtime2text()
src.title = "AntiAir Adjustment"
src.details = details

/datum/ares_record/flight
record_name = ARES_RECORD_FLIGHT

/datum/ares_record/flight/New(details, user)
time = worldtime2text()
src.title = "Flight Log"
src.details = details
src.user = user

/datum/ares_record/bombardment
record_name = ARES_RECORD_BOMB

Expand Down
9 changes: 9 additions & 0 deletions code/modules/shuttle/computers/dropship_computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@
GLOB.alt_ctrl_disabled = TRUE

marine_announcement("Unscheduled dropship departure detected from operational area. Hijack likely. Shutting down autopilot.", "Dropship Alert", 'sound/AI/hijack.ogg', logging = ARES_LOG_SECURITY)
var/datum/ares_link/link = GLOB.ares_link
link.log_ares_flight("Unknown", "Unscheduled dropship departure detected from operational area. Hijack likely. Shutting down autopilot.")

var/mob/living/carbon/xenomorph/xeno = user
var/hivenumber = XENO_HIVE_NORMAL
Expand Down Expand Up @@ -346,6 +348,7 @@
to_chat(user, SPAN_WARNING("The dropship isn't responding to controls."))
return

var/datum/ares_link/link = GLOB.ares_link
switch(action)
if("move")
if(shuttle.mode != SHUTTLE_IDLE && (shuttle.mode != SHUTTLE_CALL && !shuttle.destination))
Expand All @@ -362,6 +365,7 @@
update_equipment(is_optimised)
if(is_set_flyby)
to_chat(user, SPAN_NOTICE("You begin the launch sequence for a flyby."))
link.log_ares_flight(user, "Launched Dropship [shuttle.name] on a flyby.")
var/log = "[key_name(user)] launched the dropship [src.shuttleId] on flyby."
msg_admin_niche(log)
log_interact(user, msg = "[log]")
Expand Down Expand Up @@ -390,6 +394,7 @@
return TRUE
SSshuttle.moveShuttle(shuttle.id, dock.id, TRUE)
to_chat(user, SPAN_NOTICE("You begin the launch sequence to [dock]."))
link.log_ares_flight(user, "Launched Dropship [shuttle.name] on a flight to [dock].")
var/log = "[key_name(user)] launched the dropship [src.shuttleId] on transport."
msg_admin_niche(log)
log_interact(user, msg = "[log]")
Expand All @@ -409,11 +414,13 @@
to_chat(user, SPAN_WARNING("Door controls have been overridden. Please call technical support."))
if("set-ferry")
is_set_flyby = FALSE
link.log_ares_flight(user, "Set Dropship [shuttle.name] to transport runs.")
var/log = "[key_name(user)] set the dropship [src.shuttleId] into transport"
msg_admin_niche(log)
log_interact(user, msg = "[log]")
if("set-flyby")
is_set_flyby = TRUE
link.log_ares_flight(user, "Set Dropship [shuttle.name] to flyby runs.")
var/log = "[key_name(user)] set the dropship [src.shuttleId] into flyby."
msg_admin_niche(log)
log_interact(user, msg = "[log]")
Expand All @@ -436,6 +443,7 @@
shuttle.automated_lz_id = ground_lz
shuttle.automated_delay = delay
playsound(loc, get_sfx("terminal_button"), KEYBOARD_SOUND_VOLUME, 1)
link.log_ares_flight(user, "Enabled autopilot for Dropship [shuttle.name].")
var/log = "[key_name(user)] has enabled auto pilot on '[shuttle.name]'"
message_admins(log)
log_interact(user, msg = "[log]")
Expand All @@ -452,6 +460,7 @@
shuttle.automated_lz_id = null
shuttle.automated_delay = null
playsound(loc, get_sfx("terminal_button"), KEYBOARD_SOUND_VOLUME, 1)
link.log_ares_flight(user, "Disabled autopilot for Dropship [shuttle.name].")
var/log = "[key_name(user)] has disabled auto pilot on '[shuttle.name]'"
message_admins(log)
log_interact(user, msg = "[log]")
Expand Down
2 changes: 2 additions & 0 deletions code/modules/shuttles/marine_ferry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
automated_launch = FALSE
automated_launch_timer = TIMER_ID_NULL
ai_silent_announcement("Dropship '[name]' departing.")
var/datum/ares_link/link = GLOB.ares_link
link.log_ares_flight("Automated", "Dropship [name] launched on an automatic flight.")


/*
Expand Down
2 changes: 2 additions & 0 deletions code/modules/shuttles/shuttle_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ GLOBAL_LIST_EMPTY(shuttle_controls)

marine_announcement("Unscheduled dropship departure detected from operational area. Hijack likely. Shutting down autopilot.", "Dropship Alert", 'sound/AI/hijack.ogg', logging = ARES_LOG_SECURITY)
shuttle.alerts_allowed--
var/datum/ares_link/link = GLOB.ares_link
link.log_ares_flight("Unknown", "Unscheduled dropship departure detected from operational area. Hijack likely. Shutting down autopilot.")

to_chat(Q, SPAN_DANGER("A loud alarm erupts from [src]! The fleshy hosts must know that you can access it!"))
xeno_message(SPAN_XENOANNOUNCE("The Queen has commanded the metal bird to depart for the metal hive in the sky! Rejoice!"),3,Q.hivenumber)
Expand Down
108 changes: 108 additions & 0 deletions tgui/packages/tgui/interfaces/AresInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const PAGES = {
'apollo': () => ApolloLog,
'access_log': () => AccessLogs,
'delete_log': () => DeletionLogs,
'flight_log': () => FlightLogs,
'talking': () => ARESTalk,
'deleted_talks': () => DeletedTalks,
'read_deleted': () => ReadingTalks,
Expand Down Expand Up @@ -191,6 +192,18 @@ const MainMenu = (props, context) => {
<Stack.Item grow>
<h3>Access Level 2</h3>
</Stack.Item>
<Stack.Item>
<Button
content="Flight Records"
tooltip="Read the Dropship Flight Control Records."
icon="jet-fighter-up"
ml="auto"
px="2rem"
width="25vw"
bold
onClick={() => act('page_flight')}
/>
</Stack.Item>
<Stack.Item>
<Button
content="Security Updates"
Expand Down Expand Up @@ -1172,6 +1185,101 @@ const Requisitions = (props, context) => {
);
};

const FlightLogs = (props, context) => {
const { data, act } = useBackend(context);
const {
logged_in,
access_text,
last_page,
current_menu,
records_flight,
access_level,
} = data;

return (
<>
<Section>
<Flex align="center">
<Box>
<Button
icon="arrow-left"
px="2rem"
textAlign="center"
tooltip="Go back"
onClick={() => act('go_back')}
disabled={last_page === current_menu}
/>
<Button
icon="house"
ml="auto"
mr="1rem"
tooltip="Navigation Menu"
onClick={() => act('home')}
/>
</Box>

<h3>
{logged_in}, {access_text}
</h3>

<Button.Confirm
content="Logout"
icon="circle-user"
ml="auto"
px="2rem"
bold
onClick={() => act('logout')}
/>
</Flex>
</Section>

<Section>
<h1 align="center">Flight Control Logs</h1>
{!!records_flight.length && (
<Flex
className="candystripe"
p=".75rem"
align="center"
fontSize="1.25rem">
<Flex.Item bold width="6rem" shrink="0" mr="1rem">
Time
</Flex.Item>
<Flex.Item width="10rem" grow bold>
User
</Flex.Item>
<Flex.Item width="40rem" textAlign="center">
Details
</Flex.Item>
</Flex>
)}
{records_flight.map((record, i) => {
return (
<Flex key={i} className="candystripe" p=".75rem" align="center">
<Flex.Item bold width="6rem" shrink="0" mr="1rem">
{record.time}
</Flex.Item>
<Flex.Item width="10rem" grow italic>
{record.user}
</Flex.Item>
<Flex.Item width="40rem" ml="1rem" shrink="0" textAlign="center">
{record.details}
</Flex.Item>
<Flex.Item ml="1rem">
<Button.Confirm
icon="trash"
tooltip="Delete Record"
disabled={access_level < 4}
onClick={() => act('delete_record', { record: record.ref })}
/>
</Flex.Item>
</Flex>
);
})}
</Section>
</>
);
};

const Security = (props, context) => {
const { data, act } = useBackend(context);
const {
Expand Down

0 comments on commit dee12ef

Please sign in to comment.