Skip to content

Commit

Permalink
APOLLO Ticket Ids and link announcement
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben10083 committed Jun 29, 2023
1 parent ae54d1f commit 3448403
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
18 changes: 16 additions & 2 deletions code/game/machinery/ARES/ARES_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ GLOBAL_DATUM_INIT(ares_link, /datum/ares_link, new)
if(!istype(maint_ticket))
continue
var/list/current_maint = list()
current_maint["id"] = maint_ticket.ticket_id
current_maint["time"] = maint_ticket.ticket_time
current_maint["title"] = maint_ticket.ticket_name
current_maint["details"] = maint_ticket.ticket_details
Expand All @@ -703,6 +704,7 @@ GLOBAL_DATUM_INIT(ares_link, /datum/ares_link, new)
var/list/logged_access = list()
for(var/datum/ares_ticket/access_ticket/access_ticket as anything in link.tickets_access)
var/list/current_ticket = list()
current_ticket["id"] = access_ticket.ticket_id
current_ticket["time"] = access_ticket.ticket_time
current_ticket["title"] = access_ticket.ticket_name
current_ticket["details"] = access_ticket.ticket_details
Expand Down Expand Up @@ -805,9 +807,21 @@ GLOBAL_DATUM_INIT(ares_link, /datum/ares_link, new)
var/confirm = tgui_alert(usr, "Please confirm the submission of your maintenance report. \n\n [name] \n\n [details] \n\n Is this correct?", "Confirmation", list("Yes", "No"))
if(confirm == "Yes")
if(link)
var/datum/ares_ticket/maintenance/maint_ticket = new(last_login, name, details)
//make a unique ID for the ticket
//will be 4 digit ticket with first digit being ARES access level
//loop that stays until unique ticket made
var/unique_id = ""
var/uniqueness = FALSE
while(!uniqueness)
unique_id = "#[authentication][rand(9)][rand(9)][rand(9)]"
uniqueness = TRUE
//verify that no ticket IDs are the same, if they are, we run this loop again
for(var/datum/ares_ticket/maintenance/ticket in link.tickets_maintenance)
if(ticket.ticket_id == unique_id)
uniqueness = FALSE
var/datum/ares_ticket/maintenance/maint_ticket = new(last_login, unique_id, name, details)
link.tickets_maintenance += maint_ticket
log_game("ARES: Maintenance Ticket created by [key_name(operator)] as [last_login] with Header '[name]' and Details of '[details]'.")
log_game("ARES: Maintenance Ticket [unique_id] created by [key_name(operator)] as [last_login] with Header '[name]' and Details of '[details]'.")
return TRUE
return FALSE

Expand Down
9 changes: 8 additions & 1 deletion code/game/machinery/ARES/ARES_records.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,25 @@
var/ticket_assignee
/// World time in text format.
var/ticket_time
/// Unique ID of ticket for easy reference
var/ticket_id
/// Who submitted the ticket. Derived from last login.
var/ticket_submitter
/// The name of the ticket.
var/ticket_name
/// The content of the ticket, usually an explanation of what it is for.
var/ticket_details

/datum/ares_ticket/New(user, name, details)
/datum/ares_ticket/New(user, id, name, details)
ticket_time = worldtime2text()
ticket_id = id
ticket_submitter = user
ticket_details = details
ticket_name = name
/// broadcast ticket
var/datum/language/apollo/apollo = GLOB.all_languages[LANGUAGE_APOLLO]
for(var/mob/living/silicon/decoy/ship_ai/AI in ai_mob_list)
apollo.broadcast(AI, "[ticket_type] [ticket_id] '[ticket_name]' has been created. Consult APOLLO for further details.")

/datum/ares_ticket/maintenance
ticket_type = ARES_RECORD_MAINTENANCE
Expand Down
14 changes: 10 additions & 4 deletions tgui/packages/tgui/interfaces/WorkingJoe.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,15 @@ const MaintReports = (props, context) => {
align="center"
fontSize="1.25rem">
<Flex.Item bold width="6rem" shrink="0" mr="1rem">
Id
</Flex.Item>
<Flex.Item bold width="9rem" shrink="0" mr="1rem">
Time
</Flex.Item>
<Flex.Item width="15rem" grow bold>
<Flex.Item width="12rem" grow bold>
Title
</Flex.Item>
<Flex.Item width="35rem" textAlign="left">
<Flex.Item width="30rem" textAlign="left">
Details
</Flex.Item>
</Flex>
Expand All @@ -437,12 +440,15 @@ const MaintReports = (props, context) => {
return (
<Flex key={i} className="candystripe" p=".75rem" align="center">
<Flex.Item bold width="6rem" shrink="0" mr="1rem">
{ticket.id}
</Flex.Item>
<Flex.Item bold width="9rem" shrink="0" mr="1rem">
{ticket.time}
</Flex.Item>
<Flex.Item width="15rem" grow italic>
<Flex.Item width="12rem" grow italic>
{ticket.title}
</Flex.Item>
<Flex.Item width="35rem" ml="1rem" shrink="0" textAlign="left">
<Flex.Item width="30rem" ml="1rem" shrink="0" textAlign="left">
{ticket.details}
</Flex.Item>
</Flex>
Expand Down

0 comments on commit 3448403

Please sign in to comment.