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.
This commit is contained in:
Fluffy
2024-06-23 14:07:31 +02:00
committed by GitHub
parent 7bdf48994f
commit 069a5e9d51
11 changed files with 106 additions and 40 deletions
+12 -6
View File
@@ -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
+4 -5
View File
@@ -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)
+2 -2
View File
@@ -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)
@@ -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]
+9 -9
View File
@@ -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
@@ -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)
@@ -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."

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Before

Width:  |  Height:  |  Size: 564 B

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB