From 069a5e9d514b01f3ed468a66b365b33dd0a41b49 Mon Sep 17 00:00:00 2001 From: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> Date: Sun, 23 Jun 2024 14:07:31 +0200 Subject: [PATCH] HUD tweaks and fixes (#19492) Fixed paramedics not having the FR HUD icon anymore on the Security HUD. Moved all the HUD icon files in the hud folder. Changed the in_view() proc used for HUDs to use the more performant get_hearers_in_LOS() / get_hearers_in_range() over view() and a list traversal with range comparisons. HUD now respects the client view size instead of just using the world view size. --- code/defines/procs/hud.dm | 18 ++++-- code/game/antagonist/antagonist.dm | 9 ++- code/game/gamemodes/vampire/vampire_datum.dm | 4 +- code/modules/mob/living/carbon/human/human.dm | 18 +++--- code/modules/mob/living/silicon/ai/ai.dm | 18 +++--- .../modules/mob/living/silicon/robot/robot.dm | 18 +++--- html/changelogs/fluffyghost-hudtweakfixes.yml | 61 ++++++++++++++++++ icons/{mob => hud}/hud.dmi | Bin icons/{mob => hud}/hud_med.dmi | Bin icons/hud/hud_security.dmi | Bin 3298 -> 3296 bytes icons/{mob => hud}/hud_security_large.dmi | Bin 11 files changed, 106 insertions(+), 40 deletions(-) create mode 100644 html/changelogs/fluffyghost-hudtweakfixes.yml rename icons/{mob => hud}/hud.dmi (100%) rename icons/{mob => hud}/hud_med.dmi (100%) rename icons/{mob => hud}/hud_security_large.dmi (100%) diff --git a/code/defines/procs/hud.dm b/code/defines/procs/hud.dm index de72db153c7..a11b2ce9e7e 100644 --- a/code/defines/procs/hud.dm +++ b/code/defines/procs/hud.dm @@ -97,14 +97,20 @@ the HUD updates properly! */ GLOB.sec_hud_users -= src /mob/proc/in_view(var/turf/T) - return view(T) + RETURN_TYPE(/list) + + return get_hearers_in_LOS(client?.view, T) /mob/abstract/eye/in_view(var/turf/T) - var/list/viewed = new - for(var/mob/living/carbon/human/H in GLOB.mob_list) - if(get_dist(H, T) <= 7) - viewed += H - return viewed + RETURN_TYPE(/list) + + // This was like this before, honestly i don't see the point of doing it this way hence the change, but I left the code for reference in case shit hits the fan + // var/list/viewed = new + // for(var/mob/living/carbon/human/H in GLOB.mob_list) + // if(get_dist(H, T) <= client?.view) + // viewed += H + // return viewed + return get_hearers_in_range(client?.view, T) /proc/get_sec_hud_icon(var/mob/living/carbon/human/H)//This function is called from human/life,dm, ~line 1663 var/state diff --git a/code/game/antagonist/antagonist.dm b/code/game/antagonist/antagonist.dm index 937632ba8f0..5c85b2e2ee9 100644 --- a/code/game/antagonist/antagonist.dm +++ b/code/game/antagonist/antagonist.dm @@ -93,11 +93,10 @@ if(antaghud_indicator) if(!GLOB.hud_icon_reference) GLOB.hud_icon_reference = list() - if(role_text) GLOB.hud_icon_reference[role_text] = antaghud_indicator - if(faction_role_text) GLOB.hud_icon_reference[faction_role_text] = antaghud_indicator - -/datum/antagonist/proc/tick() - return 1 + if(role_text) + GLOB.hud_icon_reference[role_text] = antaghud_indicator + if(faction_role_text) + GLOB.hud_icon_reference[faction_role_text] = antaghud_indicator // Get the raw list of potential players. /datum/antagonist/proc/build_candidate_list(var/ghosts_only, var/allow_animals = 0) diff --git a/code/game/gamemodes/vampire/vampire_datum.dm b/code/game/gamemodes/vampire/vampire_datum.dm index 6fbbd945e6b..89c241d2982 100644 --- a/code/game/gamemodes/vampire/vampire_datum.dm +++ b/code/game/gamemodes/vampire/vampire_datum.dm @@ -52,9 +52,9 @@ /datum/vampire/proc/assign_master(var/mob/M, var/mob/set_master, var/datum/vampire/V) master = set_master V.thralls += M - thrall_image = image('icons/mob/hud.dmi', M, "hudthrall") + thrall_image = image('icons/hud/hud.dmi', M, "hudthrall") set_master.client.images += thrall_image - master_image = image('icons/mob/hud.dmi', set_master, "hudvampire") + master_image = image('icons/hud/hud.dmi', set_master, "hudvampire") M.client.images += master_image /datum/vampire/proc/lose_master(var/mob/M) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 80e42ae4f5b..d3c87dadc74 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -44,17 +44,17 @@ if(max_hydration > 0) hydration = rand(CREW_MINIMUM_HYDRATION*100, CREW_MAXIMUM_HYDRATION*100) * max_hydration * 0.01 - hud_list[HEALTH_HUD] = new /image/hud_overlay('icons/mob/hud_med.dmi', src, "100") - hud_list[STATUS_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudhealthy") + hud_list[HEALTH_HUD] = new /image/hud_overlay('icons/hud/hud_med.dmi', src, "100") + hud_list[STATUS_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudhealthy") hud_list[ID_HUD] = new /image/hud_overlay('icons/hud/hud_security.dmi', src, "hudunknown") hud_list[WANTED_HUD] = new /image/hud_overlay('icons/hud/hud_security.dmi', src, "hudblank") - hud_list[IMPLOYAL_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[IMPCHEM_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[IMPTRACK_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[SPECIALROLE_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[STATUS_HUD_OOC] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudhealthy") - hud_list[LIFE_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudhealthy") - hud_list[TRIAGE_HUD] = new /image/hud_overlay('icons/mob/hud_med.dmi', src, triage_tag) + hud_list[IMPLOYAL_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[IMPCHEM_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[IMPTRACK_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[SPECIALROLE_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[STATUS_HUD_OOC] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudhealthy") + hud_list[LIFE_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudhealthy") + hud_list[TRIAGE_HUD] = new /image/hud_overlay('icons/hud/hud_med.dmi', src, triage_tag) //Scaling down the ID hud var/image/holder = hud_list[ID_HUD] diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index da09619e2f0..62ad1da5b92 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -186,15 +186,15 @@ var/list/ai_verbs_default = list( addtimer(CALLBACK(src, PROC_REF(create_powersupply)), 5) - hud_list[HEALTH_HUD] = new /image/hud_overlay('icons/mob/hud_med.dmi', src, "100") - hud_list[STATUS_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[LIFE_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[ID_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[WANTED_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[IMPLOYAL_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[IMPCHEM_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[IMPTRACK_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[SPECIALROLE_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") + hud_list[HEALTH_HUD] = new /image/hud_overlay('icons/hud/hud_med.dmi', src, "100") + hud_list[STATUS_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[LIFE_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[ID_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[WANTED_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[IMPLOYAL_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[IMPCHEM_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[IMPTRACK_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[SPECIALROLE_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") ai_list += src diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 00714fa3a96..76264808d23 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -194,15 +194,15 @@ add_robot_verbs() - hud_list[HEALTH_HUD] = new /image/hud_overlay('icons/mob/hud_med.dmi', src, "100") - hud_list[STATUS_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudhealth100") - hud_list[LIFE_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudhealth100") - hud_list[ID_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[WANTED_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[IMPLOYAL_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[IMPCHEM_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[IMPTRACK_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") - hud_list[SPECIALROLE_HUD] = new /image/hud_overlay('icons/mob/hud.dmi', src, "hudblank") + hud_list[HEALTH_HUD] = new /image/hud_overlay('icons/hud/hud_med.dmi', src, "100") + hud_list[STATUS_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudhealth100") + hud_list[LIFE_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudhealth100") + hud_list[ID_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[WANTED_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[IMPLOYAL_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[IMPCHEM_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[IMPTRACK_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") + hud_list[SPECIALROLE_HUD] = new /image/hud_overlay('icons/hud/hud.dmi', src, "hudblank") /mob/living/silicon/robot/proc/update_access() if(emagged || malf_AI_module || crisis) diff --git a/html/changelogs/fluffyghost-hudtweakfixes.yml b/html/changelogs/fluffyghost-hudtweakfixes.yml new file mode 100644 index 00000000000..85aeb56dee2 --- /dev/null +++ b/html/changelogs/fluffyghost-hudtweakfixes.yml @@ -0,0 +1,61 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixed paramedics not having the FR HUD icon anymore on the Security HUD." + - refactor: "Moved all the HUD icon files in the hud folder." + - code_imp: "Changed the in_view() proc used for HUDs to use the more performant get_hearers_in_LOS() / get_hearers_in_range() over view() and a list traversal with range comparisons." + - code_imp: "HUD now respects the client view size instead of just using the world view size." diff --git a/icons/mob/hud.dmi b/icons/hud/hud.dmi similarity index 100% rename from icons/mob/hud.dmi rename to icons/hud/hud.dmi diff --git a/icons/mob/hud_med.dmi b/icons/hud/hud_med.dmi similarity index 100% rename from icons/mob/hud_med.dmi rename to icons/hud/hud_med.dmi diff --git a/icons/hud/hud_security.dmi b/icons/hud/hud_security.dmi index 1738b7ea21699b8a61d6988fb3cf2c7ba923b73b..2e01e8359c340e97e5e7481266c114e1e868c020 100644 GIT binary patch delta 480 zcmV<60U!S28Q>X^B!9?yR9JLGWpiV4X>fFDZ*Bkpc$}40F>c&I46IMD5bQp%fwb2I zX9O-%_ldmXN@E>*|#`2E|{ zaM~q#9?#?R({Rd=CHwuSJ2}Sl_>i~M$m+TxJq)KL*2nYsJb#>Kqk{YQzu2ABW5^CN z&JmB}#uHb7+cnUdR%nd7UvwaKA_;7>27%Mi$)J-&8a+v}ztDO>GUnGKXBR^PD!n zv0*PLQ;bcc-l4(tE-=nPHal5DNTlc$-DRPmMPCo-fsFquVM++G-}JZE{lD}d$CvlZ WczJsr{s6sG+AmGnV%f9z0qY8|#_Pra delta 482 zcmV<80UiF}8R8j`B!9|!R9JLGWpiV4X>fFDZ*Bkpc$}40F>c&I46IMDSlE4F18J`b z&InxCf1q|pS|$>AK~g8*?^B!|qzOQE5-=oZIK=E@`tkDf^*vqQUWY5xxJf#v@86z= z)6T_fI;ZES;Z(tM_4|)GInp^j)U9;Vwk#+Q!>O=ZI;ZF1G=C|rxPSkP-AO!#G?3;R zK`IuI#kzK7YXXg6Gj%7H2oxX4oAVWInmEVWS5Rq_A#cil3lXY}2{N-FHbQaVVqr!0 z7E@gr(~82GmIG>9hmvy>TS;gRZn$Z0N{)qzt%X*dA)ed1#`=qG3+VwJqjH&%6?@3{ z17?t~&3c7$c7Nn5oS9B;5MsZ{Z)y8~=|85I Y_e;9Gy$*i>%dgynwyFZ4v-JV%3Rw~BBme*a diff --git a/icons/mob/hud_security_large.dmi b/icons/hud/hud_security_large.dmi similarity index 100% rename from icons/mob/hud_security_large.dmi rename to icons/hud/hud_security_large.dmi