Skip to content

Commit

Permalink
Project ARES: Datacore (#4437)
Browse files Browse the repository at this point in the history
Moves most information from ARES Interface and APOLLO Interface to the
ARES Datacore. Also reorganises the files so the two interfaces are in
separate files with all their UI data.
# About the pull request
Centralises most of the information used by the ARES Interface and
APOLLO Maintenance Console(s) into a datacore.
Also reorganises the files so the two consoles are in their own
individual files with all their UI data rather than having them separate
from the UI data which was making it difficult to navigate.

Also adds checks to everywhere I could find missing them for logging to
the datacore.

# Explain why it's good for the game
This will help massively for future compatability and updates.

# 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:
code: Moved most data storage from ARES Interface and APOLLO consoles to
a new ARES datacore datum.
code: Moved the two consoles to separate files for easier navigation,
and moved their respective UI data to the files.
code: Ares logging procs are now global procs with integrated can_log
checks, rather than requiring definition of ares_link for every use.
add: Added ares_can_log checks to all the places I could find missing
them.
fix: Fixed missing rejection button for access tickets.
del: Removed claim ticket button from Access Tickets.
/:cl:
  • Loading branch information
realforest2001 authored Oct 17, 2023
1 parent 2d5834c commit c46e9d2
Show file tree
Hide file tree
Showing 23 changed files with 1,080 additions and 1,085 deletions.
40 changes: 16 additions & 24 deletions code/defines/procs/announcement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@
if((H.faction != faction_to_display && !add_PMCs) || (H.faction != faction_to_display && add_PMCs && !(H.faction in FACTION_LIST_WY)) && !(faction_to_display in H.faction_group)) //faction checks
targets.Remove(H)

var/datum/ares_link/link = GLOB.ares_link
if(ares_can_log())
switch(logging)
if(ARES_LOG_MAIN)
link.log_ares_announcement(title, message)
if(ARES_LOG_SECURITY)
link.log_ares_security(title, message)
switch(logging)
if(ARES_LOG_MAIN)
log_ares_announcement(title, message)
if(ARES_LOG_SECURITY)
log_ares_security(title, message)

else if(faction_to_display == "Everyone (-Yautja)")
for(var/mob/M in targets)
Expand Down Expand Up @@ -98,13 +96,11 @@
for(var/mob/living/silicon/decoy/ship_ai/AI in ai_mob_list)
INVOKE_ASYNC(AI, TYPE_PROC_REF(/mob/living/silicon/decoy/ship_ai, say), message)

var/datum/ares_link/link = GLOB.ares_link
if(ares_can_log())
switch(logging)
if(ARES_LOG_MAIN)
link.log_ares_announcement("[MAIN_AI_SYSTEM] Comms Update", message)
if(ARES_LOG_SECURITY)
link.log_ares_security("[MAIN_AI_SYSTEM] Security Update", message)
switch(logging)
if(ARES_LOG_MAIN)
log_ares_announcement("[MAIN_AI_SYSTEM] Comms Update", message)
if(ARES_LOG_SECURITY)
log_ares_security("[MAIN_AI_SYSTEM] Security Update", message)

/proc/ai_silent_announcement(message, channel_prefix, bypass_cooldown = FALSE)
if(!message)
Expand Down Expand Up @@ -135,13 +131,11 @@

if(!isnull(signature))
message += "<br><br><i> Signed by, <br> [signature]</i>"
var/datum/ares_link/link = GLOB.ares_link
if(ares_can_log())
switch(ares_logging)
if(ARES_LOG_MAIN)
link.log_ares_announcement(title, message)
if(ARES_LOG_SECURITY)
link.log_ares_security(title, message)
switch(ares_logging)
if(ARES_LOG_MAIN)
log_ares_announcement(title, message)
if(ARES_LOG_SECURITY)
log_ares_security(title, message)

announcement_helper(message, title, targets, sound_to_play)

Expand All @@ -154,9 +148,7 @@
if(!ishuman(T) || isyautja(T) || !is_mainship_level(T.z))
targets.Remove(T)

var/datum/ares_link/link = GLOB.ares_link
if(ares_can_log())
link.log_ares_announcement("[title] Shipwide Update", message)
log_ares_announcement("[title] Shipwide Update", message)

announcement_helper(message, title, targets, sound_to_play)

Expand Down
10 changes: 3 additions & 7 deletions code/game/bioscans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,21 @@ GLOBAL_DATUM_INIT(bioscan_data, /datum/bioscan_data, new)
to_chat(ghost, ghost_scan)


/// This will do something after Project ARES.
/datum/bioscan_data/proc/ares_can_bioscan()
var/datum/ares_link/link = GLOB.ares_link
if(!istype(link))
return FALSE
if(link.p_bioscan && !link.p_bioscan.inoperable())
if(link.processor_bioscan && !link.processor_bioscan.inoperable())
return TRUE
return FALSE

/// The announcement to all Humans. Slightly off for the planet and elsewhere, accurate for the ship.
/datum/bioscan_data/proc/ares_bioscan(forced = FALSE, variance = 2)
var/datum/ares_link/link = GLOB.ares_link
if(!forced && !ares_can_bioscan())
message_admins("An ARES Bioscan has failed.")
var/name = "[MAIN_AI_SYSTEM] Bioscan Status"
var/input = "Bioscan failed. \n\nInvestigation into Bioscan subsystem recommended."
if(ares_can_log())
link.log_ares_bioscan(name, input)
log_ares_bioscan(name, input)
if(ares_can_interface())
marine_announcement(input, name, 'sound/misc/interference.ogg', logging = ARES_LOG_NONE)
return
Expand All @@ -137,8 +134,7 @@ GLOBAL_DATUM_INIT(bioscan_data, /datum/bioscan_data, new)

log_game("BIOSCAN: ARES bioscan completed. [input]")

if(forced || ares_can_log())
link.log_ares_bioscan(name, input) //if interface is down, bioscan still logged, just have to go read it.
log_ares_bioscan(name, input) //if interface is down, bioscan still logged, just have to go read it.
if(forced || ares_can_interface())
marine_announcement(input, name, 'sound/AI/bioscan.ogg', logging = ARES_LOG_NONE)
else
Expand Down
154 changes: 19 additions & 135 deletions code/game/machinery/ARES/ARES.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
unslashable = TRUE
unacidable = TRUE

var/link_id = MAIN_SHIP_DEFAULT_NAME
var/datum/ares_link/link

/obj/structure/machinery/ares/ex_act(severity)
Expand Down Expand Up @@ -40,14 +39,12 @@
log_debug("Error: link_systems called without a link datum")
if(link && !override)
return FALSE
if(new_link.link_id == link_id)
if(new_link)
link = new_link
log_debug("[name] linked to Ares Link [link_id]")
new_link.linked_systems += src
return TRUE

/obj/structure/machinery/ares/proc/delink()
log_debug("[name] delinked from Ares Link [link.link_id]")
link.linked_systems -= src
link = null

Expand All @@ -63,11 +60,11 @@

/obj/structure/machinery/ares/processor/apollo/link_systems(datum/ares_link/new_link = GLOB.ares_link, override)
..()
new_link.p_apollo = src
new_link.processor_apollo = src

/obj/structure/machinery/ares/processor/apollo/delink()
if(link && link.p_apollo == src)
link.p_apollo = null
if(link && link.processor_apollo == src)
link.processor_apollo = null
..()

/obj/structure/machinery/ares/processor/interface
Expand All @@ -77,11 +74,11 @@

/obj/structure/machinery/ares/processor/interface/link_systems(datum/ares_link/new_link = GLOB.ares_link, override)
..()
new_link.p_interface = src
new_link.processor_interface = src

/obj/structure/machinery/ares/processor/interface/delink()
if(link && link.p_interface == src)
link.p_interface = null
if(link && link.processor_interface == src)
link.processor_interface = null
..()

/obj/structure/machinery/ares/processor/bioscan
Expand All @@ -91,11 +88,11 @@

/obj/structure/machinery/ares/processor/bioscan/link_systems(datum/ares_link/new_link = GLOB.ares_link, override)
..()
new_link.p_bioscan = src
new_link.processor_bioscan = src

/obj/structure/machinery/ares/processor/bioscan/delink()
if(link && link.p_bioscan == src)
link.p_bioscan = null
if(link && link.processor_bioscan == src)
link.processor_bioscan = null
..()

/// Central Core
Expand All @@ -104,130 +101,17 @@
desc = "This is ARES' central processor. Made of a casing designed to withstand nuclear blasts, the CPU also contains ARES' blackbox recorder."
icon_state = "CPU"

/obj/structure/machinery/ares/cpu/link_systems(datum/ares_link/new_link = GLOB.ares_link, override)
..()
new_link.central_processor = src

/obj/structure/machinery/ares/cpu/delink()
if(link && link.central_processor == src)
link.central_processor = null
..()

/// Memory Substrate,
/obj/structure/machinery/ares/substrate
name = "ARES Substrate"
desc = "The memory substrate of ARES, containing complex protocols and information. Limited capabilities can operate on substrate alone, without the main ARES Unit operational."
icon_state = "substrate"

// #################### ARES Interface Console #####################
/obj/structure/machinery/computer/ares_console
name = "ARES Interface"
desc = "A console built to interface with ARES, allowing for 1:1 communication."
icon = 'icons/obj/structures/machinery/ares.dmi'
icon_state = "console"
exproof = TRUE

var/current_menu = "login"
var/last_menu = ""

var/authentication = ARES_ACCESS_BASIC

/// The last person to login.
var/last_login
/// The person pretending to be last_login
var/sudo_holder
/// A record of who logged in and when.
var/list/access_list = list()

/// The ID used to link all devices.
var/link_id = MAIN_SHIP_DEFAULT_NAME
var/datum/ares_link/link

/// The current deleted chat log of 1:1 conversations being read.
var/list/deleted_1to1 = list()

/// Holds all (/datum/ares_record/announcement)s
var/list/records_announcement = list()
/// Holds all (/datum/ares_record/bioscan)s
var/list/records_bioscan = list()
/// Holds all (/datum/ares_record/bombardment)s
var/list/records_bombardment = list()
/// Holds all (/datum/ares_record/deletion)s
var/list/records_deletion = list()
/// Holds all (/datum/ares_record/talk_log)s
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 (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


COOLDOWN_DECLARE(ares_distress_cooldown)
COOLDOWN_DECLARE(ares_nuclear_cooldown)
COOLDOWN_DECLARE(ares_quarters_cooldown)

/obj/structure/machinery/computer/ares_console/proc/link_systems(datum/ares_link/new_link = GLOB.ares_link, override)
if(link && !override)
return FALSE
if(new_link.link_id == link_id)
new_link.interface = src
link = new_link
log_debug("[name] linked to Ares Link [link_id]")
new_link.linked_systems += src
return TRUE

/obj/structure/machinery/computer/ares_console/Initialize(mapload, ...)
link_systems(override = FALSE)
. = ..()

/obj/structure/machinery/computer/ares_console/proc/delink()
if(link && link.interface == src)
link.interface = null
link.linked_systems -= src
link = null

/obj/structure/machinery/computer/ares_console/Destroy()
delink()
return ..()

// #################### Working Joe Ticket Console #####################
/obj/structure/machinery/computer/working_joe
name = "APOLLO Maintenance Controller"
desc = "A console built to facilitate Working Joes and their operation, allowing for simple allocation of resources."
icon = 'icons/obj/structures/machinery/ares.dmi'
icon_state = "console"
exproof = TRUE

/// The ID used to link all devices.
var/link_id = MAIN_SHIP_DEFAULT_NAME
var/datum/ares_link/link
var/obj/structure/machinery/ares/processor/interface/processor

var/current_menu = "login"
var/last_menu = ""

var/authentication = ARES_ACCESS_BASIC
/// The last person to login.
var/last_login
/// A record of who logged in and when.
var/list/login_list = list()


/obj/structure/machinery/computer/working_joe/proc/link_systems(datum/ares_link/new_link = GLOB.ares_link, override)
if(link && !override)
return FALSE
if(new_link.link_id == link_id)
new_link.ticket_computers += src
link = new_link
log_debug("[name] linked to Ares Link [link_id]")
new_link.linked_systems += src
return TRUE

/obj/structure/machinery/computer/working_joe/Initialize(mapload, ...)
link_systems(override = FALSE)
. = ..()

/obj/structure/machinery/computer/working_joe/proc/delink()
if(link)
link.ticket_computers -= src
link.linked_systems -= src
link = null

/obj/structure/machinery/computer/working_joe/Destroy()
delink()
return ..()
Loading

0 comments on commit c46e9d2

Please sign in to comment.