mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-10 15:45:05 +01:00
[MIRROR] Minor improvements and fixes to the access report paper from the Plexagon computer program [MDB IGNORE] (#10044)
* Minor improvements and fixes to the access report paper from the Plexagon computer program (#63262) * Minor improvements and fixes to the access report paper from the Plexagon computer program Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
/// If TRUE, this program is authenticated with limited departmental access.
|
||||
var/minor = FALSE
|
||||
/// The name/assignment combo of the ID card used to authenticate.
|
||||
var/authenticated_card
|
||||
/// The name of the registered user, related to `authenticated_card`.
|
||||
var/authenticated_user
|
||||
/// The regions this program has access to based on the authenticated ID.
|
||||
var/list/region_access = list()
|
||||
@@ -46,7 +48,8 @@
|
||||
// If the program isn't locked to a specific department or is_centcom and we have ACCESS_CHANGE_IDS in our auth card, we're not minor.
|
||||
if((!target_dept || is_centcom) && (ACCESS_CHANGE_IDS in id_card.access))
|
||||
minor = FALSE
|
||||
authenticated_user = "[id_card.name]"
|
||||
authenticated_card = "[id_card.name]"
|
||||
authenticated_user = id_card.registered_name ? id_card.registered_name : "Unknown"
|
||||
job_templates = is_centcom ? SSid_access.centcom_job_templates.Copy() : SSid_access.station_job_templates.Copy()
|
||||
valid_access = is_centcom ? SSid_access.get_region_access_list(list(REGION_CENTCOM)) : SSid_access.get_region_access_list(list(REGION_ALL_STATION))
|
||||
update_static_data(user)
|
||||
@@ -64,7 +67,7 @@
|
||||
if(length(region_access))
|
||||
minor = TRUE
|
||||
valid_access |= SSid_access.get_region_access_list(region_access)
|
||||
authenticated_user = "[id_card.name] \[LIMITED ACCESS\]"
|
||||
authenticated_card = "[id_card.name] \[LIMITED ACCESS\]"
|
||||
update_static_data(user)
|
||||
return TRUE
|
||||
|
||||
@@ -100,6 +103,7 @@
|
||||
return TRUE
|
||||
// Log out.
|
||||
if("PRG_logout")
|
||||
authenticated_card = null
|
||||
authenticated_user = null
|
||||
playsound(computer, 'sound/machines/terminal_off.ogg', 50, FALSE)
|
||||
return TRUE
|
||||
@@ -107,10 +111,10 @@
|
||||
if("PRG_print")
|
||||
if(!computer || !printer)
|
||||
return TRUE
|
||||
if(!authenticated_user)
|
||||
if(!authenticated_card)
|
||||
return TRUE
|
||||
var/contents = {"<h4>Access Report</h4>
|
||||
<u>Prepared By:</u> [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]<br>
|
||||
<u>Prepared By:</u> [authenticated_user]<br>
|
||||
<u>For:</u> [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]<br>
|
||||
<hr>
|
||||
<u>Assignment:</u> [target_id_card.assignment]<br>
|
||||
@@ -122,7 +126,7 @@
|
||||
if(A in known_access_rights)
|
||||
contents += " [SSid_access.get_access_desc(A)]"
|
||||
|
||||
if(!printer.print_text(contents,"access report"))
|
||||
if(!printer.print_text(contents,"access report - [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]"))
|
||||
to_chat(usr, span_notice("Hardware error: Printer was unable to print the file. It may be out of paper."))
|
||||
return TRUE
|
||||
else
|
||||
@@ -153,7 +157,7 @@
|
||||
return TRUE
|
||||
// Used to fire someone. Wipes all access from their card and modifies their assignment.
|
||||
if("PRG_terminate")
|
||||
if(!computer || !authenticated_user)
|
||||
if(!computer || !authenticated_card)
|
||||
return TRUE
|
||||
if(minor)
|
||||
if(!(target_id_card.trim?.type in job_templates))
|
||||
@@ -168,7 +172,7 @@
|
||||
return TRUE
|
||||
// Change ID card assigned name.
|
||||
if("PRG_edit")
|
||||
if(!computer || !authenticated_user || !target_id_card)
|
||||
if(!computer || !authenticated_card || !target_id_card)
|
||||
return TRUE
|
||||
|
||||
var/old_name = target_id_card.registered_name
|
||||
@@ -202,7 +206,7 @@
|
||||
return TRUE
|
||||
// Change age
|
||||
if("PRG_age")
|
||||
if(!computer || !authenticated_user || !target_id_card)
|
||||
if(!computer || !authenticated_card || !target_id_card)
|
||||
return TRUE
|
||||
|
||||
var/new_age = params["id_age"]
|
||||
@@ -215,7 +219,7 @@
|
||||
return TRUE
|
||||
// Change assignment
|
||||
if("PRG_assign")
|
||||
if(!computer || !authenticated_user || !target_id_card)
|
||||
if(!computer || !authenticated_card || !target_id_card)
|
||||
return TRUE
|
||||
var/new_asignment = sanitize(params["assignment"])
|
||||
target_id_card.assignment = new_asignment
|
||||
@@ -224,7 +228,7 @@
|
||||
return TRUE
|
||||
// Add/remove access.
|
||||
if("PRG_access")
|
||||
if(!computer || !authenticated_user || !target_id_card)
|
||||
if(!computer || !authenticated_card || !target_id_card)
|
||||
return TRUE
|
||||
playsound(computer, "terminal_type", 50, FALSE)
|
||||
var/access_type = params["access_target"]
|
||||
@@ -249,7 +253,7 @@
|
||||
return TRUE
|
||||
// Apply template to ID card.
|
||||
if("PRG_template")
|
||||
if(!computer || !authenticated_user || !target_id_card)
|
||||
if(!computer || !authenticated_card || !target_id_card)
|
||||
return TRUE
|
||||
|
||||
playsound(computer, "terminal_type", 50, FALSE)
|
||||
@@ -323,7 +327,7 @@
|
||||
var/obj/item/card/id/auth_card = card_slot.stored_card
|
||||
data["authIDName"] = auth_card ? auth_card.name : "-----"
|
||||
|
||||
data["authenticatedUser"] = authenticated_user
|
||||
data["authenticatedUser"] = authenticated_card
|
||||
|
||||
var/obj/item/card/id/id_card = card_slot2.stored_card
|
||||
data["has_id"] = !!id_card
|
||||
|
||||
Reference in New Issue
Block a user