Skip to content

Commit

Permalink
Project ARES: Logging tweaks & updates (cmss13-devs#4225)
Browse files Browse the repository at this point in the history
# About the pull request
Merges the AntiAir and Security Update logs.
Fixes Security Updates to actually work (I still don't know why they
weren't working)
Replaces AntiAir logs with the flight records from logs I made in cmss13-devs#4024 
Fixes ARES logs keeping the mob datum rather than just passing the name
string.
<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
fix: Fixes ARES Security Logs and stops ARES logs recording mob datums
instead of names.
add: Moves AntiAir records to Security Logs.
add: Adds Flight Records to ARES Interface, detailing launches and
setting changes. Does not include CAS details.
code: Changes ARES log procs from using 'user' to 'user_name' to
identify it should be the string rather than mob datum.
/:cl:
  • Loading branch information
realforest2001 committed Sep 11, 2023
1 parent adb4ce2 commit b6f10e1
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 58 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
50 changes: 25 additions & 25 deletions code/game/machinery/ARES/ARES_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,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(user_name, 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_antiair(mob/living/user, details)
interface.records_security.Add(new /datum/ares_record/antiair(details, user))

/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, user_name)
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(user_name, 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 @@ -227,8 +230,6 @@ GLOBAL_LIST_INIT(maintenance_categories, list(

var/list/logged_alerts = list()
for(var/datum/ares_record/security/security_alert as anything in records_security)
if(!istype(security_alert))
continue
var/list/current_alert = list()
current_alert["time"] = security_alert.time
current_alert["title"] = security_alert.title
Expand All @@ -237,6 +238,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 @@ -282,18 +294,6 @@ GLOBAL_LIST_INIT(maintenance_categories, list(
logged_discussions += list(deleted_disc)
data["deleted_discussions"] = logged_discussions

var/list/logged_adjustments = list()
for(var/datum/ares_record/antiair/aa_adjustment as anything in records_security)
if(!istype(aa_adjustment))
continue
var/list/current_adjustment = list()
current_adjustment["time"] = aa_adjustment.time
current_adjustment["details"] = aa_adjustment.details
current_adjustment["user"] = aa_adjustment.user
current_adjustment["ref"] = "\ref[aa_adjustment]"
logged_adjustments += list(current_adjustment)
data["aa_adjustments"] = logged_adjustments

var/list/logged_orders = list()
for(var/datum/ares_record/requisition_log/req_order as anything in records_asrs)
if(!istype(req_order))
Expand Down Expand Up @@ -431,12 +431,12 @@ 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"
if("page_antiair")
last_menu = current_menu
current_menu = "antiair"
if("page_emergency")
last_menu = current_menu
current_menu = "emergency"
Expand All @@ -460,7 +460,7 @@ GLOBAL_LIST_INIT(maintenance_categories, list(
new_title = "[record.title] at [record.time]"
new_details = record.details
records_announcement -= record
if(ARES_RECORD_SECURITY)
if(ARES_RECORD_SECURITY, ARES_RECORD_ANTIAIR)
new_title = "[record.title] at [record.time]"
new_details = record.details
records_security -= record
Expand Down
12 changes: 10 additions & 2 deletions code/game/machinery/ARES/ARES_records.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@
/datum/ares_record/security
record_name = ARES_RECORD_SECURITY

/datum/ares_record/antiair
/datum/ares_record/security/antiair
record_name = ARES_RECORD_ANTIAIR

/datum/ares_record/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
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/almayer_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@
if(!level_selected)
return

set_security_level(seclevel2num(level_selected))
set_security_level(seclevel2num(level_selected), log = ARES_LOG_NONE)
log_game("[key_name(usr)] has changed the security level to [get_security_level()].")
message_admins("[key_name_admin(usr)] has changed the security level to [get_security_level()].")
var/datum/ares_link/link = GLOB.ares_link
link.log_ares_security("Security Level Update", "[usr] has changed the security level to [get_security_level()].")
link.log_ares_security("Manual Security Update", "[usr] has changed the security level to [get_security_level()].")
. = TRUE

if("messageUSCM")
Expand Down
5 changes: 3 additions & 2 deletions code/game/supplyshuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,9 @@ var/datum/controller/supply/supply_controller = new()
var/pack_name = supply_pack.name
if(supply_pack.dollar_cost)
pack_source = "Unknown"
pack_name = "Unknown"
link.log_ares_requisition(pack_source, pack_name, usr)
if(prob(90))
pack_name = "Unknown"
link.log_ares_requisition(pack_source, pack_name, usr.name)
else
temp = "Not enough money left.<BR>"
temp += "<BR><A href='?src=\ref[src];viewrequests=1'>Back</A> <A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
Expand Down
4 changes: 2 additions & 2 deletions code/modules/cm_marines/anti_air.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ var/obj/structure/anti_air_cannon/almayer_aa_cannon
almayer_aa_cannon.protecting_section = ""
return
message_admins("[key_name(usr)] has set the AA to [html_encode(almayer_aa_cannon.protecting_section)].")
link.log_ares_antiair(usr, "Set AA to cover [html_encode(almayer_aa_cannon.protecting_section)].")
link.log_ares_antiair("[usr] Set AA to cover [html_encode(almayer_aa_cannon.protecting_section)].")
. = TRUE
if("deactivate")
almayer_aa_cannon.protecting_section = ""
message_admins("[key_name(usr)] has deactivated the AA cannon.")
link.log_ares_antiair(usr, "Deactivated Anti Air systems.")
link.log_ares_antiair("[usr] Deactivated Anti Air systems.")
. = TRUE

add_fingerprint(usr)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/cm_marines/overwatch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@
log_attack("[key_name(user)] fired an orbital bombardment in [A.name] for squad '[current_squad]'")

/// Project ARES interface log.
GLOB.ares_link.log_ares_bombardment(user, ob_name, "X[x_bomb], Y[y_bomb] in [A.name]")
GLOB.ares_link.log_ares_bombardment(user.name, ob_name, "X[x_bomb], Y[y_bomb] in [A.name]")

busy = FALSE
var/turf/target = locate(T.x + rand(-3, 3), T.y + rand(-3, 3), T.z)
Expand Down
14 changes: 7 additions & 7 deletions code/modules/security_levels/security_levels.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//config.alert_desc_blue_downto


/proc/set_security_level(level, no_sound=0, announce=1)
/proc/set_security_level(level, no_sound = FALSE, announce = TRUE, log = ARES_LOG_SECURITY)
if(level != security_level)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_SECURITY_LEVEL_CHANGED, level)

Expand All @@ -16,32 +16,32 @@
switch(level)
if(SEC_LEVEL_GREEN)
if(announce)
ai_announcement("Attention: Security level lowered to GREEN - all clear.", no_sound ? null : 'sound/AI/code_green.ogg', ARES_LOG_SECURITY)
ai_announcement("Attention: Security level lowered to GREEN - all clear.", no_sound ? null : 'sound/AI/code_green.ogg', log)
security_level = SEC_LEVEL_GREEN

if(SEC_LEVEL_BLUE)
if(security_level < SEC_LEVEL_BLUE)
if(announce)
ai_announcement("Attention: Security level elevated to BLUE - potentially hostile activity on board.", no_sound ? null : 'sound/AI/code_blue_elevated.ogg', ARES_LOG_SECURITY)
ai_announcement("Attention: Security level elevated to BLUE - potentially hostile activity on board.", no_sound ? null : 'sound/AI/code_blue_elevated.ogg', log)
else
if(announce)
ai_announcement("Attention: Security level lowered to BLUE - potentially hostile activity on board.", no_sound ? null : 'sound/AI/code_blue_lowered.ogg', ARES_LOG_SECURITY)
ai_announcement("Attention: Security level lowered to BLUE - potentially hostile activity on board.", no_sound ? null : 'sound/AI/code_blue_lowered.ogg', log)
security_level = SEC_LEVEL_BLUE

if(SEC_LEVEL_RED)
if(security_level < SEC_LEVEL_RED)
if(announce)
ai_announcement("Attention: Security level elevated to RED - there is an immediate threat to the ship.", no_sound ? null : 'sound/AI/code_red_elevated.ogg', ARES_LOG_SECURITY)
ai_announcement("Attention: Security level elevated to RED - there is an immediate threat to the ship.", no_sound ? null : 'sound/AI/code_red_elevated.ogg', log)
else
if(announce)
ai_announcement("Attention: Security level lowered to RED - there is an immediate threat to the ship.", no_sound ? null : 'sound/AI/code_red_lowered.ogg', ARES_LOG_SECURITY)
ai_announcement("Attention: Security level lowered to RED - there is an immediate threat to the ship.", no_sound ? null : 'sound/AI/code_red_lowered.ogg', log)
security_level = SEC_LEVEL_RED

if(SEC_LEVEL_DELTA)
if(announce)
var/name = "SELF-DESTRUCT SYSTEMS ACTIVE"
var/input = "DANGER, THE EMERGENCY DESTRUCT SYSTEM IS NOW ACTIVATED. PROCEED TO THE SELF-DESTRUCT CHAMBER FOR CONTROL ROD INSERTION."
marine_announcement(input, name, 'sound/AI/selfdestruct_short.ogg', logging = ARES_LOG_SECURITY)
marine_announcement(input, name, 'sound/AI/selfdestruct_short.ogg', logging = log)
security_level = SEC_LEVEL_DELTA
EvacuationAuthority.enable_self_destruct()

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 @@ -272,6 +272,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 @@ -350,6 +352,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 @@ -366,6 +369,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.name, "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 @@ -394,6 +398,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.name, "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 @@ -413,11 +418,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.name, "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.name, "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 @@ -440,6 +447,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.name, "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 @@ -456,6 +464,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.name, "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
Loading

0 comments on commit b6f10e1

Please sign in to comment.