Skip to content

Commit

Permalink
HUD tweaks and fixes (Aurorastation#19492)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
FluffyGhoster authored Jun 23, 2024
1 parent 7bdf489 commit 069a5e9
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 40 deletions.
18 changes: 12 additions & 6 deletions code/defines/procs/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions code/game/antagonist/antagonist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/vampire/vampire_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 9 additions & 9 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
18 changes: 9 additions & 9 deletions code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 9 additions & 9 deletions code/modules/mob/living/silicon/robot/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
61 changes: 61 additions & 0 deletions html/changelogs/fluffyghost-hudtweakfixes.yml
Original file line number Diff line number Diff line change
@@ -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."
File renamed without changes.
File renamed without changes.
Binary file modified icons/hud/hud_security.dmi
Binary file not shown.
File renamed without changes.

0 comments on commit 069a5e9

Please sign in to comment.