Skip to content

Commit

Permalink
Added ID Modification Log to the Access Report Print (#6124)
Browse files Browse the repository at this point in the history
# About the pull request

Allows MPs (or others) to read who made what changes to an ID card by
plugging the card into an ID Computer and hitting the print button.
This button previously printed a list of all the accesses on the ID
Card, and will still do this at the same time.

# Explain why it's good for the game

It can be incredibly frustrating to figure out how someone can suddenly
open a door without permission and is essentially untraceable at the
moment without admin help.


# Testing Photographs and Procedure

![image](https://github.com/cmss13-devs/cmss13/assets/41653574/96cff422-197e-4016-94be-087e802cd676)


# Changelog
:cl:
add: Added ID Modification Log to the Access Report printout from an ID
Console.
/:cl:
  • Loading branch information
realforest2001 committed Apr 21, 2024
1 parent 1c14a87 commit 45489e6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
6 changes: 3 additions & 3 deletions code/__HELPERS/logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ GLOBAL_VAR_INIT(log_end, world.system_type == UNIX ? ascii2text(13) : "")
GLOB.STUI.admin.Add("\[[time]]OVERWATCH: [text]")
GLOB.STUI.processing |= STUI_LOG_ADMIN

/proc/log_idmod(obj/item/card/id/target_id, msg)
/proc/log_idmod(obj/item/card/id/target_id, msg, changer)
var/time = time_stamp()
if (CONFIG_GET(flag/log_idmod))
WRITE_LOG(GLOB.world_game_log, "ID MOD: [msg]")
LOG_REDIS("idmod", "\[[time]\] [msg]")
WRITE_LOG(GLOB.world_game_log, "ID MOD: ([changer]) [msg]")
LOG_REDIS("idmod", "\[[time]\] ([changer]) [msg]")
target_id.modification_log += "\[[time]]: [msg]"

/proc/log_vote(text)
Expand Down
48 changes: 22 additions & 26 deletions code/modules/cm_marines/marines_consoles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
ui = new(user, src, "CardMod", name)
ui.open()

/obj/structure/machinery/computer/card/ui_act(action, params)
/obj/structure/machinery/computer/card/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return

var/mob/user = usr
var/mob/user = ui.user

playsound(src, pick('sound/machines/computer_typing4.ogg', 'sound/machines/computer_typing5.ogg', 'sound/machines/computer_typing6.ogg'), 5, 1)
switch(action)
Expand Down Expand Up @@ -91,18 +91,11 @@
printing = TRUE
playsound(src.loc, 'sound/machines/fax.ogg', 15, 1)
sleep(40)
var/faction = "N/A"
if(target_id_card.faction_group && islist(target_id_card.faction_group))
faction = jointext(target_id_card.faction_group, ", ")
if(isnull(target_id_card.faction_group))
target_id_card.faction_group = list()
else
faction = target_id_card.faction_group
var/contents = {"<center><h4>Access Report</h4></center>
<u>Prepared By:</u> [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]<br>
<u>For:</u> [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]<br>
<hr>
<u>Faction:</u> [faction]<br>
<u>Faction:</u> [target_id_card.faction ? target_id_card.faction : "N/A"]<br>
<u>Assignment:</u> [target_id_card.assignment]<br>
<u>Account Number:</u> #[target_id_card.associated_account_number]<br>
<u>Blood Type:</u> [target_id_card.blood_type]<br><br>
Expand All @@ -112,7 +105,10 @@
var/known_access_rights = get_access(ACCESS_LIST_MARINE_ALL)
for(var/A in target_id_card.access)
if(A in known_access_rights)
contents += " [get_access_desc(A)]"
contents += " [get_access_desc(A)]<br>"
contents += "<br><u>Modification Log:</u><br>"
for(var/change in target_id_card.modification_log)
contents += " [change]<br>"

var/obj/item/paper/P = new /obj/item/paper(src.loc)
P.name = "Access Report"
Expand All @@ -139,9 +135,9 @@
GLOB.data_core.manifest_modify(target_id_card.registered_name, target_id_card.registered_ref, target_id_card.assignment, target_id_card.rank)
target_id_card.name = text("[target_id_card.registered_name]'s ID Card ([target_id_card.assignment])")
if(target_id_card.registered_name != origin_name)
log_idmod(target_id_card, "<font color='orange'> [key_name_admin(usr)] changed the registered name of the ID to '[target_id_card.registered_name]'. </font>")
log_idmod(target_id_card, "<font color='orange'> [user.real_name] changed the registered name of the ID to '[target_id_card.registered_name]'. </font>", key_name_admin(user))
if(target_id_card.assignment != origin_assignment)
log_idmod(target_id_card, "<font color='orange'> [key_name_admin(usr)] changed the assignment of the ID to the custom position '[target_id_card.assignment]'. </font>")
log_idmod(target_id_card, "<font color='orange'> [user.real_name] changed the assignment of the ID to the custom position '[target_id_card.assignment]'. </font>", key_name_admin(user))
if(ishuman(user))
target_id_card.forceMove(user.loc)
if(!user.get_active_hand())
Expand Down Expand Up @@ -170,8 +166,8 @@

target_id_card.assignment = "Terminated"
target_id_card.access = list()
log_idmod(target_id_card, "<font color='red'> [key_name_admin(usr)] terminated the ID. </font>")
message_admins("[key_name_admin(usr)] terminated the ID of [target_id_card.registered_name].")
log_idmod(target_id_card, "<font color='red'> [user.real_name] terminated the ID. </font>", key_name_admin(user))
message_admins("[user.real_name] terminated the ID of [target_id_card.registered_name].", key_name_admin(user))
return TRUE
if("PRG_edit")
if(!authenticated || !target_id_card)
Expand Down Expand Up @@ -221,27 +217,27 @@
target_id_card.faction_group = list()
if(params["access_target"] in target_id_card.faction_group)
target_id_card.faction_group -= params["access_target"]
log_idmod(target_id_card, "<font color='red'> [key_name_admin(usr)] revoked [access_type] IFF. </font>")
log_idmod(target_id_card, "<font color='red'> [user.real_name] revoked [access_type] IFF. </font>", key_name_admin(user))
else
target_id_card.faction_group |= params["access_target"]
log_idmod(target_id_card, "<font color='green'> [key_name_admin(usr)] granted [access_type] IFF. </font>")
log_idmod(target_id_card, "<font color='green'> [user.real_name] granted [access_type] IFF. </font>", key_name_admin(user))
return TRUE
access_type = text2num(params["access_target"])
if(access_type in (is_centcom ? get_access(ACCESS_LIST_WY_ALL) : get_access(ACCESS_LIST_MARINE_MAIN)))
if(access_type in target_id_card.access)
target_id_card.access -= access_type
log_idmod(target_id_card, "<font color='red'> [key_name_admin(usr)] revoked access '[access_type]'. </font>")
log_idmod(target_id_card, "<font color='red'> [user.real_name] revoked access '[get_access_desc(access_type)]'. </font>", key_name_admin(user))
else
target_id_card.access |= access_type
log_idmod(target_id_card, "<font color='green'> [key_name_admin(usr)] granted access '[access_type]'. </font>")
log_idmod(target_id_card, "<font color='green'> [user.real_name] granted access '[get_access_desc(access_type)]'. </font>", key_name_admin(user))
return TRUE
if("PRG_grantall")
if(!authenticated || !target_id_card)
return

target_id_card.access |= (is_centcom ? get_access(ACCESS_LIST_WY_ALL) : get_access(ACCESS_LIST_MARINE_MAIN))
target_id_card.faction_group |= factions
log_idmod(target_id_card, "<font color='green'> [key_name_admin(usr)] granted the ID all access and USCM IFF. </font>")
log_idmod(target_id_card, "<font color='green'> [user.real_name] granted the ID all access and USCM IFF. </font>", key_name_admin(user))
return TRUE
if("PRG_denyall")
if(!authenticated || !target_id_card)
Expand All @@ -250,45 +246,45 @@
var/list/access = target_id_card.access
access.Cut()
target_id_card.faction_group -= factions
log_idmod(target_id_card, "<font color='red'> [key_name_admin(usr)] removed all accesses and USCM IFF. </font>")
log_idmod(target_id_card, "<font color='red'> [user.real_name] removed all accesses and USCM IFF. </font>", key_name_admin(user))
return TRUE
if("PRG_grantregion")
if(!authenticated || !target_id_card)
return

if(params["region"] == "Faction (IFF system)")
target_id_card.faction_group |= factions
log_idmod(target_id_card, "<font color='green'> [key_name_admin(usr)] granted USCM IFF. </font>")
log_idmod(target_id_card, "<font color='green'> [user.real_name] granted USCM IFF. </font>", key_name_admin(user))
return TRUE
var/region = text2num(params["region"])
if(isnull(region))
return
target_id_card.access |= get_region_accesses(region)
var/additions = get_region_accesses_name(region)
log_idmod(target_id_card, "<font color='green'> [key_name_admin(usr)] granted all [additions] accesses. </font>")
log_idmod(target_id_card, "<font color='green'> [user.real_name] granted all [additions] accesses. </font>", key_name_admin(user))
return TRUE
if("PRG_denyregion")
if(!authenticated || !target_id_card)
return

if(params["region"] == "Faction (IFF system)")
target_id_card.faction_group -= factions
log_idmod(target_id_card, "<font color='red'> [key_name_admin(usr)] revoked USCM IFF. </font>")
log_idmod(target_id_card, "<font color='red'> [user.real_name] revoked USCM IFF. </font>", key_name_admin(user))
return TRUE
var/region = text2num(params["region"])
if(isnull(region))
return
target_id_card.access -= get_region_accesses(region)
var/additions = get_region_accesses_name(region)
log_idmod(target_id_card, "<font color='red'> [key_name_admin(usr)] revoked all [additions] accesses. </font>")
log_idmod(target_id_card, "<font color='red'> [user.real_name] revoked all [additions] accesses. </font>", key_name_admin(user))
return TRUE
if("PRG_account")
if(!authenticated || !target_id_card)
return

var/account = text2num(params["account"])
target_id_card.associated_account_number = account
log_idmod(target_id_card, "<font color='orange'> [key_name_admin(usr)] changed the account number to '[account]'. </font>")
log_idmod(target_id_card, "<font color='orange'> [user.real_name] changed the account number to '[account]'. </font>", key_name_admin(user))
return TRUE

/obj/structure/machinery/computer/card/ui_static_data(mob/user)
Expand Down

0 comments on commit 45489e6

Please sign in to comment.