diff --git a/code/__DEFINES/atom_hud.dm b/code/__DEFINES/atom_hud.dm
index 862ccef9dd8..cd47fdde438 100644
--- a/code/__DEFINES/atom_hud.dm
+++ b/code/__DEFINES/atom_hud.dm
@@ -2,6 +2,7 @@
// note: if you add more HUDs, even for non-human atoms, make sure to use unique numbers for the defines!
// /datum/atom_hud expects these to be unique
// these need to be strings in order to make them associative lists
+
/// dead, alive, sick, health status
#define HEALTH_HUD "1"
/// a simple line rounding the mob's number health
diff --git a/code/__DEFINES/icon_smoothing.dm b/code/__DEFINES/icon_smoothing.dm
index 8805767237f..7addddb0a47 100644
--- a/code/__DEFINES/icon_smoothing.dm
+++ b/code/__DEFINES/icon_smoothing.dm
@@ -26,8 +26,7 @@ DEFINE_BITFIELD(smoothing_flags, list(
#define QUEUE_SMOOTH(thing_to_queue) if(thing_to_queue.smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) {SSicon_smooth.add_to_queue(thing_to_queue)}
-#define QUEUE_SMOOTH_NEIGHBORS(thing_to_queue) for(var/neighbor in orange(1, thing_to_queue)) {var/atom/atom_neighbor = neighbor; QUEUE_SMOOTH(atom_neighbor)}
-
+#define QUEUE_SMOOTH_NEIGHBORS(thing_to_queue) for(var/atom/atom_neighbor as anything in orange(1, thing_to_queue)) {QUEUE_SMOOTH(atom_neighbor)}
/**SMOOTHING GROUPS
* Groups of things to smooth with.
diff --git a/code/__DEFINES/spatial_gridmap.dm b/code/__DEFINES/spatial_gridmap.dm
index 858abc9d55b..d9f2d0bc644 100644
--- a/code/__DEFINES/spatial_gridmap.dm
+++ b/code/__DEFINES/spatial_gridmap.dm
@@ -14,3 +14,29 @@
///whether movable is itself or containing something which should be in one of the spatial grid channels.
#define HAS_SPATIAL_GRID_CONTENTS(movable) (movable.important_recursive_contents && (movable.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE] || movable.important_recursive_contents[RECURSIVE_CONTENTS_CLIENT_MOBS]))
+
+// macros meant specifically to add/remove movables from lazy content lists in the spatial grid.
+// when empty they become references to a single list in SSspatial_grid and when filled they become their own list
+// this is to save memory without making them lazylists as that slows down iteration through them
+#define GRID_CELL_ADD(cell_contents_list, movable_or_list) \
+ if(!length(cell_contents_list)) { \
+ cell_contents_list = list(); \
+ cell_contents_list += movable_or_list; \
+ } else { \
+ cell_contents_list += movable_or_list; \
+ };
+
+#define GRID_CELL_SET(cell_contents_list, movable_or_list) \
+ if(!length(cell_contents_list)) { \
+ cell_contents_list = list(); \
+ cell_contents_list += movable_or_list; \
+ } else { \
+ cell_contents_list |= movable_or_list; \
+ };
+
+//dont use these outside of SSspatial_grid's scope use the procs it has for this purpose
+#define GRID_CELL_REMOVE(cell_contents_list, movable_or_list) \
+ cell_contents_list -= movable_or_list; \
+ if(!length(cell_contents_list)) {\
+ cell_contents_list = dummy_list; \
+ };
diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm
index 321d943a6bf..b8f5d00a7ca 100644
--- a/code/__HELPERS/icon_smoothing.dm
+++ b/code/__HELPERS/icon_smoothing.dm
@@ -309,8 +309,7 @@ DEFINE_BITFIELD(smoothing_junction, list(
return ADJ_FOUND
if(smoothing_flags & SMOOTH_OBJ)
- for(var/am in target_turf)
- var/atom/movable/thing = am
+ for(var/atom/movable/thing as anything in target_turf)
if(!thing.anchored || isnull(thing.smoothing_groups))
continue
for(var/target in canSmoothWith)
@@ -402,20 +401,18 @@ DEFINE_BITFIELD(smoothing_junction, list(
//Icon smoothing helpers
/proc/smooth_zlevel(zlevel, now = FALSE)
var/list/away_turfs = block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel))
- for(var/V in away_turfs)
- var/turf/T = V
- if(T.smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
+ for(var/turf/turf_to_smooth as anything in away_turfs)
+ if(turf_to_smooth.smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
if(now)
- T.smooth_icon()
+ turf_to_smooth.smooth_icon()
else
- QUEUE_SMOOTH(T)
- for(var/R in T)
- var/atom/A = R
- if(A.smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
+ QUEUE_SMOOTH(turf_to_smooth)
+ for(var/atom/movable/movable_to_smooth as anything in turf_to_smooth)
+ if(movable_to_smooth.smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
if(now)
- A.smooth_icon()
+ movable_to_smooth.smooth_icon()
else
- QUEUE_SMOOTH(A)
+ QUEUE_SMOOTH(movable_to_smooth)
/atom/proc/clear_smooth_overlays()
diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm
index 87801cf418a..58bca9b3117 100644
--- a/code/__HELPERS/roundend.dm
+++ b/code/__HELPERS/roundend.dm
@@ -231,7 +231,7 @@
// Add AntagHUD to everyone, see who was really evil the whole time!
for(var/datum/atom_hud/alternate_appearance/basic/antagonist_hud/antagonist_hud in GLOB.active_alternate_appearances)
for(var/mob/player as anything in GLOB.player_list)
- antagonist_hud.add_hud_to(player)
+ antagonist_hud.show_to(player)
CHECK_TICK
diff --git a/code/controllers/subsystem/icon_smooth.dm b/code/controllers/subsystem/icon_smooth.dm
index ec941f9b18c..4960614c3f4 100644
--- a/code/controllers/subsystem/icon_smooth.dm
+++ b/code/controllers/subsystem/icon_smooth.dm
@@ -11,10 +11,10 @@ SUBSYSTEM_DEF(icon_smooth)
var/list/deferred = list()
/datum/controller/subsystem/icon_smooth/fire()
- var/list/cached = smooth_queue
- while(length(cached))
- var/atom/smoothing_atom = cached[length(cached)]
- cached.len--
+ var/list/smooth_queue_cache = smooth_queue
+ while(length(smooth_queue_cache))
+ var/atom/smoothing_atom = smooth_queue_cache[length(smooth_queue_cache)]
+ smooth_queue_cache.len--
if(QDELETED(smoothing_atom) || !(smoothing_atom.smoothing_flags & SMOOTH_QUEUED))
continue
if(smoothing_atom.flags_1 & INITIALIZED_1)
@@ -24,10 +24,10 @@ SUBSYSTEM_DEF(icon_smooth)
if (MC_TICK_CHECK)
return
- if (!cached.len)
+ if (!length(smooth_queue_cache))
if (deferred.len)
smooth_queue = deferred
- deferred = cached
+ deferred = smooth_queue_cache
else
can_fire = FALSE
@@ -49,8 +49,7 @@ SUBSYSTEM_DEF(icon_smooth)
queue = blueprint_queue
blueprint_queue = null
- for(var/item in queue)
- var/atom/movable/movable_item = item
+ for(var/atom/movable/movable_item as anything in queue)
if(!isturf(movable_item.loc))
continue
var/turf/item_loc = movable_item.loc
diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm
index c96172757cc..c798b316878 100644
--- a/code/controllers/subsystem/mapping.dm
+++ b/code/controllers/subsystem/mapping.dm
@@ -40,6 +40,7 @@ SUBSYSTEM_DEF(mapping)
// Z-manager stuff
var/station_start // should only be used for maploading-related tasks
var/space_levels_so_far = 0
+ ///list of all the z level datums created representing the z levels in the world
var/list/z_list
var/datum/space_level/transit
var/datum/space_level/empty_space
diff --git a/code/controllers/subsystem/spatial_gridmap.dm b/code/controllers/subsystem/spatial_gridmap.dm
index 97c3bd06fa0..66c23f7624c 100644
--- a/code/controllers/subsystem/spatial_gridmap.dm
+++ b/code/controllers/subsystem/spatial_gridmap.dm
@@ -1,32 +1,6 @@
///the subsystem creates this many [/mob/oranges_ear] mob instances during init. allocations that require more than this create more.
#define NUMBER_OF_PREGENERATED_ORANGES_EARS 2500
-// macros meant specifically to add/remove movables from the hearing_contents and client_contents lists of
-// /datum/spatial_grid_cell, when empty they become references to a single list in SSspatial_grid and when filled they become their own list
-// this is to save memory without making them lazylists as that slows down iteration through them
-#define GRID_CELL_ADD(cell_contents_list, movable_or_list) \
- if(!length(cell_contents_list)) { \
- cell_contents_list = list(); \
- cell_contents_list += movable_or_list; \
- } else { \
- cell_contents_list += movable_or_list; \
- };
-
-#define GRID_CELL_SET(cell_contents_list, movable_or_list) \
- if(!length(cell_contents_list)) { \
- cell_contents_list = list(); \
- cell_contents_list += movable_or_list; \
- } else { \
- cell_contents_list |= movable_or_list; \
- };
-
-//dont use these outside of SSspatial_grid's scope use the procs it has for this purpose
-#define GRID_CELL_REMOVE(cell_contents_list, movable_or_list) \
- cell_contents_list -= movable_or_list; \
- if(!length(cell_contents_list)) {\
- cell_contents_list = dummy_list; \
- };
-
/**
* # Spatial Grid Cell
*
@@ -64,7 +38,6 @@
if(length(dummy_list))
dummy_list.Cut()
stack_trace("SSspatial_grid.dummy_list had something inserted into it at some point! this is a problem as it is supposed to stay empty")
-
hearing_contents = dummy_list
client_contents = dummy_list
@@ -296,6 +269,7 @@ SUBSYSTEM_DEF(spatial_grid)
//technically THIS list only contains lists, but inside those lists are grid cell datums and we can go without a SINGLE var init if we do this
var/list/datum/spatial_grid_cell/grid_level = grids_by_z_level[center_turf.z]
+
switch(type)
if(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS)
for(var/row in BOUNDING_BOX_MIN(center_y) to BOUNDING_BOX_MAX(center_y, cells_on_y_axis))
@@ -363,15 +337,15 @@ SUBSYSTEM_DEF(spatial_grid)
var/datum/spatial_grid_cell/intersecting_cell = grids_by_z_level[z_index][y_index][x_index]
- if(new_target.important_recursive_contents[RECURSIVE_CONTENTS_CLIENT_MOBS])
+ if(new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
GRID_CELL_SET(intersecting_cell.client_contents, new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
- SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_ENTERED(RECURSIVE_CONTENTS_CLIENT_MOBS), new_target)
+ SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_ENTERED(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS), new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
- if(new_target.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE])
- GRID_CELL_SET(intersecting_cell.hearing_contents, new_target.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE])
+ if(new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
+ GRID_CELL_SET(intersecting_cell.hearing_contents, new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
- SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_ENTERED(RECURSIVE_CONTENTS_HEARING_SENSITIVE), new_target)
+ SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_ENTERED(SPATIAL_GRID_CONTENTS_TYPE_HEARING), new_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
/**
* find the spatial map cell that target used to belong to, then subtract target's important_recusive_contents from it.
@@ -385,35 +359,54 @@ SUBSYSTEM_DEF(spatial_grid)
if(!initialized)
return
if(!target_turf || !old_target?.important_recursive_contents)
- CRASH("/datum/controller/subsystem/spatial_grid/proc/exit_cell() was given null arguments or a new_target without important_recursive_contents!")
+ stack_trace("/datum/controller/subsystem/spatial_grid/proc/exit_cell() was given null arguments or a new_target without important_recursive_contents!")
+ return FALSE
var/x_index = ROUND_UP(target_turf.x / SPATIAL_GRID_CELLSIZE)
var/y_index = ROUND_UP(target_turf.y / SPATIAL_GRID_CELLSIZE)
var/z_index = target_turf.z
- var/list/grid = grids_by_z_level[z_index]
- var/datum/spatial_grid_cell/intersecting_cell = grid[y_index][x_index]
+ var/datum/spatial_grid_cell/intersecting_cell = grids_by_z_level[z_index][y_index][x_index]
+ var/list/old_target_contents = old_target.important_recursive_contents //cache for sanic speeds (lists are references anyways)
- if(exclusive_type && old_target.important_recursive_contents[exclusive_type])
- switch(exclusive_type)
- if(RECURSIVE_CONTENTS_CLIENT_MOBS)
- GRID_CELL_REMOVE(intersecting_cell.client_contents, old_target.important_recursive_contents[RECURSIVE_CONTENTS_CLIENT_MOBS])
+ if(old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
+ GRID_CELL_REMOVE(intersecting_cell.client_contents, old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
- if(RECURSIVE_CONTENTS_HEARING_SENSITIVE)
- GRID_CELL_REMOVE(intersecting_cell.hearing_contents, old_target.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE])
+ SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS), old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
- SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(exclusive_type), old_target)
- return
+ if(old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
+ GRID_CELL_REMOVE(intersecting_cell.hearing_contents, old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
- if(old_target.important_recursive_contents[RECURSIVE_CONTENTS_CLIENT_MOBS])
- GRID_CELL_REMOVE(intersecting_cell.client_contents, old_target.important_recursive_contents[RECURSIVE_CONTENTS_CLIENT_MOBS])
+ SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(SPATIAL_GRID_CONTENTS_TYPE_HEARING), old_target_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
- SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS), old_target)
+ return TRUE
- if(old_target.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE])
- GRID_CELL_REMOVE(intersecting_cell.hearing_contents, old_target.important_recursive_contents[RECURSIVE_CONTENTS_HEARING_SENSITIVE])
+///acts like exit_cell() but only removes the target from the specified type of grid cell contents list
+/datum/controller/subsystem/spatial_grid/proc/remove_single_contents_type(atom/movable/old_target, turf/target_turf, exclusive_type)
+ if(!target_turf || !old_target?.important_recursive_contents || !exclusive_type)
+ stack_trace("/datum/controller/subsystem/spatial_grid/proc/remove_single_contents_type() was given null arguments or a new_target without important_recursive_contents!")
+ return FALSE
+
+ if(!old_target.important_recursive_contents[exclusive_type])
+ return FALSE
+
+ var/x_index = ROUND_UP(target_turf.x / SPATIAL_GRID_CELLSIZE)
+ var/y_index = ROUND_UP(target_turf.y / SPATIAL_GRID_CELLSIZE)
+ var/z_index = target_turf.z
+
+ var/datum/spatial_grid_cell/intersecting_cell = grids_by_z_level[z_index][y_index][x_index]
+
+ switch(exclusive_type)
+ if(SPATIAL_GRID_CONTENTS_TYPE_CLIENTS)
+ GRID_CELL_REMOVE(intersecting_cell.client_contents, old_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_CLIENTS])
+
+ if(SPATIAL_GRID_CONTENTS_TYPE_HEARING)
+ GRID_CELL_REMOVE(intersecting_cell.hearing_contents, old_target.important_recursive_contents[SPATIAL_GRID_CONTENTS_TYPE_HEARING])
+
+ SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(exclusive_type), old_target)
+
+ return TRUE
- SEND_SIGNAL(intersecting_cell, SPATIAL_GRID_CELL_EXITED(RECURSIVE_CONTENTS_HEARING_SENSITIVE), old_target)
///find the cell this movable is associated with and removes it from all lists
/datum/controller/subsystem/spatial_grid/proc/force_remove_from_cell(atom/movable/to_remove, datum/spatial_grid_cell/input_cell)
diff --git a/code/datums/hud.dm b/code/datums/hud.dm
index 003ca63c5bc..232cc3f59b1 100644
--- a/code/datums/hud.dm
+++ b/code/datums/hud.dm
@@ -2,6 +2,10 @@
GLOBAL_LIST_EMPTY(all_huds)
+///gets filled by each /datum/atom_hud/New().
+///associative list of the form: list(hud category = list(all global atom huds that use that category))
+GLOBAL_LIST_EMPTY(huds_by_category)
+
//GLOBAL HUD LIST
GLOBAL_LIST_INIT(huds, list(
DATA_HUD_SECURITY_BASIC = new/datum/atom_hud/data/human/security/basic(),
@@ -17,116 +21,354 @@ GLOBAL_LIST_INIT(huds, list(
))
/datum/atom_hud
- var/list/atom/hudatoms = list() //list of all atoms which display this hud
- var/list/hudusers = list() //list with all mobs who can see the hud
- var/list/hud_icons = list() //these will be the indexes for the atom's hud_list
+ ///associative list of the form: list(z level = list(hud atom)).
+ ///tracks what hud atoms for this hud exists in what z level so we can only give users
+ ///the hud images that they can actually see.
+ var/list/atom/hud_atoms = list()
- var/list/next_time_allowed = list() //mobs associated with the next time this hud can be added to them
- var/list/queued_to_see = list() //mobs that have triggered the cooldown and are queued to see the hud, but do not yet
- var/hud_exceptions = list() // huduser = list(ofatomswiththeirhudhidden) - aka everyone hates targeted invisiblity
+ ///associative list of the form: list(z level = list(hud user client mobs)).
+ ///tracks mobs that can "see" us
+ // by z level so when they change z's we can adjust what images they see from this hud.
+ var/list/hud_users = list()
+
+ ///used for signal tracking purposes, associative list of the form: list(hud atom = TRUE) that isnt separated by z level
+ var/list/atom/hud_atoms_all_z_levels = list()
+
+ ///used for signal tracking purposes, associative list of the form: list(hud user = number of times this hud was added to this user).
+ ///that isnt separated by z level
+ var/list/mob/hud_users_all_z_levels = list()
+
+ ///these will be the indexes for the atom's hud_list
+ var/list/hud_icons = list()
+
+ ///mobs associated with the next time this hud can be added to them
+ var/list/next_time_allowed = list()
+ ///mobs that have triggered the cooldown and are queued to see the hud, but do not yet
+ var/list/queued_to_see = list()
+ /// huduser = list(atoms with their hud hidden) - aka everyone hates targeted invisiblity
+ var/list/hud_exceptions = list()
+ ///whether or not this atom_hud type updates the global huds_by_category list.
+ ///some subtypes cant work like this since theyre supposed to "belong" to
+ ///one target atom each. it will still go in the other global hud lists.
+ var/uses_global_hud_category = TRUE
/datum/atom_hud/New()
GLOB.all_huds += src
+ for(var/z_level in 1 to world.maxz)
+ hud_atoms += list(list())
+ hud_users += list(list())
+
+ RegisterSignal(SSdcs, COMSIG_GLOB_NEW_Z, .proc/add_z_level_huds)
+
+ if(uses_global_hud_category)
+ for(var/hud_icon in hud_icons)
+ GLOB.huds_by_category[hud_icon] += list(src)
/datum/atom_hud/Destroy()
- for(var/v in hudusers)
- remove_hud_from(v)
- for(var/v in hudatoms)
- remove_from_hud(v)
+ for(var/mob/mob as anything in hud_users_all_z_levels)
+ hide_from(mob)
+
+ for(var/atom/atom as anything in hud_atoms_all_z_levels)
+ remove_atom_from_hud(atom)
+
+ if(uses_global_hud_category)
+ for(var/hud_icon in hud_icons)
+ LAZYREMOVEASSOC(GLOB.huds_by_category, hud_icon, src)
+
GLOB.all_huds -= src
return ..()
-/datum/atom_hud/proc/remove_hud_from(mob/M, absolute = FALSE)
- if(!M || !hudusers[M])
- return
- if (absolute || !--hudusers[M])
- UnregisterSignal(M, COMSIG_PARENT_QDELETING)
- hudusers -= M
- if(next_time_allowed[M])
- next_time_allowed -= M
- if(queued_to_see[M])
- queued_to_see -= M
- else
- for(var/atom/A in hudatoms)
- remove_from_single_hud(M, A)
+/datum/atom_hud/proc/add_z_level_huds()
+ SIGNAL_HANDLER
+ hud_atoms += list(list())
+ hud_users += list(list())
-/datum/atom_hud/proc/remove_from_hud(atom/A)
- if(!A)
+///returns a list of all hud atoms in the given z level and linked lower z levels (because hud users in higher z levels can see below)
+/datum/atom_hud/proc/get_hud_atoms_for_z_level(z_level)
+ if(z_level <= 0)
return FALSE
- for(var/mob/M in hudusers)
- remove_from_single_hud(M, A)
- hudatoms -= A
+ if(z_level > length(hud_atoms))
+ stack_trace("get_hud_atoms_for_z_level() was given a z level index out of bounds of hud_atoms!")
+ return FALSE
+
+ . = list()
+ . += hud_atoms[z_level]
+
+ var/max_number_of_linked_z_levels_i_care_to_support_here = 10
+
+ while(max_number_of_linked_z_levels_i_care_to_support_here)
+ var/lower_z_level_exists = SSmapping.level_trait(z_level, ZTRAIT_DOWN)
+
+ if(lower_z_level_exists)
+ z_level--
+ . += hud_atoms[z_level]
+ max_number_of_linked_z_levels_i_care_to_support_here--
+ continue
+
+ else
+ break
+
+///returns a list of all hud users in the given z level and linked upper z levels (because hud users in higher z levels can see below)
+/datum/atom_hud/proc/get_hud_users_for_z_level(z_level)
+ if(z_level > length(hud_users) || z_level <= 0)
+ stack_trace("get_hud_atoms_for_z_level() was given a z level index [z_level] out of bounds 1->[length(hud_users)] of hud_atoms!")
+ return FALSE
+
+ . = list()
+ . += hud_users[z_level]
+
+ var/max_number_of_linked_z_levels_i_care_to_support_here = 10
+
+ while(max_number_of_linked_z_levels_i_care_to_support_here)
+ var/upper_level_exists = SSmapping.level_trait(z_level, ZTRAIT_UP)
+
+ if(upper_level_exists)
+ z_level++
+ . += hud_users[z_level]
+ max_number_of_linked_z_levels_i_care_to_support_here--
+ continue
+
+ else
+ break
+
+///show this hud to the passed in user
+/datum/atom_hud/proc/show_to(mob/new_viewer)
+ if(!new_viewer)
+ return
+
+ var/turf/their_turf = get_turf(new_viewer)
+ if(!their_turf)
+ return
+
+ if(!hud_users[their_turf.z][new_viewer])
+ hud_users[their_turf.z][new_viewer] = TRUE
+ hud_users_all_z_levels[new_viewer] = 1
+
+ RegisterSignal(new_viewer, COMSIG_PARENT_QDELETING, .proc/unregister_atom, override = TRUE) //both hud users and hud atoms use these signals
+ RegisterSignal(new_viewer, COMSIG_MOVABLE_Z_CHANGED, .proc/on_atom_or_user_z_level_changed, override = TRUE)
+
+ if(next_time_allowed[new_viewer] > world.time)
+ if(!queued_to_see[new_viewer])
+ addtimer(CALLBACK(src, .proc/show_hud_images_after_cooldown, new_viewer), next_time_allowed[new_viewer] - world.time)
+ queued_to_see[new_viewer] = TRUE
+
+ else
+ next_time_allowed[new_viewer] = world.time + ADD_HUD_TO_COOLDOWN
+ for(var/atom/hud_atom_to_add as anything in get_hud_atoms_for_z_level(their_turf.z))
+ add_atom_to_single_mob_hud(new_viewer, hud_atom_to_add)
+ else
+ hud_users_all_z_levels[new_viewer] += 1 //increment the number of times this hud has been added to this hud user
+
+///Hides the images in this hud from former_viewer
+///If absolute is set to true, this will forcefully remove the hud, even if sources in theory remain
+/datum/atom_hud/proc/hide_from(mob/former_viewer, absolute = FALSE)
+ if(!former_viewer || !hud_users_all_z_levels[former_viewer])
+ return
+
+ var/turf/their_turf = get_turf(former_viewer)
+ if(!their_turf)
+ return
+
+ hud_users_all_z_levels[former_viewer] -= 1//decrement number of sources for this hud on this user (bad way to track i know)
+
+ if (absolute || hud_users_all_z_levels[former_viewer] <= 0)//if forced or there arent any sources left, remove the user
+
+ if(!hud_atoms_all_z_levels[former_viewer])//make sure we arent unregistering changes on a mob thats also a hud atom for this hud
+ UnregisterSignal(former_viewer, COMSIG_MOVABLE_Z_CHANGED)
+ UnregisterSignal(former_viewer, COMSIG_PARENT_QDELETING)
+
+ hud_users[their_turf.z] -= former_viewer
+ hud_users_all_z_levels -= former_viewer
+
+ if(next_time_allowed[former_viewer])
+ next_time_allowed -= former_viewer
+
+ if(queued_to_see[former_viewer])
+ queued_to_see -= former_viewer
+ else
+ for(var/atom/hud_atom as anything in get_hud_atoms_for_z_level(their_turf.z))
+ remove_atom_from_single_hud(former_viewer, hud_atom)
+
+/// add new_hud_atom to this hud
+/datum/atom_hud/proc/add_atom_to_hud(atom/new_hud_atom)
+ if(!new_hud_atom)
+ return FALSE
+ var/turf/atom_turf = get_turf(new_hud_atom)
+ if(!atom_turf)
+ return
+
+ RegisterSignal(new_hud_atom, COMSIG_MOVABLE_Z_CHANGED, .proc/on_atom_or_user_z_level_changed, override = TRUE)
+ RegisterSignal(new_hud_atom, COMSIG_PARENT_QDELETING, .proc/unregister_atom, override = TRUE) //both hud atoms and hud users use these signals
+
+ hud_atoms[atom_turf.z] |= new_hud_atom
+ hud_atoms_all_z_levels[new_hud_atom] = TRUE
+
+ for(var/mob/mob_to_show as anything in get_hud_users_for_z_level(atom_turf.z))
+ if(!queued_to_see[mob_to_show])
+ add_atom_to_single_mob_hud(mob_to_show, new_hud_atom)
return TRUE
-/datum/atom_hud/proc/remove_from_single_hud(mob/M, atom/A) //unsafe, no sanity apart from client
- if(!M || !M.client || !A)
- return
- for(var/i in hud_icons)
- M.client.images -= A.hud_list[i]
+/// remove this atom from this hud completely
+/datum/atom_hud/proc/remove_atom_from_hud(atom/hud_atom_to_remove)
+ if(!hud_atom_to_remove || !hud_atoms_all_z_levels[hud_atom_to_remove])
+ return FALSE
-/datum/atom_hud/proc/add_hud_to(mob/M)
- if(!M)
- return
- if(!hudusers[M])
- hudusers[M] = 1
- RegisterSignal(M, COMSIG_PARENT_QDELETING, .proc/unregister_mob)
- if(next_time_allowed[M] > world.time)
- if(!queued_to_see[M])
- addtimer(CALLBACK(src, .proc/show_hud_images_after_cooldown, M), next_time_allowed[M] - world.time)
- queued_to_see[M] = TRUE
- else
- next_time_allowed[M] = world.time + ADD_HUD_TO_COOLDOWN
- for(var/atom/A in hudatoms)
- add_to_single_hud(M, A)
- else
- hudusers[M]++
+ //make sure we arent unregistering a hud atom thats also a hud user mob
+ if(!hud_users_all_z_levels[hud_atom_to_remove])
+ UnregisterSignal(hud_atom_to_remove, COMSIG_MOVABLE_Z_CHANGED)
+ UnregisterSignal(hud_atom_to_remove, COMSIG_PARENT_QDELETING)
-/datum/atom_hud/proc/unregister_mob(datum/source, force)
+ for(var/mob/mob_to_remove as anything in hud_users_all_z_levels)
+ remove_atom_from_single_hud(mob_to_remove, hud_atom_to_remove)
+
+ var/turf/atom_turf = get_turf(hud_atom_to_remove)
+ if(!atom_turf)
+ return
+
+ hud_atoms[atom_turf.z] -= hud_atom_to_remove
+ hud_atoms_all_z_levels -= hud_atom_to_remove
+
+ return TRUE
+
+///adds a newly active hud category's image on a hud atom to every mob that could see it
+/datum/atom_hud/proc/add_single_hud_category_on_atom(atom/hud_atom, hud_category_to_add)
+ if(!hud_atom?.active_hud_list?[hud_category_to_add] || QDELING(hud_atom) || !(hud_category_to_add in hud_icons))
+ return FALSE
+
+ var/turf/atom_turf = get_turf(hud_atom)
+ if(!atom_turf)
+ return FALSE
+
+ if(!hud_atoms_all_z_levels[hud_atom])
+ add_atom_to_hud(hud_atom)
+ return TRUE
+
+ for(var/mob/hud_user as anything in get_hud_users_for_z_level(atom_turf.z))
+ if(!hud_user.client)
+ continue
+ if(!hud_exceptions[hud_user] || !(hud_atom in hud_exceptions[hud_user]))
+ hud_user.client.images |= hud_atom.active_hud_list[hud_category_to_add]
+
+ return TRUE
+
+///removes the image or images in hud_atom.hud_list[hud_category_to_remove] from every mob that can see it but leaves every other image
+///from that atom there.
+/datum/atom_hud/proc/remove_single_hud_category_on_atom(atom/hud_atom, hud_category_to_remove)
+ if(QDELETED(hud_atom) || !(hud_category_to_remove in hud_icons) || !hud_atoms_all_z_levels[hud_atom])
+ return FALSE
+
+ if(!hud_atom.active_hud_list)
+ remove_atom_from_hud(hud_atom)
+ return TRUE
+
+ var/turf/atom_turf = get_turf(hud_atom)
+ if(!atom_turf)
+ return FALSE
+
+ for(var/mob/hud_user as anything in get_hud_users_for_z_level(atom_turf.z))
+ if(!hud_user.client)
+ continue
+ hud_user.client.images -= hud_atom.active_hud_list[hud_category_to_remove]//by this point it shouldnt be in active_hud_list
+
+ return TRUE
+
+///when a hud atom or hud user changes z levels this makes sure it gets the images it needs and removes the images it doesnt need.
+///because of how signals work we need the same proc to handle both use cases because being a hud atom and being a hud user arent mutually exclusive
+/datum/atom_hud/proc/on_atom_or_user_z_level_changed(atom/movable/moved_atom, turf/old_turf, turf/new_turf)
SIGNAL_HANDLER
- remove_hud_from(source, TRUE)
-/datum/atom_hud/proc/hide_single_atomhud_from(hud_user,hidden_atom)
- if(hudusers[hud_user])
- remove_from_single_hud(hud_user,hidden_atom)
+ if(old_turf)
+ if(hud_users_all_z_levels[moved_atom])
+ hud_users[old_turf.z] -= moved_atom
+
+ for(var/atom/formerly_seen_hud_atom as anything in get_hud_atoms_for_z_level(old_turf.z))
+ remove_atom_from_single_hud(moved_atom, formerly_seen_hud_atom)
+
+ if(hud_atoms_all_z_levels[moved_atom])
+ hud_atoms[old_turf.z] -= moved_atom
+
+ for(var/mob/formerly_seeing as anything in get_hud_users_for_z_level(old_turf.z))//this wont include moved_atom since its removed
+ remove_atom_from_single_hud(formerly_seeing, moved_atom)
+
+ if(new_turf)
+ if(hud_users_all_z_levels[moved_atom])
+ hud_users[new_turf.z][moved_atom] = TRUE //hud users is associative, hud atoms isnt
+
+ for(var/atom/newly_seen_hud_atom as anything in get_hud_atoms_for_z_level(new_turf.z))
+ add_atom_to_single_mob_hud(moved_atom, newly_seen_hud_atom)
+
+ if(hud_atoms_all_z_levels[moved_atom])
+ hud_atoms[new_turf.z] |= moved_atom
+
+ for(var/mob/newly_seeing as anything in get_hud_users_for_z_level(new_turf.z))
+ add_atom_to_single_mob_hud(newly_seeing, moved_atom)
+
+/// add just hud_atom's hud images (that are part of this atom_hud) to requesting_mob's client.images list
+/datum/atom_hud/proc/add_atom_to_single_mob_hud(mob/requesting_mob, atom/hud_atom) //unsafe, no sanity apart from client
+ if(!requesting_mob || !requesting_mob.client || !hud_atom)
+ return
+
+ for(var/hud_category in (hud_icons & hud_atom.active_hud_list))
+ if(!hud_exceptions[requesting_mob] || !(hud_atom in hud_exceptions[requesting_mob]))
+ requesting_mob.client.images |= hud_atom.active_hud_list[hud_category]
+
+/// remove every hud image for this hud on atom_to_remove from client_mob's client.images list
+/datum/atom_hud/proc/remove_atom_from_single_hud(mob/client_mob, atom/atom_to_remove)
+ if(!client_mob || !client_mob.client || !atom_to_remove?.active_hud_list)
+ return
+ for(var/hud_image in hud_icons)
+ client_mob.client.images -= atom_to_remove.active_hud_list[hud_image]
+
+/datum/atom_hud/proc/unregister_atom(datum/source, force)
+ SIGNAL_HANDLER
+ hide_from(source, TRUE)
+ remove_atom_from_hud(source)
+
+/datum/atom_hud/proc/hide_single_atomhud_from(mob/hud_user, atom/hidden_atom)
+
+ if(hud_users_all_z_levels[hud_user])
+ remove_atom_from_single_hud(hud_user, hidden_atom)
+
if(!hud_exceptions[hud_user])
hud_exceptions[hud_user] = list(hidden_atom)
else
hud_exceptions[hud_user] += hidden_atom
-/datum/atom_hud/proc/unhide_single_atomhud_from(hud_user,hidden_atom)
+/datum/atom_hud/proc/unhide_single_atomhud_from(mob/hud_user, atom/hidden_atom)
hud_exceptions[hud_user] -= hidden_atom
- if(hudusers[hud_user])
- add_to_single_hud(hud_user,hidden_atom)
-/datum/atom_hud/proc/show_hud_images_after_cooldown(M)
- if(queued_to_see[M])
- queued_to_see -= M
- next_time_allowed[M] = world.time + ADD_HUD_TO_COOLDOWN
- for(var/atom/A in hudatoms)
- add_to_single_hud(M, A)
+ var/turf/hud_atom_turf = get_turf(hidden_atom)
-/datum/atom_hud/proc/add_to_hud(atom/A)
- if(!A)
- return FALSE
- hudatoms |= A
- for(var/mob/M in hudusers)
- if(!queued_to_see[M])
- add_to_single_hud(M, A)
- return TRUE
-
-/datum/atom_hud/proc/add_to_single_hud(mob/M, atom/A) //unsafe, no sanity apart from client
- if(!M || !M.client || !A)
+ if(!hud_atom_turf)
return
- for(var/i in hud_icons)
- if(A.hud_list[i] && (!hud_exceptions[M] || !(A in hud_exceptions[M])))
- M.client.images |= A.hud_list[i]
+
+ if(hud_users[hud_atom_turf.z][hud_user])
+ add_atom_to_single_mob_hud(hud_user, hidden_atom)
+
+/datum/atom_hud/proc/show_hud_images_after_cooldown(mob/queued_hud_user)
+ if(!queued_to_see[queued_hud_user])
+ return
+
+ queued_to_see -= queued_hud_user
+ next_time_allowed[queued_hud_user] = world.time + ADD_HUD_TO_COOLDOWN
+
+ var/turf/user_turf = get_turf(queued_hud_user)
+ if(!user_turf)
+ return
+
+ for(var/atom/hud_atom_to_show as anything in get_hud_atoms_for_z_level(user_turf.z))
+ add_atom_to_single_mob_hud(queued_hud_user, hud_atom_to_show)
//MOB PROCS
/mob/proc/reload_huds()
+ var/turf/our_turf = get_turf(src)
+ if(!our_turf)
+ return
+
for(var/datum/atom_hud/hud in GLOB.all_huds)
- if(hud?.hudusers[src])
- for(var/atom/A in hud.hudatoms)
- hud.add_to_single_hud(src, A)
+ if(hud?.hud_users_all_z_levels[src])
+ for(var/atom/hud_atom as anything in hud.get_hud_atoms_for_z_level(our_turf.z))
+ hud.add_atom_to_single_mob_hud(src, hud_atom)
/mob/dead/new_player/reload_huds()
return
diff --git a/code/datums/mind.dm b/code/datums/mind.dm
index 8a26ef8f2c8..4dcbe76c60a 100644
--- a/code/datums/mind.dm
+++ b/code/datums/mind.dm
@@ -52,11 +52,14 @@
var/static/default_martial_art = new/datum/martial_art
var/miming = FALSE // Mime's vow of silence
var/list/antag_datums
- var/antag_hud_icon_state = null //this mind's ANTAG_HUD should have this icon_state
- var/datum/atom_hud/alternate_appearance/basic/antagonist_hud/antag_hud = null //this mind's antag HUD
+ ///this mind's ANTAG_HUD should have this icon_state
+ var/antag_hud_icon_state = null
+ ///this mind's antag HUD
+ var/datum/atom_hud/alternate_appearance/basic/antagonist_hud/antag_hud = null
var/holy_role = NONE //is this person a chaplain or admin role allowed to use bibles, Any rank besides 'NONE' allows for this.
- var/mob/living/enslaved_to //If this mind's master is another mob (i.e. adamantine golems)
+ ///If this mind's master is another mob (i.e. adamantine golems)
+ var/mob/living/enslaved_to
var/datum/language_holder/language_holder
var/unconvertable = FALSE
var/late_joiner = FALSE
diff --git a/code/datums/quirks/good.dm b/code/datums/quirks/good.dm
index 1d5442a13ae..3ee2fb8b44f 100644
--- a/code/datums/quirks/good.dm
+++ b/code/datums/quirks/good.dm
@@ -76,7 +76,7 @@
/datum/quirk/item_quirk/clown_enjoyer/add()
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]
- fan.add_hud_to(quirk_holder)
+ fan.show_to(quirk_holder)
/datum/quirk/item_quirk/mime_fan
name = "Mime Fan"
@@ -93,7 +93,7 @@
/datum/quirk/item_quirk/mime_fan/add()
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]
- fan.add_hud_to(quirk_holder)
+ fan.show_to(quirk_holder)
/datum/quirk/freerunning
name = "Freerunning"
diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm
index 779101df682..2da87c9db53 100644
--- a/code/datums/status_effects/buffs.dm
+++ b/code/datums/status_effects/buffs.dm
@@ -237,15 +237,15 @@
//Makes the user passive, it's in their oath not to harm!
ADD_TRAIT(owner, TRAIT_PACIFISM, HIPPOCRATIC_OATH_TRAIT)
- var/datum/atom_hud/H = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
- H.add_hud_to(owner)
+ var/datum/atom_hud/med_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
+ med_hud.show_to(owner)
return ..()
/datum/status_effect/hippocratic_oath/on_remove()
QDEL_NULL(aura_healing)
REMOVE_TRAIT(owner, TRAIT_PACIFISM, HIPPOCRATIC_OATH_TRAIT)
- var/datum/atom_hud/H = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
- H.remove_hud_from(owner)
+ var/datum/atom_hud/med_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
+ med_hud.hide_from(owner)
/datum/status_effect/hippocratic_oath/get_examine_text()
return span_notice("[owner.p_they(TRUE)] seem[owner.p_s()] to have an aura of healing and helpfulness about [owner.p_them()].")
diff --git a/code/game/alternate_appearance.dm b/code/game/alternate_appearance.dm
index c5c8a72d477..f17315cdf26 100644
--- a/code/game/alternate_appearance.dm
+++ b/code/game/alternate_appearance.dm
@@ -5,7 +5,7 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
for(var/K in alternate_appearances)
var/datum/atom_hud/alternate_appearance/AA = alternate_appearances[K]
if(AA.appearance_key == key)
- AA.remove_from_hud(src)
+ AA.remove_atom_from_hud(src)
break
/atom/proc/add_alt_appearance(type, key, ...)
@@ -24,13 +24,16 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
var/transfer_overlays = FALSE
/datum/atom_hud/alternate_appearance/New(key)
- ..()
- GLOB.active_alternate_appearances += src
+ // We use hud_icons to register our hud, so we need to do this before the parent call
appearance_key = key
+ hud_icons = list(appearance_key)
+ ..()
+
+ GLOB.active_alternate_appearances += src
for(var/mob in GLOB.player_list)
if(mobShouldSee(mob))
- add_hud_to(mob)
+ show_to(mob)
/datum/atom_hud/alternate_appearance/Destroy()
GLOB.active_alternate_appearances -= src
@@ -38,18 +41,18 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
/datum/atom_hud/alternate_appearance/proc/onNewMob(mob/M)
if(mobShouldSee(M))
- add_hud_to(M)
+ show_to(M)
/datum/atom_hud/alternate_appearance/proc/mobShouldSee(mob/M)
return FALSE
-/datum/atom_hud/alternate_appearance/add_to_hud(atom/A, image/I)
+/datum/atom_hud/alternate_appearance/add_atom_to_hud(atom/A, image/I)
. = ..()
if(.)
LAZYINITLIST(A.alternate_appearances)
A.alternate_appearances[appearance_key] = src
-/datum/atom_hud/alternate_appearance/remove_from_hud(atom/A)
+/datum/atom_hud/alternate_appearance/remove_atom_from_hud(atom/A)
. = ..()
if(.)
LAZYREMOVE(A.alternate_appearances, appearance_key)
@@ -63,6 +66,7 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
var/image/image
var/add_ghost_version = FALSE
var/ghost_appearance
+ uses_global_hud_category = FALSE
/datum/atom_hud/alternate_appearance/basic/New(key, image/I, options = AA_TARGET_SEE_APPEARANCE)
..()
@@ -72,10 +76,11 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
if(transfer_overlays)
I.copy_overlays(target)
- hud_icons = list(appearance_key)
- add_to_hud(target, I)
+ add_atom_to_hud(target)
+ target.set_hud_image_active(appearance_key, exclusive_hud = src)
+
if((options & AA_TARGET_SEE_APPEARANCE) && ismob(target))
- add_hud_to(target)
+ show_to(target)
if(add_ghost_version)
var/image/ghost_image = image(icon = I.icon , icon_state = I.icon_state, loc = I.loc)
ghost_image.override = FALSE
@@ -89,14 +94,15 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
if(ghost_appearance)
QDEL_NULL(ghost_appearance)
-/datum/atom_hud/alternate_appearance/basic/add_to_hud(atom/A)
+/datum/atom_hud/alternate_appearance/basic/add_atom_to_hud(atom/A)
LAZYINITLIST(A.hud_list)
A.hud_list[appearance_key] = image
. = ..()
-/datum/atom_hud/alternate_appearance/basic/remove_from_hud(atom/A)
+/datum/atom_hud/alternate_appearance/basic/remove_atom_from_hud(atom/A)
. = ..()
A.hud_list -= appearance_key
+ A.set_hud_image_inactive(appearance_key)
if(. && !QDELETED(src))
qdel(src)
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index ef716bdc2d9..41d6e9fc8cb 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -30,8 +30,12 @@
///Reagents holder
var/datum/reagents/reagents = null
- ///This atom's HUD (med/sec, etc) images. Associative list.
+ ///all of this atom's HUD (med/sec, etc) images. Associative list of the form: list(hud category = hud image or images for that category).
+ ///most of the time hud category is associated with a single image, sometimes its associated with a list of images.
+ ///not every hud in this list is actually used. for ones available for others to see, look at active_hud_list.
var/list/image/hud_list = null
+ ///all of this atom's HUD images which can actually be seen by players with that hud
+ var/list/image/active_hud_list = null
///HUD images that this atom can provide.
var/list/hud_possible
@@ -300,7 +304,7 @@
if(alternate_appearances)
for(var/current_alternate_appearance in alternate_appearances)
var/datum/atom_hud/alternate_appearance/selected_alternate_appearance = alternate_appearances[current_alternate_appearance]
- selected_alternate_appearance.remove_from_hud(src)
+ selected_alternate_appearance.remove_atom_from_hud(src)
if(reagents)
QDEL_NULL(reagents)
diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm
index 79ddce1ff12..3c2e3e437c6 100644
--- a/code/game/atoms_movable.dm
+++ b/code/game/atoms_movable.dm
@@ -842,7 +842,7 @@
var/turf/our_turf = get_turf(src)
if(our_turf && SSspatial_grid.initialized)
- SSspatial_grid.exit_cell(src, our_turf, RECURSIVE_CONTENTS_CLIENT_MOBS)
+ SSspatial_grid.remove_single_contents_type(src, our_turf, RECURSIVE_CONTENTS_CLIENT_MOBS)
else if(our_turf && !SSspatial_grid.initialized)
SSspatial_grid.remove_from_pre_init_queue(src, RECURSIVE_CONTENTS_CLIENT_MOBS)
diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm
index 89dbe87a976..72a2003eb04 100644
--- a/code/game/data_huds.dm
+++ b/code/game/data_huds.dm
@@ -9,11 +9,11 @@
/atom/proc/add_to_all_human_data_huds()
for(var/datum/atom_hud/data/human/hud in GLOB.huds)
- hud.add_to_hud(src)
+ hud.add_atom_to_hud(src)
/atom/proc/remove_from_all_data_huds()
for(var/datum/atom_hud/data/hud in GLOB.huds)
- hud.remove_from_hud(src)
+ hud.remove_atom_from_hud(src)
/datum/atom_hud/data
@@ -32,12 +32,12 @@
return FALSE
return TRUE
-/datum/atom_hud/data/human/medical/basic/add_to_single_hud(mob/M, mob/living/carbon/H)
+/datum/atom_hud/data/human/medical/basic/add_atom_to_single_mob_hud(mob/M, mob/living/carbon/H)
if(check_sensors(H))
..()
/datum/atom_hud/data/human/medical/basic/proc/update_suit_sensors(mob/living/carbon/H)
- check_sensors(H) ? add_to_hud(H) : remove_from_hud(H)
+ check_sensors(H) ? add_atom_to_hud(H) : remove_atom_from_hud(H)
/datum/atom_hud/data/human/medical/advanced
@@ -61,6 +61,8 @@
hud_icons = list(DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD, DIAG_CIRCUIT_HUD, DIAG_TRACK_HUD, DIAG_AIRLOCK_HUD, DIAG_LAUNCHPAD_HUD, DIAG_PATH_HUD)
/datum/atom_hud/data/bot_path
+ // This hud exists so the bot can see itself, that's all
+ uses_global_hud_category = FALSE
hud_icons = list(DIAG_PATH_HUD)
/datum/atom_hud/abductor
@@ -72,12 +74,12 @@
/datum/atom_hud/ai_detector
hud_icons = list(AI_DETECT_HUD)
-/datum/atom_hud/ai_detector/add_hud_to(mob/M)
+/datum/atom_hud/ai_detector/show_to(mob/new_viewer)
..()
- if(M && (hudusers.len == 1))
- for(var/V in GLOB.aiEyes)
- var/mob/camera/ai_eye/E = V
- E.update_ai_detect_hud()
+ if(!new_viewer || hud_users.len != 1)
+ return
+ for(var/mob/camera/ai_eye/eye as anything in GLOB.aiEyes)
+ eye.update_ai_detect_hud()
/* MED/SEC/DIAG HUD HOOKS */
@@ -229,11 +231,19 @@ FAN HUDs! For identifying other fans on-sight.
holder.pixel_y = I.Height() - world.icon_size
holder.icon_state = "hudfan_no"
var/obj/item/clothing/under/U = get_item_by_slot(ITEM_SLOT_ICLOTHING)
- if(U)
- if(istype(U.attached_accessory, /obj/item/clothing/accessory/mime_fan_pin))
- holder.icon_state = "mime_fan_pin"
- else if(istype(U.attached_accessory, /obj/item/clothing/accessory/clown_enjoyer_pin))
- holder.icon_state = "clown_enjoyer_pin"
+ if(!U)
+ set_hud_image_inactive(FAN_HUD)
+ return
+
+ if(istype(U.attached_accessory, /obj/item/clothing/accessory/mime_fan_pin))
+ holder.icon_state = "mime_fan_pin"
+
+ else if(istype(U.attached_accessory, /obj/item/clothing/accessory/clown_enjoyer_pin))
+ holder.icon_state = "clown_enjoyer_pin"
+ set_hud_image_active(FAN_HUD)
+ return
+
+
/***********************************************
Security HUDs! Basic mode shows only the job.
@@ -256,22 +266,29 @@ Security HUDs! Basic mode shows only the job.
for(var/i in list(IMPTRACK_HUD, IMPLOYAL_HUD, IMPCHEM_HUD))
holder = hud_list[i]
holder.icon_state = null
+ set_hud_image_inactive(i)
+
for(var/obj/item/implant/I in implants)
if(istype(I, /obj/item/implant/tracking))
holder = hud_list[IMPTRACK_HUD]
var/icon/IC = icon(icon, icon_state, dir)
holder.pixel_y = IC.Height() - world.icon_size
holder.icon_state = "hud_imp_tracking"
+ set_hud_image_active(IMPTRACK_HUD)
+
else if(istype(I, /obj/item/implant/chem))
holder = hud_list[IMPCHEM_HUD]
var/icon/IC = icon(icon, icon_state, dir)
holder.pixel_y = IC.Height() - world.icon_size
holder.icon_state = "hud_imp_chem"
+ set_hud_image_active(IMPCHEM_HUD)
+
if(HAS_TRAIT(src, TRAIT_MINDSHIELD))
holder = hud_list[IMPLOYAL_HUD]
var/icon/IC = icon(icon, icon_state, dir)
holder.pixel_y = IC.Height() - world.icon_size
holder.icon_state = "hud_imp_loyal"
+ set_hud_image_active(IMPLOYAL_HUD)
/mob/living/carbon/human/proc/sec_hud_set_security_status()
var/image/holder = hud_list[WANTED_HUD]
@@ -281,23 +298,26 @@ Security HUDs! Basic mode shows only the job.
if(perpname && GLOB.data_core)
var/datum/data/record/R = find_record("name", perpname, GLOB.data_core.security)
if(R)
+ var/has_criminal_entry = TRUE
switch(R.fields["criminal"])
if("*Arrest*")
holder.icon_state = "hudwanted"
- return
if("Incarcerated")
holder.icon_state = "hudincarcerated"
- return
if("Suspected")
holder.icon_state = "hudsuspected"
- return
if("Paroled")
holder.icon_state = "hudparolled"
- return
if("Discharged")
holder.icon_state = "huddischarged"
- return
+ else
+ has_criminal_entry = FALSE
+ if(has_criminal_entry)
+ set_hud_image_active(WANTED_HUD)
+ return
+
holder.icon_state = null
+ set_hud_image_inactive(WANTED_HUD)
/***********************************************
Diagnostic HUDs!
@@ -361,10 +381,13 @@ Diagnostic HUDs!
holder.pixel_y = I.Height() - world.icon_size
if(!shell) //Not an AI shell
holder.icon_state = null
+ set_hud_image_inactive(DIAG_TRACK_HUD)
+ return
else if(deployed) //AI shell in use by an AI
holder.icon_state = "hudtrackingai"
else //Empty AI shell
holder.icon_state = "hudtracking"
+ set_hud_image_active(DIAG_TRACK_HUD)
//AI side tracking of AI shell control
/mob/living/silicon/ai/proc/diag_hud_set_deployed() //Shows tracking beacons on the mech
@@ -373,8 +396,10 @@ Diagnostic HUDs!
holder.pixel_y = I.Height() - world.icon_size
if(!deployed_shell)
holder.icon_state = null
+ set_hud_image_inactive(DIAG_TRACK_HUD)
else //AI is currently controlling a shell
holder.icon_state = "hudtrackingai"
+ set_hud_image_active(DIAG_TRACK_HUD)
/*~~~~~~~~~~~~~~~~~~~~
BIG STOMPY MECHS
@@ -401,11 +426,14 @@ Diagnostic HUDs!
var/image/holder = hud_list[DIAG_STAT_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
- holder.icon_state = null
if(internal_damage)
holder.icon_state = "hudwarn"
+ set_hud_image_active(DIAG_STAT_HUD)
+ holder.icon_state = null
+ set_hud_image_inactive(DIAG_STAT_HUD)
-/obj/vehicle/sealed/mecha/proc/diag_hud_set_mechtracking() //Shows tracking beacons on the mech
+///Shows tracking beacons on the mech
+/obj/vehicle/sealed/mecha/proc/diag_hud_set_mechtracking()
var/image/holder = hud_list[DIAG_TRACK_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
@@ -474,8 +502,10 @@ Diagnostic HUDs!
Airlocks!
~~~~~~~~~~~~~*/
/obj/machinery/door/airlock/proc/diag_hud_set_electrified()
+ if(secondsElectrified == MACHINE_NOT_ELECTRIFIED)
+ set_hud_image_inactive(DIAG_AIRLOCK_HUD)
+ return
+
var/image/holder = hud_list[DIAG_AIRLOCK_HUD]
- if(secondsElectrified != MACHINE_NOT_ELECTRIFIED)
- holder.icon_state = "electrified"
- else
- holder.icon_state = ""
+ holder.icon_state = "electrified"
+ set_hud_image_active(DIAG_AIRLOCK_HUD)
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index ab3b34c3e8e..6a7867c56a7 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -161,9 +161,11 @@
max_integrity = normal_integrity
if(damage_deflection == AIRLOCK_DAMAGE_DEFLECTION_N && security_level > AIRLOCK_SECURITY_IRON)
damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_R
+
prepare_huds()
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
- diag_hud.add_to_hud(src)
+ diag_hud.add_atom_to_hud(src)
+
diag_hud_set_electrified()
RegisterSignal(src, COMSIG_MACHINERY_BROKEN, .proc/on_break)
@@ -333,7 +335,7 @@
QDEL_NULL(note)
QDEL_NULL(seal)
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
- diag_hud.remove_from_hud(src)
+ diag_hud.remove_atom_from_hud(src)
return ..()
/obj/machinery/door/airlock/handle_atom_del(atom/A)
diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm
index a849f8f940b..4ed00adb32f 100644
--- a/code/game/machinery/launch_pad.dm
+++ b/code/game/machinery/launch_pad.dm
@@ -35,7 +35,7 @@
. = ..()
prepare_huds()
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
- diag_hud.add_to_hud(src)
+ diag_hud.add_atom_to_hud(src)
var/image/holder = hud_list[DIAG_LAUNCHPAD_HUD]
var/mutable_appearance/MA = new /mutable_appearance()
@@ -49,7 +49,7 @@
/obj/machinery/launchpad/Destroy()
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
- diag_hud.remove_from_hud(src)
+ diag_hud.remove_atom_from_hud(src)
return ..()
/obj/machinery/launchpad/examine(mob/user)
diff --git a/code/game/objects/items/devices/multitool.dm b/code/game/objects/items/devices/multitool.dm
index 275fd593b76..1d7c35cc1c6 100644
--- a/code/game/objects/items/devices/multitool.dm
+++ b/code/game/objects/items/devices/multitool.dm
@@ -106,8 +106,8 @@
var/atom/movable/screen/plane_master/camera_static/ai_detect_plane = user.hud_used.plane_masters["[CAMERA_STATIC_PLANE]"]
ai_detect_plane.alpha = 64
var/datum/atom_hud/hud = GLOB.huds[hud_type]
- if(!hud.hudusers[user])
- hud.add_hud_to(user)
+ if(!hud.hud_users[user])
+ hud.show_to(user)
eye.eye_user = user
eye.setLoc(get_turf(src))
@@ -116,7 +116,7 @@
var/atom/movable/screen/plane_master/camera_static/ai_detect_plane = user.hud_used.plane_masters["[CAMERA_STATIC_PLANE]"]
ai_detect_plane.alpha = 255
var/datum/atom_hud/hud = GLOB.huds[hud_type]
- hud.remove_hud_from(user)
+ hud.hide_from(user)
if(eye)
eye.setLoc(null)
eye.eye_user = null
diff --git a/code/modules/admin/verbs/admingame.dm b/code/modules/admin/verbs/admingame.dm
index df3aacbee49..302b4fd81e1 100644
--- a/code/modules/admin/verbs/admingame.dm
+++ b/code/modules/admin/verbs/admingame.dm
@@ -385,10 +385,10 @@ Traitors and the like can also be revived with the previous role mostly intact.
for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED))
var/datum/atom_hud/atom_hud = GLOB.huds[hudtype]
- atom_hud.add_hud_to(mob)
+ atom_hud.show_to(mob)
for (var/datum/atom_hud/alternate_appearance/basic/antagonist_hud/antag_hud in GLOB.active_alternate_appearances)
- antag_hud.add_hud_to(mob)
+ antag_hud.show_to(mob)
mob.lighting_alpha = mob.default_lighting_alpha()
mob.update_sight()
@@ -401,10 +401,10 @@ Traitors and the like can also be revived with the previous role mostly intact.
for (var/hudtype in list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED))
var/datum/atom_hud/atom_hud = GLOB.huds[hudtype]
- atom_hud.remove_hud_from(mob)
+ atom_hud.hide_from(mob)
for (var/datum/atom_hud/alternate_appearance/basic/antagonist_hud/antag_hud in GLOB.active_alternate_appearances)
- antag_hud.remove_hud_from(mob)
+ antag_hud.hide_from(mob)
mob.lighting_alpha = mob.default_lighting_alpha()
mob.update_sight()
diff --git a/code/modules/antagonists/_common/antag_datum.dm b/code/modules/antagonists/_common/antag_datum.dm
index 8a04dda49f8..0e0e0afaad4 100644
--- a/code/modules/antagonists/_common/antag_datum.dm
+++ b/code/modules/antagonists/_common/antag_datum.dm
@@ -220,7 +220,7 @@ GLOBAL_LIST_EMPTY(antagonists)
var/mob/living/current = owner.current
for (var/datum/atom_hud/alternate_appearance/basic/has_antagonist/antag_hud as anything in GLOB.has_antagonist_huds)
if (!antag_hud.mobShouldSee(current))
- antag_hud.remove_hud_from(current)
+ antag_hud.hide_from(current)
qdel(src)
@@ -424,7 +424,7 @@ GLOBAL_LIST_EMPTY(antagonists)
// Add HUDs that they couldn't see before
for (var/datum/atom_hud/alternate_appearance/basic/has_antagonist/antag_hud as anything in GLOB.has_antagonist_huds)
if (antag_hud.mobShouldSee(owner.current))
- antag_hud.add_hud_to(owner.current)
+ antag_hud.show_to(owner.current)
//This one is created by admin tools for custom objectives
/datum/antagonist/custom
diff --git a/code/modules/antagonists/abductor/equipment/gland.dm b/code/modules/antagonists/abductor/equipment/gland.dm
index a9bc69343f6..0b775e77a5e 100644
--- a/code/modules/antagonists/abductor/equipment/gland.dm
+++ b/code/modules/antagonists/abductor/equipment/gland.dm
@@ -85,7 +85,7 @@
if(initial(uses) == 1)
uses = initial(uses)
var/datum/atom_hud/abductor/hud = GLOB.huds[DATA_HUD_ABDUCTOR]
- hud.remove_from_hud(owner)
+ hud.remove_atom_from_hud(owner)
clear_mind_control()
..()
@@ -94,7 +94,7 @@
if(special != 2 && uses) // Special 2 means abductor surgery
Start()
var/datum/atom_hud/abductor/hud = GLOB.huds[DATA_HUD_ABDUCTOR]
- hud.add_to_hud(owner)
+ hud.add_atom_to_hud(owner)
update_gland_hud()
/obj/item/organ/heart/gland/on_life(delta_time, times_fired)
diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm
index e04f47e3eaa..4095dc27ce9 100644
--- a/code/modules/antagonists/blob/structures/_blob.dm
+++ b/code/modules/antagonists/blob/structures/_blob.dm
@@ -317,7 +317,7 @@
/obj/structure/blob/examine(mob/user)
. = ..()
var/datum/atom_hud/hud_to_check = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
- if(HAS_TRAIT(user, TRAIT_RESEARCH_SCANNER) || hud_to_check.hudusers[user])
+ if(HAS_TRAIT(user, TRAIT_RESEARCH_SCANNER) || hud_to_check.hud_users[user])
. += "Your HUD displays an extensive report...
"
if(overmind)
. += overmind.blobstrain.examine(user)
diff --git a/code/modules/antagonists/cult/runes.dm b/code/modules/antagonists/cult/runes.dm
index 1ebd987a682..c3a46f597bc 100644
--- a/code/modules/antagonists/cult/runes.dm
+++ b/code/modules/antagonists/cult/runes.dm
@@ -925,6 +925,7 @@ structure_check() searches for nearby cultist structures required for the invoca
if(rune_in_use)
return
. = ..()
+
var/area/place = get_area(src)
var/mob/living/user = invokers[1]
var/datum/antagonist/cult/user_antag = user.mind.has_antag_datum(/datum/antagonist/cult,TRUE)
@@ -935,8 +936,10 @@ structure_check() searches for nearby cultist structures required for the invoca
if(!(place in summon_objective.summon_spots))
to_chat(user, span_cultlarge("The Apocalypse rune will remove a ritual site, where Nar'Sie can be summoned, it can only be scribed in [english_list(summon_objective.summon_spots)]!"))
return
+
summon_objective.summon_spots -= place
rune_in_use = TRUE
+
var/turf/T = get_turf(src)
new /obj/effect/temp_visual/dir_setting/curse/grasp_portal/fading(T)
var/intensity = 0
@@ -945,20 +948,23 @@ structure_check() searches for nearby cultist structures required for the invoca
intensity++
intensity = max(60, 360 - (360*(intensity/length(GLOB.player_list) + 0.3)**2)) //significantly lower intensity for "winning" cults
var/duration = intensity*10
+
playsound(T, 'sound/magic/enter_blood.ogg', 100, TRUE)
visible_message(span_warning("A colossal shockwave of energy bursts from the rune, disintegrating it in the process!"))
+
for(var/mob/living/target in range(src, 3))
target.Paralyze(30)
empulse(T, 0.42*(intensity), 1)
+
var/list/images = list()
var/zmatch = T.z
- var/datum/atom_hud/AH = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
+ var/datum/atom_hud/sec_hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
for(var/mob/living/M in GLOB.alive_mob_list)
if(M.z != zmatch)
continue
if(ishuman(M))
if(!IS_CULTIST(M))
- AH.remove_hud_from(M)
+ sec_hud.hide_from(M)
addtimer(CALLBACK(GLOBAL_PROC, .proc/hudFix, M), duration)
var/image/A = image('icons/mob/cult.dmi',M,"cultist", ABOVE_MOB_LAYER)
A.override = 1
@@ -1050,5 +1056,5 @@ structure_check() searches for nearby cultist structures required for the invoca
return
var/obj/O = target.get_item_by_slot(ITEM_SLOT_EYES)
if(istype(O, /obj/item/clothing/glasses/hud/security))
- var/datum/atom_hud/AH = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
- AH.add_hud_to(target)
+ var/datum/atom_hud/sec_hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
+ sec_hud.show_to(target)
diff --git a/code/modules/antagonists/disease/disease_mob.dm b/code/modules/antagonists/disease/disease_mob.dm
index 60410a9fcc4..3db4bf3a26c 100644
--- a/code/modules/antagonists/disease/disease_mob.dm
+++ b/code/modules/antagonists/disease/disease_mob.dm
@@ -66,7 +66,7 @@ the new instance inside the host to be updated to the template's stats.
SSdisease.archive_diseases[disease_template.GetDiseaseID()] = disease_template //important for stuff that uses disease IDs
var/datum/atom_hud/my_hud = GLOB.huds[DATA_HUD_SENTIENT_DISEASE]
- my_hud.add_hud_to(src)
+ my_hud.show_to(src)
browser = new /datum/browser(src, "disease_menu", "Adaptation Menu", 1000, 770, src)
@@ -163,7 +163,7 @@ the new instance inside the host to be updated to the template's stats.
if(!mind.has_antag_datum(/datum/antagonist/disease))
mind.add_antag_datum(/datum/antagonist/disease)
var/datum/atom_hud/medsensor = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
- medsensor.add_hud_to(src)
+ medsensor.show_to(src)
/mob/camera/disease/proc/pick_name()
var/static/list/taken_names
@@ -255,7 +255,7 @@ the new instance inside the host to be updated to the template's stats.
MA.alpha = 200
holder.appearance = MA
var/datum/atom_hud/my_hud = GLOB.huds[DATA_HUD_SENTIENT_DISEASE]
- my_hud.add_to_hud(V.affected_mob)
+ my_hud.add_atom_to_hud(V.affected_mob)
to_chat(src, span_notice("A new host, [V.affected_mob.real_name], has been infected."))
@@ -271,7 +271,7 @@ the new instance inside the host to be updated to the template's stats.
to_chat(src, span_notice("One of your hosts, [V.affected_mob.real_name], has been purged of your infection."))
var/datum/atom_hud/my_hud = GLOB.huds[DATA_HUD_SENTIENT_DISEASE]
- my_hud.remove_from_hud(V.affected_mob)
+ my_hud.remove_atom_from_hud(V.affected_mob)
if(following_host == V.affected_mob)
follow_next()
diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm
index 10759536c12..cd305baaaeb 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -57,8 +57,8 @@
///The bitflag that's being checked on ventcrawling. Default is to allow ventcrawling and seeing pipes.
var/vent_movement = VENTCRAWL_ALLOWED | VENTCRAWL_CAN_SEE
-
- ///keeps the name of the object from being overridden if it's vareditted.
+
+ ///keeps the name of the object from being overridden if it's vareditted.
var/override_naming
/obj/machinery/atmospherics/LateInitialize()
@@ -89,7 +89,7 @@
/obj/machinery/atmospherics/Initialize(mapload)
if(mapload && name != initial(name))
override_naming = TRUE
- return ..()
+ return ..()
/obj/machinery/atmospherics/Destroy()
for(var/i in 1 to device_type)
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 7f607f7da9a..db159537b3e 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -1125,7 +1125,6 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
holder.filteriffic = new /datum/filter_editor(in_atom)
holder.filteriffic.ui_interact(mob)
-
/client/proc/set_right_click_menu_mode(shift_only)
if(shift_only)
winset(src, "mapwindow.map", "right-click=true")
diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm
index 9afebfa4371..7cb20ce0140 100644
--- a/code/modules/clothing/glasses/_glasses.dm
+++ b/code/modules/clothing/glasses/_glasses.dm
@@ -557,8 +557,8 @@
return
if(ishuman(user))
for(var/hud in hudlist)
- var/datum/atom_hud/H = GLOB.huds[hud]
- H.add_hud_to(user)
+ var/datum/atom_hud/our_hud = GLOB.huds[hud]
+ our_hud.show_to(user)
ADD_TRAIT(user, TRAIT_MEDICAL_HUD, GLASSES_TRAIT)
ADD_TRAIT(user, TRAIT_SECURITY_HUD, GLASSES_TRAIT)
if(xray)
@@ -571,8 +571,8 @@
REMOVE_TRAIT(user, TRAIT_XRAY_VISION, GLASSES_TRAIT)
if(ishuman(user))
for(var/hud in hudlist)
- var/datum/atom_hud/H = GLOB.huds[hud]
- H.remove_hud_from(user)
+ var/datum/atom_hud/our_hud = GLOB.huds[hud]
+ our_hud.hide_from(user)
/obj/item/clothing/glasses/debug/AltClick(mob/user)
. = ..()
diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm
index 76b1a2a9ed9..997903cfc1e 100644
--- a/code/modules/clothing/glasses/hud.dm
+++ b/code/modules/clothing/glasses/hud.dm
@@ -12,8 +12,8 @@
if(slot != ITEM_SLOT_EYES)
return
if(hud_type)
- var/datum/atom_hud/H = GLOB.huds[hud_type]
- H.add_hud_to(user)
+ var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
+ our_hud.show_to(user)
if(hud_trait)
ADD_TRAIT(user, hud_trait, GLASSES_TRAIT)
@@ -22,8 +22,8 @@
if(!istype(user) || user.glasses != src)
return
if(hud_type)
- var/datum/atom_hud/H = GLOB.huds[hud_type]
- H.remove_hud_from(user)
+ var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
+ our_hud.hide_from(user)
if(hud_trait)
REMOVE_TRAIT(user, hud_trait, GLASSES_TRAIT)
@@ -197,8 +197,8 @@
return
if (hud_type)
- var/datum/atom_hud/H = GLOB.huds[hud_type]
- H.remove_hud_from(user)
+ var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
+ our_hud.hide_from(user)
if (hud_type == DATA_HUD_MEDICAL_ADVANCED)
hud_type = null
@@ -208,8 +208,8 @@
hud_type = DATA_HUD_SECURITY_ADVANCED
if (hud_type)
- var/datum/atom_hud/H = GLOB.huds[hud_type]
- H.add_hud_to(user)
+ var/datum/atom_hud/our_hud = GLOB.huds[hud_type]
+ our_hud.show_to(user)
/obj/item/clothing/glasses/hud/toggle/thermal
name = "thermal HUD scanner"
diff --git a/code/modules/clothing/masks/boxing.dm b/code/modules/clothing/masks/boxing.dm
index 9fc65822837..4a26f68b4ce 100644
--- a/code/modules/clothing/masks/boxing.dm
+++ b/code/modules/clothing/masks/boxing.dm
@@ -31,15 +31,15 @@
return
to_chat(user, "You roll the balaclava over your face, and a data display appears before your eyes.")
ADD_TRAIT(user, TRAIT_DIAGNOSTIC_HUD, MASK_TRAIT)
- var/datum/atom_hud/H = GLOB.huds[DATA_HUD_DIAGNOSTIC_BASIC]
- H.add_hud_to(user)
+ var/datum/atom_hud/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC_BASIC]
+ diag_hud.show_to(user)
voice_unknown = TRUE
/obj/item/clothing/mask/infiltrator/dropped(mob/living/carbon/human/user)
to_chat(user, "You pull off the balaclava, and the mask's internal hud system switches off quietly.")
REMOVE_TRAIT(user, TRAIT_DIAGNOSTIC_HUD, MASK_TRAIT)
- var/datum/atom_hud/H = GLOB.huds[DATA_HUD_DIAGNOSTIC_BASIC]
- H.remove_hud_from(user)
+ var/datum/atom_hud/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC_BASIC]
+ diag_hud.hide_from(user)
voice_unknown = FALSE
return ..()
diff --git a/code/modules/clothing/suits/ablativecoat.dm b/code/modules/clothing/suits/ablativecoat.dm
index 38a396105c0..614878d47dd 100644
--- a/code/modules/clothing/suits/ablativecoat.dm
+++ b/code/modules/clothing/suits/ablativecoat.dm
@@ -40,7 +40,7 @@
var/mob/living/carbon/user = loc
var/datum/atom_hud/hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
ADD_TRAIT(user, TRAIT_SECURITY_HUD, HELMET_TRAIT)
- hud.add_hud_to(user)
+ hud.show_to(user)
balloon_alert(user, "you put on the hood, and enable the hud")
return ..()
@@ -48,8 +48,8 @@
if (!hood_up)
return ..()
var/mob/living/carbon/user = loc
- var/datum/atom_hud/hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
+ var/datum/atom_hud/sec_hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
REMOVE_TRAIT(user, TRAIT_SECURITY_HUD, HELMET_TRAIT)
- hud.remove_hud_from(user)
+ sec_hud.hide_from(user)
balloon_alert(user, "you take off the hood, and disable the hud")
return ..()
diff --git a/code/modules/jobs/job_types/clown.dm b/code/modules/jobs/job_types/clown.dm
index 50dea0c6593..88b077123e0 100644
--- a/code/modules/jobs/job_types/clown.dm
+++ b/code/modules/jobs/job_types/clown.dm
@@ -96,4 +96,4 @@
for(var/datum/mutation/human/clumsy/M in H.dna.mutations)
M.mutadone_proof = TRUE
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]
- fan.add_hud_to(H)
+ fan.show_to(H)
diff --git a/code/modules/jobs/job_types/mime.dm b/code/modules/jobs/job_types/mime.dm
index 19c0f066e9e..80e0e968b60 100644
--- a/code/modules/jobs/job_types/mime.dm
+++ b/code/modules/jobs/job_types/mime.dm
@@ -77,7 +77,7 @@
H.mind.miming = TRUE
var/datum/atom_hud/fan = GLOB.huds[DATA_HUD_FAN]
- fan.add_hud_to(H)
+ fan.show_to(H)
/obj/item/book/mimery
name = "Guide to Dank Mimery"
diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm
index 5fbcef0e713..e82c1d16cc2 100644
--- a/code/modules/mob/dead/observer/observer.dm
+++ b/code/modules/mob/dead/observer/observer.dm
@@ -734,13 +734,13 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/proc/show_data_huds()
for(var/hudtype in datahuds)
- var/datum/atom_hud/H = GLOB.huds[hudtype]
- H.add_hud_to(src)
+ var/datum/atom_hud/data_hud = GLOB.huds[hudtype]
+ data_hud.show_to(src)
/mob/dead/observer/proc/remove_data_huds()
for(var/hudtype in datahuds)
- var/datum/atom_hud/H = GLOB.huds[hudtype]
- H.remove_hud_from(src)
+ var/datum/atom_hud/data_hud = GLOB.huds[hudtype]
+ data_hud.hide_from(src)
/mob/dead/observer/verb/toggle_data_huds()
set name = "Toggle Sec/Med/Diag HUD"
diff --git a/code/modules/mob/living/carbon/human/species_types/abductors.dm b/code/modules/mob/living/carbon/human/species_types/abductors.dm
index a248ce1e338..c2519002f91 100644
--- a/code/modules/mob/living/carbon/human/species_types/abductors.dm
+++ b/code/modules/mob/living/carbon/human/species_types/abductors.dm
@@ -28,11 +28,11 @@
/datum/species/abductor/on_species_gain(mob/living/carbon/C, datum/species/old_species)
. = ..()
var/datum/atom_hud/abductor_hud = GLOB.huds[DATA_HUD_ABDUCTOR]
- abductor_hud.add_hud_to(C)
+ abductor_hud.show_to(C)
C.set_safe_hunger_level()
/datum/species/abductor/on_species_loss(mob/living/carbon/C)
. = ..()
var/datum/atom_hud/abductor_hud = GLOB.huds[DATA_HUD_ABDUCTOR]
- abductor_hud.remove_hud_from(C)
+ abductor_hud.hide_from(C)
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 4db2b4f3774..ec5a6deb475 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -4,9 +4,9 @@
if(unique_name)
set_name()
var/datum/atom_hud/data/human/medical/advanced/medhud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
- medhud.add_to_hud(src)
+ medhud.add_atom_to_hud(src)
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
- diag_hud.add_to_hud(src)
+ diag_hud.add_atom_to_hud(src)
faction += "[REF(src)]"
GLOB.mob_living_list += src
SSpoints_of_interest.make_point_of_interest(src)
diff --git a/code/modules/mob/living/silicon/ai/freelook/eye.dm b/code/modules/mob/living/silicon/ai/freelook/eye.dm
index 8aadc3f9493..ae8c3e3cc61 100644
--- a/code/modules/mob/living/silicon/ai/freelook/eye.dm
+++ b/code/modules/mob/living/silicon/ai/freelook/eye.dm
@@ -35,14 +35,14 @@
var/datum/atom_hud/ai_detector/hud = GLOB.huds[DATA_HUD_AI_DETECT]
var/list/old_images = hud_list[AI_DETECT_HUD]
if(!ai_detector_visible)
- hud.remove_from_hud(src)
+ hud.remove_atom_from_hud(src)
QDEL_LIST(old_images)
return
- if(!length(hud.hudusers))
+ if(!length(hud.hud_users))
return //no one is watching, do not bother updating anything
- hud.remove_from_hud(src)
+ hud.remove_atom_from_hud(src)
var/static/list/vis_contents_opaque = list()
var/obj/effect/overlay/ai_detect_hud/hud_obj = vis_contents_opaque[ai_detector_color]
@@ -61,7 +61,7 @@
for(var/i in (new_images.len + 1) to old_images.len)
qdel(old_images[i])
hud_list[AI_DETECT_HUD] = new_images
- hud.add_to_hud(src)
+ hud.add_atom_to_hud(src)
/mob/camera/ai_eye/proc/get_visible_turfs()
if(!isturf(loc))
@@ -124,7 +124,7 @@
GLOB.aiEyes -= src
if(ai_detector_visible)
var/datum/atom_hud/ai_detector/hud = GLOB.huds[DATA_HUD_AI_DETECT]
- hud.remove_from_hud(src)
+ hud.remove_atom_from_hud(src)
var/list/L = hud_list[AI_DETECT_HUD]
QDEL_LIST(L)
return ..()
diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm
index 63a6ee684ac..ade5e41efd0 100644
--- a/code/modules/mob/living/silicon/pai/software.dm
+++ b/code/modules/mob/living/silicon/pai/software.dm
@@ -119,10 +119,10 @@
medHUD = !medHUD
if(medHUD)
var/datum/atom_hud/med = GLOB.huds[med_hud]
- med.add_hud_to(src)
+ med.show_to(src)
else
var/datum/atom_hud/med = GLOB.huds[med_hud]
- med.remove_hud_from(src)
+ med.hide_from(src)
if("newscaster")
newscaster.ui_interact(src)
if("photography_module")
@@ -147,10 +147,10 @@
secHUD = !secHUD
if(secHUD)
var/datum/atom_hud/sec = GLOB.huds[sec_hud]
- sec.add_hud_to(src)
+ sec.show_to(src)
else
var/datum/atom_hud/sec = GLOB.huds[sec_hud]
- sec.remove_hud_from(src)
+ sec.hide_from(src)
if("universal_translator")
if(!languages_granted)
grant_all_languages(TRUE, TRUE, TRUE, LANGUAGE_SOFTWARE)
diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm
index 82f81df154c..7fb997bf33d 100644
--- a/code/modules/mob/living/silicon/silicon.dm
+++ b/code/modules/mob/living/silicon/silicon.dm
@@ -57,7 +57,7 @@
if(ispath(radio))
radio = new radio(src)
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
- diag_hud.add_to_hud(src)
+ diag_hud.add_atom_to_hud(src)
diag_hud_set_status()
diag_hud_set_health()
add_sensors()
@@ -377,17 +377,17 @@
var/datum/atom_hud/secsensor = GLOB.huds[sec_hud]
var/datum/atom_hud/medsensor = GLOB.huds[med_hud]
var/datum/atom_hud/diagsensor = GLOB.huds[d_hud]
- secsensor.remove_hud_from(src)
- medsensor.remove_hud_from(src)
- diagsensor.remove_hud_from(src)
+ secsensor.hide_from(src)
+ medsensor.hide_from(src)
+ diagsensor.hide_from(src)
/mob/living/silicon/proc/add_sensors()
var/datum/atom_hud/secsensor = GLOB.huds[sec_hud]
var/datum/atom_hud/medsensor = GLOB.huds[med_hud]
var/datum/atom_hud/diagsensor = GLOB.huds[d_hud]
- secsensor.add_hud_to(src)
- medsensor.add_hud_to(src)
- diagsensor.add_hud_to(src)
+ secsensor.show_to(src)
+ medsensor.show_to(src)
+ diagsensor.show_to(src)
/mob/living/silicon/proc/toggle_sensors()
if(incapacitated())
diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm
index f21ebabf39e..7e9c750b10d 100644
--- a/code/modules/mob/living/simple_animal/bot/bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot.dm
@@ -104,7 +104,7 @@
var/beacon_freq = FREQ_NAV_BEACON
///The type of data HUD the bot uses. Diagnostic by default.
var/data_hud_type = DATA_HUD_DIAGNOSTIC_BASIC
- var/datum/atom_hud/data/bot_path/path_hud = new /datum/atom_hud/data/bot_path()
+ var/datum/atom_hud/data/bot_path/path_hud
var/path_image_icon = 'icons/mob/aibots.dmi'
var/path_image_icon_state = "path_indicator"
var/path_image_color = "#FFFFFF"
@@ -164,6 +164,11 @@
/mob/living/simple_animal/bot/Initialize(mapload)
. = ..()
GLOB.bots_list += src
+
+ path_hud = new /datum/atom_hud/data/bot_path()
+ for(var/hud in path_hud.hud_icons) // You get to see your own path
+ set_hud_image_active(hud, exclusive_hud = path_hud)
+
// Give bots a fancy new ID card that can hold any access.
access_card = new /obj/item/card/id/advanced/simple_bot(src)
// This access is so bots can be immediately set to patrol and leave Robotics, instead of having to be let out first.
@@ -178,7 +183,7 @@
//Adds bot to the diagnostic HUD system
prepare_huds()
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
- diag_hud.add_to_hud(src)
+ diag_hud.add_atom_to_hud(src)
diag_hud_set_bothealth()
diag_hud_set_botstat()
diag_hud_set_botmode()
@@ -186,10 +191,10 @@
//If a bot has its own HUD (for player bots), provide it.
if(!isnull(data_hud_type))
var/datum/atom_hud/datahud = GLOB.huds[data_hud_type]
- datahud.add_hud_to(src)
+ datahud.show_to(src)
if(path_hud)
- path_hud.add_to_hud(src)
- path_hud.add_hud_to(src)
+ path_hud.add_atom_to_hud(src)
+ path_hud.show_to(src)
/mob/living/simple_animal/bot/Destroy()
@@ -1022,11 +1027,10 @@ Pass a positive integer as an argument to override a bot's default speed.
var/list/path_huds_watching_me = list(GLOB.huds[DATA_HUD_DIAGNOSTIC_ADVANCED])
if(path_hud)
path_huds_watching_me += path_hud
- for(var/V in path_huds_watching_me)
- var/datum/atom_hud/H = V
- H.remove_from_hud(src)
+ for(var/datum/atom_hud/hud as anything in path_huds_watching_me)
+ hud.remove_atom_from_hud(src)
- var/list/path_images = hud_list[DIAG_PATH_HUD]
+ var/list/path_images = active_hud_list[DIAG_PATH_HUD]
QDEL_LIST(path_images)
if(newpath)
for(var/i in 1 to newpath.len)
@@ -1065,9 +1069,8 @@ Pass a positive integer as an argument to override a bot's default speed.
path[T] = I
path_images += I
- for(var/V in path_huds_watching_me)
- var/datum/atom_hud/H = V
- H.add_to_hud(src)
+ for(var/datum/atom_hud/hud as anything in path_huds_watching_me)
+ hud.add_atom_to_hud(src)
/mob/living/simple_animal/bot/proc/increment_path()
if(!length(path))
diff --git a/code/modules/mob/living/simple_animal/constructs.dm b/code/modules/mob/living/simple_animal/constructs.dm
index 7db0ef33636..f7cec36b545 100644
--- a/code/modules/mob/living/simple_animal/constructs.dm
+++ b/code/modules/mob/living/simple_animal/constructs.dm
@@ -306,7 +306,7 @@
/mob/living/simple_animal/hostile/construct/artificer/Initialize(mapload)
. = ..()
var/datum/atom_hud/datahud = GLOB.huds[health_hud]
- datahud.add_hud_to(src)
+ datahud.show_to(src)
/mob/living/simple_animal/hostile/construct/artificer/Found(atom/A) //what have we found here?
if(isconstruct(A)) //is it a construct?
diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
index d9d415f7990..0e199171c62 100644
--- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
+++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
@@ -182,7 +182,7 @@
alert_drones(DRONE_NET_CONNECT)
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
- diag_hud.add_to_hud(src)
+ diag_hud.add_atom_to_hud(src)
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_NEGATES_GRAVITY, INNATE_TRAIT)
diff --git a/code/modules/mob/living/simple_animal/friendly/robot_customer.dm b/code/modules/mob/living/simple_animal/friendly/robot_customer.dm
index 2bc0ee59829..14246accede 100644
--- a/code/modules/mob/living/simple_animal/friendly/robot_customer.dm
+++ b/code/modules/mob/living/simple_animal/friendly/robot_customer.dm
@@ -57,11 +57,11 @@
/mob/living/simple_animal/robot_customer/MouseEntered(location, control, params)
. = ..()
- hud_to_show_on_hover?.add_hud_to(usr)
+ hud_to_show_on_hover?.show_to(usr)
/mob/living/simple_animal/robot_customer/MouseExited(location, control, params)
. = ..()
- hud_to_show_on_hover?.remove_hud_from(usr)
+ hud_to_show_on_hover?.hide_from(usr)
/mob/living/simple_animal/robot_customer/update_overlays()
. = ..()
diff --git a/code/modules/mob/living/simple_animal/guardian/types/support.dm b/code/modules/mob/living/simple_animal/guardian/types/support.dm
index d5623c77339..841ab3b5446 100644
--- a/code/modules/mob/living/simple_animal/guardian/types/support.dm
+++ b/code/modules/mob/living/simple_animal/guardian/types/support.dm
@@ -20,7 +20,7 @@
/mob/living/simple_animal/hostile/guardian/healer/Initialize(mapload)
. = ..()
var/datum/atom_hud/medsensor = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
- medsensor.add_hud_to(src)
+ medsensor.show_to(src)
/mob/living/simple_animal/hostile/guardian/healer/get_status_tab_items()
. = ..()
diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
index 52fe48915c0..0f02e0272cc 100644
--- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
+++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
@@ -142,7 +142,7 @@
/mob/living/simple_animal/hostile/giant_spider/nurse/Initialize(mapload)
. = ..()
var/datum/atom_hud/datahud = GLOB.huds[health_hud]
- datahud.add_hud_to(src)
+ datahud.show_to(src)
/mob/living/simple_animal/hostile/giant_spider/nurse/AttackingTarget()
if(is_busy)
diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm
index 04a25291f57..494e046b865 100644
--- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm
+++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm
@@ -506,7 +506,7 @@
remove_verb(src, /mob/living/verb/pulled)
remove_verb(src, /mob/verb/me_verb)
var/datum/atom_hud/medsensor = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
- medsensor.add_hud_to(src)
+ medsensor.show_to(src)
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 28455818fe7..faf47cc827b 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -94,23 +94,69 @@
/mob/GenerateTag()
tag = "mob_[next_mob_id++]"
+/**
+ * set every hud image in the given category active so other people with the given hud can see it.
+ * Arguments:
+ * * hud_category - the index in our active_hud_list corresponding to an image now being shown.
+ * * update_huds - if FALSE we will just put the hud_category into active_hud_list without actually updating the atom_hud datums subscribed to it
+ * * exclusive_hud - if given a reference to an atom_hud, will just update that hud instead of all global ones attached to that category.
+ * This is because some atom_hud subtypes arent supposed to work via global categories, updating normally would affect all of these which we dont want.
+ */
+/atom/proc/set_hud_image_active(hud_category, update_huds = TRUE, datum/atom_hud/exclusive_hud)
+ if(!istext(hud_category) || !hud_list?[hud_category] || active_hud_list?[hud_category])
+ return FALSE
+
+ LAZYSET(active_hud_list, hud_category, hud_list[hud_category])
+
+ if(!update_huds)
+ return TRUE
+
+ if(exclusive_hud)
+ exclusive_hud.add_single_hud_category_on_atom(src, hud_category)
+ else
+ for(var/datum/atom_hud/hud_to_update as anything in GLOB.huds_by_category[hud_category])
+ hud_to_update.add_single_hud_category_on_atom(src, hud_category)
+
+ return TRUE
+
+///sets every hud image in the given category inactive so no one can see it
+/atom/proc/set_hud_image_inactive(hud_category, update_huds = TRUE, datum/atom_hud/exclusive_hud)
+ if(!istext(hud_category))
+ return FALSE
+
+ LAZYREMOVE(active_hud_list, hud_category)
+
+ if(!update_huds)
+ return TRUE
+
+ if(exclusive_hud)
+ exclusive_hud.remove_single_hud_category_on_atom(src, hud_category)
+ else
+ for(var/datum/atom_hud/hud_to_update as anything in GLOB.huds_by_category[hud_category])
+ hud_to_update.remove_single_hud_category_on_atom(src, hud_category)
+
+ return TRUE
+
/**
* Prepare the huds for this atom
*
- * Goes through hud_possible list and adds the images to the hud_list variable (if not already
- * cached)
+ * Goes through hud_possible list and adds the images to the hud_list variable (if not already cached)
*/
/atom/proc/prepare_huds()
+ if(hud_list) // I choose to be lienient about people calling this proc more then once
+ return
hud_list = list()
for(var/hud in hud_possible)
var/hint = hud_possible[hud]
- switch(hint)
- if(HUD_LIST_LIST)
- hud_list[hud] = list()
- else
- var/image/I = image('icons/mob/huds/hud.dmi', src, "")
- I.appearance_flags = RESET_COLOR|RESET_TRANSFORM
- hud_list[hud] = I
+
+ if(hint == HUD_LIST_LIST)
+ hud_list[hud] = list()
+
+ else
+ var/image/I = image('icons/mob/huds/hud.dmi', src, "")
+ I.appearance_flags = RESET_COLOR|RESET_TRANSFORM
+ hud_list[hud] = I
+ set_hud_image_active(hud, update_huds = FALSE) //by default everything is active. but dont add it to huds to keep control.
/**
* Some kind of debug verb that gives atmosphere environment details
diff --git a/code/modules/mod/modules/modules_visor.dm b/code/modules/mod/modules/modules_visor.dm
index a68293bd1b4..f6e20958afd 100644
--- a/code/modules/mod/modules/modules_visor.dm
+++ b/code/modules/mod/modules/modules_visor.dm
@@ -20,7 +20,7 @@
return
if(hud_type)
var/datum/atom_hud/hud = GLOB.huds[hud_type]
- hud.add_hud_to(mod.wearer)
+ hud.show_to(mod.wearer)
for(var/trait in visor_traits)
ADD_TRAIT(mod.wearer, trait, MOD_TRAIT)
mod.wearer.update_sight()
@@ -31,7 +31,7 @@
return
if(hud_type)
var/datum/atom_hud/hud = GLOB.huds[hud_type]
- hud.remove_hud_from(mod.wearer)
+ hud.hide_from(mod.wearer)
for(var/trait in visor_traits)
REMOVE_TRAIT(mod.wearer, trait, MOD_TRAIT)
mod.wearer.update_sight()
diff --git a/code/modules/surgery/organs/augments_eyes.dm b/code/modules/surgery/organs/augments_eyes.dm
index 034ba2870b2..b3d45d74bd8 100644
--- a/code/modules/surgery/organs/augments_eyes.dm
+++ b/code/modules/surgery/organs/augments_eyes.dm
@@ -19,14 +19,14 @@
..()
if(HUD_type)
var/datum/atom_hud/hud = GLOB.huds[HUD_type]
- hud.add_hud_to(eye_owner)
+ hud.show_to(eye_owner)
if(HUD_trait)
ADD_TRAIT(eye_owner, HUD_trait, ORGAN_TRAIT)
/obj/item/organ/cyberimp/eyes/hud/Remove(mob/living/carbon/eye_owner, special = 0)
if(HUD_type)
var/datum/atom_hud/hud = GLOB.huds[HUD_type]
- hud.remove_hud_from(eye_owner)
+ hud.hide_from(eye_owner)
if(HUD_trait)
REMOVE_TRAIT(eye_owner, HUD_trait, ORGAN_TRAIT)
..()
diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm
index 15eabdb6197..07027957214 100644
--- a/code/modules/vehicles/mecha/_mecha.dm
+++ b/code/modules/vehicles/mecha/_mecha.dm
@@ -231,7 +231,7 @@
GLOB.mechas_list += src //global mech list
prepare_huds()
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
- diag_hud.add_to_hud(src)
+ diag_hud.add_atom_to_hud(src)
diag_hud_set_mechhealth()
diag_hud_set_mechcell()
diag_hud_set_mechstat()
@@ -277,7 +277,7 @@
GLOB.mechas_list -= src //global mech list
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
- diag_hud.remove_from_hud(src) //YEET
+ diag_hud.remove_atom_from_hud(src) //YEET
return ..()
/obj/vehicle/sealed/mecha/atom_destruction()
diff --git a/code/modules/vehicles/mecha/medical/odysseus.dm b/code/modules/vehicles/mecha/medical/odysseus.dm
index fbf4960e6c9..e046c86f03f 100644
--- a/code/modules/vehicles/mecha/medical/odysseus.dm
+++ b/code/modules/vehicles/mecha/medical/odysseus.dm
@@ -15,13 +15,13 @@
. = ..()
if(. && !HAS_TRAIT(H, TRAIT_MEDICAL_HUD))
var/datum/atom_hud/hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
- hud.add_hud_to(H)
+ hud.show_to(H)
ADD_TRAIT(H, TRAIT_MEDICAL_HUD, VEHICLE_TRAIT)
/obj/vehicle/sealed/mecha/medical/odysseus/remove_occupant(mob/living/carbon/human/H)
if(isliving(H) && HAS_TRAIT_FROM(H, TRAIT_MEDICAL_HUD, VEHICLE_TRAIT))
- var/datum/atom_hud/hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
- hud.remove_hud_from(H)
+ var/datum/atom_hud/med_hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
+ med_hud.hide_from(H)
REMOVE_TRAIT(H, TRAIT_MEDICAL_HUD, VEHICLE_TRAIT)
return ..()
@@ -30,4 +30,4 @@
if(. && !HAS_TRAIT(M, TRAIT_MEDICAL_HUD))
var/datum/atom_hud/hud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
var/mob/living/brain/B = M.brainmob
- hud.add_hud_to(B)
+ hud.show_to(B)
diff --git a/code/modules/wiremod/components/bci/hud/bar_overlay.dm b/code/modules/wiremod/components/bci/hud/bar_overlay.dm
index 778e8bf5dd0..07d25f35e48 100644
--- a/code/modules/wiremod/components/bci/hud/bar_overlay.dm
+++ b/code/modules/wiremod/components/bci/hud/bar_overlay.dm
@@ -59,7 +59,7 @@
cool_overlay,
owner,
)
- alt_appearance.add_hud_to(owner)
+ alt_appearance.show_to(owner)
active_overlays[target_atom] = WEAKREF(alt_appearance)
diff --git a/code/modules/wiremod/components/bci/hud/counter_overlay.dm b/code/modules/wiremod/components/bci/hud/counter_overlay.dm
index 3e1248cd0c4..b0ec954a0ff 100644
--- a/code/modules/wiremod/components/bci/hud/counter_overlay.dm
+++ b/code/modules/wiremod/components/bci/hud/counter_overlay.dm
@@ -78,7 +78,7 @@
counter,
owner,
)
- alt_appearance.add_hud_to(owner)
+ alt_appearance.show_to(owner)
counter_appearance = WEAKREF(alt_appearance)
@@ -103,7 +103,7 @@
number,
owner,
)
- number_alt_appearance.add_hud_to(owner)
+ number_alt_appearance.show_to(owner)
numbers += WEAKREF(number_alt_appearance)
@@ -115,7 +115,7 @@
numbers = list()
var/datum/atom_hud/overlay = counter_appearance?.resolve()
- overlay.remove_hud_from(owner)
+ overlay.hide_from(owner)
QDEL_NULL(overlay)
/obj/item/circuit_component/counter_overlay/Destroy()
diff --git a/code/modules/wiremod/components/bci/hud/object_overlay.dm b/code/modules/wiremod/components/bci/hud/object_overlay.dm
index 568521155e9..0b74be3caec 100644
--- a/code/modules/wiremod/components/bci/hud/object_overlay.dm
+++ b/code/modules/wiremod/components/bci/hud/object_overlay.dm
@@ -119,7 +119,7 @@
cool_overlay,
owner,
)
- alt_appearance.add_hud_to(owner)
+ alt_appearance.show_to(owner)
active_overlays[target_atom] = WEAKREF(alt_appearance)