From 79175a36590da840f3406b8e684e7467d2845dae Mon Sep 17 00:00:00 2001 From: forest2001 Date: Tue, 9 Apr 2024 11:53:56 +0100 Subject: [PATCH 1/2] ID Card mod log print --- code/__HELPERS/logging.dm | 6 +-- code/modules/cm_marines/marines_consoles.dm | 44 ++++++++++----------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/code/__HELPERS/logging.dm b/code/__HELPERS/logging.dm index 59e4c7710992..1e72f51a8d60 100644 --- a/code/__HELPERS/logging.dm +++ b/code/__HELPERS/logging.dm @@ -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) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 7e57430f081a..fe8ac1641da8 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -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 = {"

Access Report

Prepared By: [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]
For: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]

- Faction: [faction]
+ Faction: [target_id_card.faction ? target_id_card.faction : "N/A"]
Assignment: [target_id_card.assignment]
Account Number: #[target_id_card.associated_account_number]
Blood Type: [target_id_card.blood_type]

@@ -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)]
" + contents += "
Modification Log:
" + for(var/change in target_id_card.modification_log) + contents += " [change]
" var/obj/item/paper/P = new /obj/item/paper(src.loc) P.name = "Access Report" @@ -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, " [key_name_admin(usr)] changed the registered name of the ID to '[target_id_card.registered_name]'. ") + log_idmod(target_id_card, " [user.real_name] changed the registered name of the ID to '[target_id_card.registered_name]'. ", key_name_admin(user)) if(target_id_card.assignment != origin_assignment) - log_idmod(target_id_card, " [key_name_admin(usr)] changed the assignment of the ID to the custom position '[target_id_card.assignment]'. ") + log_idmod(target_id_card, " [user.real_name] changed the assignment of the ID to the custom position '[target_id_card.assignment]'. ", key_name_admin(user)) if(ishuman(user)) target_id_card.forceMove(user.loc) if(!user.get_active_hand()) @@ -170,8 +166,8 @@ target_id_card.assignment = "Terminated" target_id_card.access = list() - log_idmod(target_id_card, " [key_name_admin(usr)] terminated the ID. ") - message_admins("[key_name_admin(usr)] terminated the ID of [target_id_card.registered_name].") + log_idmod(target_id_card, " [user.real_name] terminated the ID. ", 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) @@ -221,19 +217,19 @@ 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, " [key_name_admin(usr)] revoked [access_type] IFF. ") + log_idmod(target_id_card, " [user.real_name] revoked [access_type] IFF. ", key_name_admin(user)) else target_id_card.faction_group |= params["access_target"] - log_idmod(target_id_card, " [key_name_admin(usr)] granted [access_type] IFF. ") + log_idmod(target_id_card, " [user.real_name] granted [access_type] IFF. ", 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, " [key_name_admin(usr)] revoked access '[access_type]'. ") + log_idmod(target_id_card, " [user.real_name] revoked access '[get_access_desc(access_type)]'. ", key_name_admin(user)) else target_id_card.access |= access_type - log_idmod(target_id_card, " [key_name_admin(usr)] granted access '[access_type]'. ") + log_idmod(target_id_card, " [user.real_name] granted access '[get_access_desc(access_type)]'. ", key_name_admin(user)) return TRUE if("PRG_grantall") if(!authenticated || !target_id_card) @@ -241,7 +237,7 @@ 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, " [key_name_admin(usr)] granted the ID all access and USCM IFF. ") + log_idmod(target_id_card, " [user.real_name] granted the ID all access and USCM IFF. ", key_name_admin(user)) return TRUE if("PRG_denyall") if(!authenticated || !target_id_card) @@ -250,7 +246,7 @@ var/list/access = target_id_card.access access.Cut() target_id_card.faction_group -= factions - log_idmod(target_id_card, " [key_name_admin(usr)] removed all accesses and USCM IFF. ") + log_idmod(target_id_card, " [user.real_name] removed all accesses and USCM IFF. ", key_name_admin(user)) return TRUE if("PRG_grantregion") if(!authenticated || !target_id_card) @@ -258,14 +254,14 @@ if(params["region"] == "Faction (IFF system)") target_id_card.faction_group |= factions - log_idmod(target_id_card, " [key_name_admin(usr)] granted USCM IFF. ") + log_idmod(target_id_card, " [user.real_name] granted USCM IFF. ", 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, " [key_name_admin(usr)] granted all [additions] accesses. ") + log_idmod(target_id_card, " [user.real_name] granted all [additions] accesses. ", key_name_admin(user)) return TRUE if("PRG_denyregion") if(!authenticated || !target_id_card) @@ -273,14 +269,14 @@ if(params["region"] == "Faction (IFF system)") target_id_card.faction_group -= factions - log_idmod(target_id_card, " [key_name_admin(usr)] revoked USCM IFF. ") + log_idmod(target_id_card, " [user.real_name] revoked USCM IFF. ", 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, " [key_name_admin(usr)] revoked all [additions] accesses. ") + log_idmod(target_id_card, " [user.real_name] revoked all [additions] accesses. ", key_name_admin(user)) return TRUE if("PRG_account") if(!authenticated || !target_id_card) @@ -288,7 +284,7 @@ var/account = text2num(params["account"]) target_id_card.associated_account_number = account - log_idmod(target_id_card, " [key_name_admin(usr)] changed the account number to '[account]'. ") + log_idmod(target_id_card, " [user.real_name] changed the account number to '[account]'. ", key_name_admin(user)) return TRUE /obj/structure/machinery/computer/card/ui_static_data(mob/user) From 7a925af6b91839e18aff0863346236157aa24d11 Mon Sep 17 00:00:00 2001 From: forest2001 Date: Sat, 20 Apr 2024 13:15:02 +0100 Subject: [PATCH 2/2] changes --- code/modules/cm_marines/marines_consoles.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 48efd1221174..e02bb930d416 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -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)