Skip to content

Commit

Permalink
Merge AA and Sec logs. Also fixes Sec logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Aug 21, 2023
1 parent 56de9b3 commit 9eafb52
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 132 deletions.
25 changes: 4 additions & 21 deletions code/game/machinery/ARES/ARES_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ GLOBAL_LIST_INIT(maintenance_categories, list(
/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_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))
// ------ End ARES Logging Procs ------ //

/proc/ares_apollo_talk(broadcast_message)
Expand Down Expand Up @@ -224,8 +224,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 Down Expand Up @@ -279,18 +277,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,9 +417,6 @@ GLOBAL_LIST_INIT(maintenance_categories, list(
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 @@ -457,7 +440,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
5 changes: 2 additions & 3 deletions code/game/machinery/ARES/ARES_records.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
/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, user)
time = worldtime2text()
src.title = "AntiAir Adjustment"
src.details = details
src.user = user

/datum/ares_record/bombardment
record_name = ARES_RECORD_BOMB
Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/computer/almayer_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
/// requesting a distress beacon
COOLDOWN_DECLARE(cooldown_request)
/// requesting evac
COOLDOWN_DECLARE(cooldown_destruct)
COOLDOWN_DECLARE(cooldown_destruct)
/// messaging HC (admins)
COOLDOWN_DECLARE(cooldown_central)
/// making a ship announcement
COOLDOWN_DECLARE(cooldown_message)
COOLDOWN_DECLARE(cooldown_message)

var/list/messagetitle = list()
var/list/messagetext = list()
Expand Down 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
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
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
96 changes: 1 addition & 95 deletions tgui/packages/tgui/interfaces/AresInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const PAGES = {
'read_deleted': () => ReadingTalks,
'security': () => Security,
'requisitions': () => Requisitions,
'antiair': () => AntiAir,
'emergency': () => Emergency,
};

Expand Down Expand Up @@ -161,18 +160,6 @@ const MainMenu = (props, context) => {
<Stack.Item grow>
<h3>Access Level 1</h3>
</Stack.Item>
<Stack.Item>
<Button
content="Anti Air Targetting"
tooltip="Review changes to the Anti-Air targetting."
icon="crosshairs"
ml="auto"
px="2rem"
width="25vw"
bold
onClick={() => act('page_antiair')}
/>
</Stack.Item>
<Stack.Item>
<Button
content="Bioscan Logs"
Expand Down Expand Up @@ -1185,87 +1172,6 @@ const Requisitions = (props, context) => {
);
};

const AntiAir = (props, context) => {
const { data, act } = useBackend(context);
const { logged_in, access_text, last_page, current_menu, aa_adjustments } =
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">AntiAir Control Logs</h1>
{!!aa_adjustments.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 grow bold>
User
</Flex.Item>
<Flex.Item bold width="30rem" textAlign="center">
Adjustment
</Flex.Item>
</Flex>
)}
{aa_adjustments.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 grow italic>
{record.user}
</Flex.Item>
<Flex.Item width="30rem" ml="1rem" shrink="0" textAlign="center">
{record.details}
</Flex.Item>
</Flex>
);
})}
</Section>
</>
);
};

const Security = (props, context) => {
const { data, act } = useBackend(context);
const {
Expand Down Expand Up @@ -1349,7 +1255,7 @@ const Security = (props, context) => {
<Button.Confirm
icon="trash"
tooltip="Delete Record"
disabled={access_level < 7}
disabled={access_level < 5}
onClick={() => act('delete_record', { record: record.ref })}
/>
</Flex.Item>
Expand Down

0 comments on commit 9eafb52

Please sign in to comment.