From 2d3e7f2383e40d12bf0bf8dde755b9931aefae3f Mon Sep 17 00:00:00 2001 From: san7890 Date: Mon, 14 Nov 2022 23:07:38 -0700 Subject: [PATCH] Prettifies adminmoreinfo into a neater Examine Block (#71170) Updates the Adminmoreinfo button (also known as the '?' button) to be cleaner and easier to understand/read, and also makes it an examine block so it doesn't blend in with the rest of chat. --- code/modules/admin/topic.dm | 69 +++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 05440c6790a..dcc8fbdd368 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -767,8 +767,8 @@ output_ai_laws() else if(href_list["adminmoreinfo"]) - var/mob/M = locate(href_list["adminmoreinfo"]) in GLOB.mob_list - if(!ismob(M)) + var/mob/subject = locate(href_list["adminmoreinfo"]) in GLOB.mob_list + if(!ismob(subject)) to_chat(usr, "This can only be used on instances of type /mob.", confidential = TRUE) return @@ -776,32 +776,36 @@ var/special_role_description = "" var/health_description = "" var/gender_description = "" - var/turf/T = get_turf(M) + var/turf/position = get_turf(subject) //Location - if(isturf(T)) - if(isarea(T.loc)) - location_description = "([M.loc == T ? "at coordinates " : "in [M.loc] at coordinates "] [T.x], [T.y], [T.z] in area [T.loc])" + if(isturf(position)) + if(isarea(position.loc)) + location_description = "[subject.loc == position ? "at coordinates" : "in [position.loc] at coordinates"] [position.x], [position.y], [position.z] in area [position.loc]" else - location_description = "([M.loc == T ? "at coordinates " : "in [M.loc] at coordinates "] [T.x], [T.y], [T.z])" + location_description = "[subject.loc == position ? "at coordinates" : "in [subject.loc] at coordinates"] [position.x], [position.y], [position.z]" //Job + antagonist - if(M.mind) - special_role_description = "Role: [M.mind.assigned_role.title]; Antagonist: " - var/i = 0 - for(var/datum/antagonist/A in M.mind.antag_datums) - special_role_description += "[A.name]" - if(++i != length(M.mind.antag_datums)) - special_role_description += ", " - special_role_description += "" + if(subject.mind) + special_role_description = "Role: [subject.mind.assigned_role.title]; Antagonist: " + + if(subject.mind.antag_datums) + var/iterable = 0 + for(var/datum/antagonist/role in subject.mind.antag_datums) + special_role_description += "[role.name]" + if(++iterable != length(subject.mind.antag_datums)) + special_role_description += ", " + special_role_description += "" + else + special_role_description += "None" else special_role_description = "Role: Mind datum missing Antagonist: Mind datum missing" //Health - if(isliving(M)) - var/mob/living/L = M + if(isliving(subject)) + var/mob/living/lifer = subject var/status - switch (M.stat) + switch (subject.stat) if(CONSCIOUS) status = "Alive" if(SOFT_CRIT) @@ -812,24 +816,31 @@ status = "Unconscious and Dying" if(DEAD) status = "Dead" - health_description = "Status = [status]" - health_description += "
Oxy: [L.getOxyLoss()] - Tox: [L.getToxLoss()] - Fire: [L.getFireLoss()] - Brute: [L.getBruteLoss()] - Clone: [L.getCloneLoss()] - Brain: [L.getOrganLoss(ORGAN_SLOT_BRAIN)] - Stamina: [L.getStaminaLoss()]" + health_description = "Status: [status]" + health_description += "
Brute: [lifer.getBruteLoss()] - Burn: [lifer.getFireLoss()] - Toxin: [lifer.getToxLoss()] - Suffocation: [lifer.getOxyLoss()]" + health_description += "
Clone: [lifer.getCloneLoss()] - Brain: [lifer.getOrganLoss(ORGAN_SLOT_BRAIN)] - Stamina: [lifer.getStaminaLoss()]" else health_description = "This mob type has no health to speak of." //Gender - switch(M.gender) + switch(subject.gender) if(MALE,FEMALE,PLURAL) - gender_description = "[M.gender]" + gender_description = "[subject.gender]" else - gender_description = "[M.gender]" + gender_description = "[subject.gender]" - to_chat(src.owner, "Info about [M.name]: ", confidential = TRUE) - to_chat(src.owner, "Mob type = [M.type]; Gender = [gender_description] Damage = [health_description]", confidential = TRUE) - to_chat(src.owner, "Name = [M.name]; Real_name = [M.real_name]; Mind_name = [M.mind?"[M.mind.name]":""]; Key = [M.key];", confidential = TRUE) - to_chat(src.owner, "Location = [location_description];", confidential = TRUE) - to_chat(src.owner, "[special_role_description]", confidential = TRUE) - to_chat(src.owner, ADMIN_FULLMONTY_NONAME(M), confidential = TRUE) + //Full Output + var/exportable_text = "[span_bold("Info about [subject.name]:")]
" + exportable_text += "Key - [span_bold(subject.key)]
" + exportable_text += "Mob Type - [subject.type]
" + exportable_text += "Gender - [gender_description]
" + exportable_text += "[health_description]
" + exportable_text += "Name: [span_bold(subject.name)] - Real Name: [subject.real_name] - Mind Name: [subject.mind?"[subject.mind.name]":""]
" + exportable_text += "Location is [location_description]
" + exportable_text += "[special_role_description]
" + exportable_text += ADMIN_FULLMONTY_NONAME(subject) + + to_chat(src.owner, examine_block(exportable_text), confidential = TRUE) else if(href_list["addjobslot"]) if(!check_rights(R_ADMIN))