From d6e84bc0e80f44e805a62e63c6c0b0d43e7581f0 Mon Sep 17 00:00:00 2001 From: kane-f <57303506+kane-f@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:11:45 +0100 Subject: [PATCH] Antag role purchase logs (#29850) * Beginning of this * And don't show it if there are none * Don't make this disappear * Better title * Don't want this repeated * Standardises * Tweaks * Testing antagHUD visibility * New window size Co-authored-by: kanef --- code/datums/mind.dm | 34 +++++++++++ .../mob/living/carbon/human/examine.dm | 58 ++++++++++--------- code/modules/mob/living/carbon/human/human.dm | 3 + 3 files changed, 69 insertions(+), 26 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 49aba3418a8..8c6785b0f82 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -189,11 +189,42 @@ out += R.GetMemory(src, TRUE)//allowing edits out += "
(add a new role)" + out += antag_roles.len ? "
(show purchase log)" : "" //Announce objectives

"} TODO: make sure that works usr << browse(out, "window=role_panel[src];size=700x500") +/datum/mind/proc/role_purchase_log() + if(!ticker || !ticker.mode) + alert("Ticker and Game Mode aren't initialized yet!", "Alert") + return + + var/out = {"Role purchase log[name][(current&&(current.real_name!=name))?" (as [current.real_name])":""]
Assigned job: [assigned_role]
"} + if(current.spell_list && current.spell_list.len) + out += "Known spells:
" + for(var/spell/S in current.spell_list) + var/icon/tempimage = icon('icons/mob/screen_spells.dmi', S.hud_state) + out += " [S.name]
" + for(var/role in antag_roles) + var/datum/role/R = antag_roles[role] + if(R.uplink_items_bought) + out += "Uplink items bought:
" + for(var/entry in R.uplink_items_bought) + out += "[entry]
" + if(istype(R,/datum/role/wizard)) + var/datum/role/wizard/W = R + if(W.artifacts_bought) + out += "Artifacts bought:
" + for(var/entry in W.artifacts_bought) + out += "[entry]
" + if(W.potions_bought) + out += "Potions bought:
" + for(var/entry in W.potions_bought) + out += "[entry]
" + + usr << browse(out, "window=role_purchase_log[src];size=300x500") + /datum/mind/proc/get_faction_list() var/list/all_factions = list() for(var/datum/faction/F in ticker.mode.factions) @@ -210,6 +241,9 @@ return all_factions /datum/mind/Topic(href, href_list) + if (href_list["show_purchases"]) + role_purchase_log() + if(!check_rights(R_ADMIN)) return if (href_list["job_edit"]) diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index fe6d43e9087..92e1989afea 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -421,36 +421,42 @@ if(butchery) msg += "[butchery]\n" - if(istype(user) && user.hasHUD(HUD_SECURITY)) - var/perpname = get_identification_name(get_face_name()) - var/criminal = "None" + if(istype(user)) + if(user.hasHUD(HUD_SECURITY)) + var/perpname = get_identification_name(get_face_name()) + var/criminal = "None" - var/datum/data/record/sec_record = data_core.find_security_record_by_name(perpname) - if(sec_record) - criminal = sec_record.fields["criminal"] + var/datum/data/record/sec_record = data_core.find_security_record_by_name(perpname) + if(sec_record) + criminal = sec_record.fields["criminal"] - msg += {"Criminal status: \[[criminal]\] -Security records: \[View\]\n"} + msg += {"Criminal status: \[[criminal]\] + Security records: \[View\]\n"} + if(!isjustobserver(user)) + msg += "\[Add comment\]\n" + msg += {"[wpermit(src) ? "Has weapon permit.\n" : ""]"} + + if(user.hasHUD(HUD_MEDICAL)) + var/perpname = get_identification_name(get_face_name()) + var/medical = "None" + + var/datum/data/record/gen_record = data_core.find_general_record_by_name(perpname) + if(gen_record) + medical = gen_record.fields["p_stat"] + + msg += {"Physical status: \[[medical]\]\n + Medical records: \[View\]\n"} + for (var/ID in virus2) + if (ID in virusDB) + var/datum/data/record/v = virusDB[ID] + msg += "
[v.fields["name"]][v.fields["nickname"] ? " \"[v.fields["nickname"]]\"" : ""] detected in subject.\n" if(!isjustobserver(user)) - msg += "\[Add comment\]\n" - msg += {"[wpermit(src) ? "Has weapon permit.\n" : ""]"} + msg += "\[Add comment\]\n" - if(istype(user) && user.hasHUD(HUD_MEDICAL)) - var/perpname = get_identification_name(get_face_name()) - var/medical = "None" - - var/datum/data/record/gen_record = data_core.find_general_record_by_name(perpname) - if(gen_record) - medical = gen_record.fields["p_stat"] - - msg += {"Physical status: \[[medical]\]\n - Medical records: \[View\]\n"} - for (var/ID in virus2) - if (ID in virusDB) - var/datum/data/record/v = virusDB[ID] - msg += "
[v.fields["name"]][v.fields["nickname"] ? " \"[v.fields["nickname"]]\"" : ""] detected in subject.\n" - if(!isjustobserver(user)) - msg += "\[Add comment\]\n" + if(isjustobserver(user)) + var/mob/dead/observer/O = user + if(O.antagHUD && mind && mind.antag_roles.len) + msg += "\[Show antag purchase log\]\n" if(flavor_text && can_show_flavor_text()) msg += "[print_flavor_text()]\n" diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index bdc86428a10..364ee6ecc94 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -622,6 +622,9 @@ if (!t1 || (usr.incapacitated() && !isAdminGhost(usr)) || !usr.hasHUD(HUD_MEDICAL)) return med_record.add_comment(t1) + else if (href_list["purchaselog"]) + if(mind) + mind.role_purchase_log() else if (href_list["listitems"]) var/mob/M = usr if(istype(M, /mob/dead) || (!M.isUnconscious() && !M.eye_blind && !M.blinded))