From a3c1fecf02aa469b974236fa6a479a85b94be5d9 Mon Sep 17 00:00:00 2001 From: Contrabang <91113370+Contrabang@users.noreply.github.com> Date: Sun, 7 Apr 2024 05:45:30 -0400 Subject: [PATCH] Orbit menu now shows assigned roles to antaghud users (#24578) * lol * FUCK YEAH * the rest of the bundle * Update code/modules/asset_cache/assets/asset_orbit_icons.dm Co-authored-by: warriorstar-orion * little tgui thang --------- Co-authored-by: warriorstar-orion Co-authored-by: paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com> Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> --- code/datums/mind.dm | 33 ++++++ .../asset_cache/assets/asset_orbit_icons.dm | 12 ++ code/modules/mob/dead/observer/orbit.dm | 12 ++ icons/mob/hud/job_assets.dmi | Bin 0 -> 1355 bytes paradise.dme | 1 + tgui/packages/tgui/interfaces/Orbit.js | 26 ++++- tgui/public/tgui.bundle.js | 106 +++++++++--------- 7 files changed, 136 insertions(+), 54 deletions(-) create mode 100644 code/modules/asset_cache/assets/asset_orbit_icons.dm create mode 100644 icons/mob/hud/job_assets.dmi diff --git a/code/datums/mind.dm b/code/datums/mind.dm index a0b39e4ad69..f1ab4eef1d6 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -1751,6 +1751,39 @@ to_chat(current, "You seem to have forgotten the events of the past 10 minutes or so, and your head aches a bit as if someone beat it savagely with a stick.") to_chat(current, "This means you don't remember who you were working for or what you were doing.") +/datum/mind/proc/has_normal_assigned_role() + if(!assigned_role) + return FALSE + if(assigned_role == special_role) // nukie, ninjas, wizards, whatever + return FALSE + if(assigned_role == "Assistant") // because the default assigned role is assistant :P + for(var/list/L in list(GLOB.data_core.general)) + for(var/datum/data/record/R in L) + if(R.fields["name"] == name) + return TRUE + return FALSE + return TRUE + + +/datum/mind/proc/get_assigned_role_asset() //Used in asset generation for Orbiting + var/job_icons = GLOB.joblist + var/centcom = get_all_centcom_jobs() + SPECIAL_ROLE_ERT + SPECIAL_ROLE_DEATHSQUAD + var/solgov = get_all_solgov_jobs() + var/soviet = get_all_soviet_jobs() + + if(assigned_role in centcom) //Return with the NT logo if it is a Centcom job + return "centcom" + + if(assigned_role in solgov) //Return with the SolGov logo if it is a SolGov job + return "solgov" + + if(assigned_role in soviet) //Return with the U.S.S.P logo if it is a Soviet job + return "soviet" + + if(assigned_role in job_icons) //Check if the job has a hud icon + return assigned_role + return "unknown" + //Initialisation procs /mob/proc/mind_initialize() if(mind) diff --git a/code/modules/asset_cache/assets/asset_orbit_icons.dm b/code/modules/asset_cache/assets/asset_orbit_icons.dm new file mode 100644 index 00000000000..edc7c9923e1 --- /dev/null +++ b/code/modules/asset_cache/assets/asset_orbit_icons.dm @@ -0,0 +1,12 @@ +/// Sprites for Orbit Role UI +/datum/asset/spritesheet/orbit_job + name = "orbit_job" + +/datum/asset/spritesheet/orbit_job/create_spritesheets() + var/list/states = GLOB.joblist + "prisoner" + "centcom" + "solgov" + "soviet" + "unknown" + for(var/state in states) + Insert(ckey(state), 'icons/mob/hud/job_assets.dmi', ckey(state)) + +/datum/asset/spritesheet/orbit_job/ModifyInserted(icon/pre_asset) + pre_asset.Scale(16, 16) + return pre_asset diff --git a/code/modules/mob/dead/observer/orbit.dm b/code/modules/mob/dead/observer/orbit.dm index bd621a2f4cf..1f002db0a95 100644 --- a/code/modules/mob/dead/observer/orbit.dm +++ b/code/modules/mob/dead/observer/orbit.dm @@ -15,6 +15,11 @@ ui = new(user, src, "Orbit", "Orbit") ui.open() +/datum/orbit_menu/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/orbit_job) + ) + /datum/orbit_menu/ui_act(action, list/params, datum/tgui/ui) . = ..() if(.) @@ -123,6 +128,13 @@ antag_serialized["antag"] = antag_name antagonists += list(antag_serialized) + // Antaghud? Let them see everyone's role + if(isliving(M)) + var/mob/living/L = M + if(L.mind?.has_normal_assigned_role()) + serialized["assigned_role"] = L.mind.assigned_role + serialized["assigned_role_sprite"] = ckey(L.mind.get_assigned_role_asset()) + // Player terror spiders (and other hostile player-controlled event mobs) have their own category to help see how much there are. // Not in the above block because terrors can be known whether AHUD is on or not. if(isterrorspider(M)) diff --git a/icons/mob/hud/job_assets.dmi b/icons/mob/hud/job_assets.dmi new file mode 100644 index 0000000000000000000000000000000000000000..38d6fa4f0486e4e83e35d19d27dcf7928ff57c0e GIT binary patch literal 1355 zcmV-R1+@B!P)fFDZ*Bkpc$|%uv2NTj42I|PQy9r!v_OX} zU5W%nhUOi35@oTKNR^U($=jEAX}cBTWLo}A{Uk-|e*OCN?fGSW{QkTgsGWq@FYD(I zAD7dG;>h;$u$(f|mdDNR0|uIPxARYy3*RlLNZM`X({f4*72oZDTtFT{>XhqJHaQ&F zK{)2SLK{GHbqp*+p(86cMSI#8I&k{qx$M|8VTn^TBSc9Z!>%;mruYRk;#~P(f07af z)F~fvU~q+2VWVzI8FQ3)pfVIl2@HhI@;9%Ir7cyA6rgz3|G}e#A#*xptQNwQYj9mO z&vUZBnQR#9aeI(Tk*cG@ryMTL=g)TV}bp)KH~ z{QpmO=8ZN?ayZR6Cu0d+zgZ+Xx1l-L(2C#Eoby4SXTRA&Y_nl~>F<{Dbt0A-wVjGMMrWN~0V^)1ck9CLrzjsA5z(t7ts`!7EXgZOa-#__Fq`45iO zI3Il+W1KJz&!GMXbb(m?!7+{#XyvUJ*q8Hs{7}7adH`1;rg_BqYTaX~n#qVN)bT~A zr6~D_tQSnh3v_hoPe+oq`e()0C*}1P$}y5<_$y!)6MSerWQpF6bw~frXk&K z8lnVgAbyFWt$)r@0|f>>>6*(7%Z)ky{!=N&FKdpd72^#)lT%QuggLD*=WE@LG{0^~ zK93h#@xIZ=xhw5!f4R{vmzzW&zKJ9s2%-xY)QS`|kV=;uUn<1}s>7#XRD^0)Ibtaxt`wIVgykA<>XqUr;8Q!; z4gb0wFBc^LPIK;qCi6_zs+ao(YeUS9^Y4G5&-=$+=kFf{OvT7WSxPlgfkNHyP%!Th zM6eVE6=-7x)gHj*F~rh_hfuR3BSQpHE3(mFgJo+y - createSearch(searchText, (thing) => thing.name); + createSearch( + searchText, + (thing) => + thing.name + + (thing.assigned_role !== null ? '|' + thing.assigned_role : '') + ); const compareString = (a, b) => (a < b ? -1 : a > b); @@ -69,6 +75,24 @@ const OrbitedButton = (props, context) => { return (