mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* why no work angy * weird errors shit sucks * fixved it I can spell good * fix? POSSIBLY * nope wasnt this * no more immutable thhanks koffee * ok ok * removes all the pref stuff ""removes"" * remove this idiot * this goes bye bye * these go too genius * bye bye * better night vision * tries to fix camera maybe * ok fuck it we ball we ball * ok lets go back go back go back go back * WORK DAMNIT * ha fuc kyou * this maybe * this doesnt work :( * maybe fix maybe * fucks everything why do i do this * test update test * Revert "tries to fix camera" This reverts commit2d14fbae66. * reverts everything I just did peko pain * bye bitch * oh yeah add this I guess * Fucks up the camera net + chunk why * test maybe revert * Revert "test maybe revert" This reverts commit98c5ef1b93. * Revert "Fucks up the camera net + chunk" This reverts commit0e421ebf5f. * this isnt going well uh oh * Attempts to rework out security camera and probably more * Revert "this isnt going well" This reverts commit1d8ceac867. * Revert "Revert "this isnt going well"" This reverts commite26fb61415. * ok ok * Revert "ok" This reverts commit7e7a7f8372. * Revert "Merge remote-tracking branch 'upstream/master' into NahI'dPortit" This reverts commit01094731c1, reversing changes made toc0cf69ebf1. * this doesn't need to be redefined I guess * no we need this totally * a familiar pain * 515 is L * yeah yeah * ok god fine * bye bye basemap :( doesnt work on runtime station * Fixes AI statis not working god im good * remove this oh god * Revert "Revert "Merge remote-tracking branch 'upstream/master' into NahI'dPortit"" This reverts commitb3fb3ba0db. * proves to god I exist and im pissed * yog exclusive feature (tm) plane master * bring this back from previous push * updates vendor emissives as well as firealarms * Updates barsign and fucks everything up * Fixes barsigns breaks all lights and updates barsigns to be machines and not structures We will address this in a later patch * not sure who changed that oh well * yeah this got moved * this needs updating yeah * turns off the carbon monoxide alarm duh * FIXES IT YES thank you biome * turns this off too yeah * Can't compile yet but ports a ton of shit * L * the game opens ig * extra shit * fixes * signals and smooth queue * look ma im going horribly out of scope * fixes chasms * this fixed nothing * ??? * more barsigns for later * forgive me cowboy. also fuck diagonals * oops we need this apparently * fuck it we ball * Update _lists.dm * Update icon_smoothing.dm * it now works kinda * Update atom_initializing_EXPENSIVE.dm * lighting don't work * we have light * sort turfs better * big fucking reorganize * like everything except templates * boy i sure hope nothing bad happens to these bar templates * we're back * no runtimes baby * no errors * shuttles are almost fixed i think * Revert "shuttles are almost fixed i think" This reverts commit046058827c. * Revert "Merge remote-tracking branch 'upstream/master' into icon_smoothing" This reverts commit863e1b776d, reversing changes made to884623e600. * Revert "no errors" This reverts commit884623e600. * too far back i think * midround smoothing runtimes fixed i think * comment cleanup * should fix the component runtimes * Revert "Revert "Merge remote-tracking branch 'upstream/master' into icon_smoothing"" This reverts commita8ff8d63aa. * NO RUNTIMES AND ICEMETA WORKS LET'S GOOOOOO * please stay fixed icemeta * organizing render dms * woops this too in the reorganizing * cryo fixed * nah, i'd win * parallax isn't my problem * pls don't break icemeta * runtime station gets a cam console * well it compiles * maybe fix the map * woops * man i hate maps * was that it? * PLEASE * missing focus tests * maybe that was it * maybe * let's take the batteries out of the carbon monoxide detector * fuck osha * i hate vending machines * that's not a computer * slot machine fix * PLEASE * that wasn't supposed to be there * fuck it i can't fix everything at once * BLUESPACE LOCKER? * literally why * hhh * does this fix chasms? * that should fix bad index * please? * turf_flags for reservations * haha oops * yolo (kill me) * fix wood walls and other walls * fix stairs * that might have fixed shittles * baseturfs are good now i think * should fix plasma windows * decals fixed * please fix changelog * shuttle lighting still fucky * lighting is stinky slow and doesn't finish updating by the time the server starts guh * lighting seemingly works * slipping works * shuttle sounds, slips, and windoors fixed * why am i here * fuck the changelog * of course someone touched smoothing as i'm almost done * we good? * updating ai_eye and rename * z updates and more ai cam updates * ice fixed * weather and ice fix * clockies can see and other clean up catches * windows fixed * cowbot forgive me i'm trying to update flashlights to tg because there's no light on lower multi-z z's like ice meta bottom floor * movable lighting works on multi-z * gps fix * item stacking from drag works * falsewall fix * job panel fixed * AI HANDLED * woops that comment should be gone * i hate ai i hate ai * brass glass visible again * vents on top of tiles now * sigdrobe sprite back * centcomm portals work * portals and see openspace mapping icons fixed * icemeta my behated * kill * is that it * lighting cutoff is old hat * angery overlay * not super necessary * also extra but whatever * ticker but thicker * job fix i hope * this isn't needed anymore * latejoin fix? * laserpointer, pipecrawl, and some consoles fixed * i hate fixing bugs as they're made * we're not ready for that * redef cleanup * gps arrows, gun flashlights, shuttle console placement, multi-z pulling fixed * goofy ah gun code * this was a good idea and necessary * should fix caltrop component * does this please the linter * linter please accept this async function * THERE * take the batteries out * make it stop * cowbot stopped me from letting ghosts dab * recycler loc fix * fix border firedoors not blocking movement * should fix screen fade out and fade in on round start and end * darker command tile trim and fixed bronze wall sprites * fuck you linter * railings actually stop you from leaving * probably fixes gibtonite overlay when struck * armaments dispenser and clockwork catwalk * turbine fix probably * pointing at inhand items should be fixed * fix overwatch app * should hopefully fix cable rotation on shuttle move * flashlights have better directionality logic * hopefully fixes shuttle atmos on move * grilles fixed * hopefully this fixes shuttle buttons, airolocks, and other machinery not working after moving * ice meta mining area finally not freezing * fix lightbulb icons not updating * lava mask and lighting dots * we actually have this * fuck glowshrooms GC * fix light fixture interactions and icon updates * hopefully catches all the updates * lava lighting good to go * seclite was missing inhands * smoothing in replays * light updates accurate in replays * biome's multi-z requests --------- Co-authored-by: cowbot92 <75333826+cowbot92@users.noreply.github.com> Co-authored-by: Molti <gamingjoelouis@gmail.com> Co-authored-by: Ringalong <53777086+JohnFulpWillard@users.noreply.github.com>
440 lines
17 KiB
Plaintext
440 lines
17 KiB
Plaintext
/* HUD DATUMS */
|
|
|
|
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(),
|
|
DATA_HUD_SECURITY_ADVANCED = new /datum/atom_hud/data/human/security/advanced(),
|
|
DATA_HUD_MEDICAL_BASIC = new /datum/atom_hud/data/human/medical/basic(),
|
|
DATA_HUD_MEDICAL_ADVANCED = new /datum/atom_hud/data/human/medical/advanced(),
|
|
DATA_HUD_DIAGNOSTIC_BASIC = new /datum/atom_hud/data/diagnostic/basic(),
|
|
DATA_HUD_DIAGNOSTIC_ADVANCED = new /datum/atom_hud/data/diagnostic/advanced(),
|
|
DATA_HUD_ABDUCTOR = new /datum/atom_hud/abductor(),
|
|
DATA_HUD_SENTIENT_DISEASE = new /datum/atom_hud/sentient_disease(),
|
|
DATA_HUD_AI_DETECT = new /datum/atom_hud/ai_detector(),
|
|
DATA_HUD_SECURITY_MEDICAL = new /datum/atom_hud/data/human/security/advanced/hos(),
|
|
))
|
|
|
|
/datum/atom_hud
|
|
///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()
|
|
|
|
///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_REF(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/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/add_z_level_huds()
|
|
SIGNAL_HANDLER
|
|
hud_atoms += list(list())
|
|
hud_users += list(list())
|
|
|
|
///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
|
|
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
|
|
|
|
if(!hud_users_all_z_levels[new_viewer])
|
|
hud_users_all_z_levels[new_viewer] = 1
|
|
|
|
RegisterSignal(new_viewer, COMSIG_QDELETING, PROC_REF(unregister_atom), override = TRUE) //both hud users and hud atoms use these signals
|
|
RegisterSignal(new_viewer, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(on_atom_or_user_z_level_changed), override = TRUE)
|
|
|
|
var/turf/their_turf = get_turf(new_viewer)
|
|
if(!their_turf)
|
|
return
|
|
hud_users[their_turf.z][new_viewer] = TRUE
|
|
|
|
if(next_time_allowed[new_viewer] > world.time)
|
|
if(!queued_to_see[new_viewer])
|
|
addtimer(CALLBACK(src, PROC_REF(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
|
|
|
|
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_QDELETING)
|
|
|
|
hud_users_all_z_levels -= former_viewer
|
|
|
|
if(next_time_allowed[former_viewer])
|
|
next_time_allowed -= former_viewer
|
|
|
|
var/turf/their_turf = get_turf(former_viewer)
|
|
if(their_turf)
|
|
hud_users[their_turf.z] -= former_viewer
|
|
|
|
if(queued_to_see[former_viewer])
|
|
queued_to_see -= former_viewer
|
|
else if (their_turf)
|
|
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
|
|
|
|
// No matter where or who you are, you matter to me :)
|
|
RegisterSignal(new_hud_atom, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(on_atom_or_user_z_level_changed), override = TRUE)
|
|
RegisterSignal(new_hud_atom, COMSIG_QDELETING, PROC_REF(unregister_atom), override = TRUE) //both hud atoms and hud users use these signals
|
|
hud_atoms_all_z_levels[new_hud_atom] = TRUE
|
|
|
|
var/turf/atom_turf = get_turf(new_hud_atom)
|
|
if(!atom_turf)
|
|
return TRUE
|
|
|
|
hud_atoms[atom_turf.z] |= new_hud_atom
|
|
|
|
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
|
|
|
|
/// 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
|
|
|
|
//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_QDELETING)
|
|
|
|
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)
|
|
|
|
hud_atoms_all_z_levels -= hud_atom_to_remove
|
|
|
|
var/turf/atom_turf = get_turf(hud_atom_to_remove)
|
|
if(!atom_turf)
|
|
return TRUE
|
|
|
|
hud_atoms[atom_turf.z] -= 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
|
|
|
|
if(!hud_atoms_all_z_levels[hud_atom])
|
|
add_atom_to_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
|
|
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
|
|
if(old_turf)
|
|
if(hud_users_all_z_levels[moved_atom])
|
|
hud_users[old_turf.z] -= moved_atom
|
|
|
|
remove_all_atoms_from_single_hud(moved_atom, get_hud_atoms_for_z_level(old_turf.z))
|
|
|
|
if(hud_atoms_all_z_levels[moved_atom])
|
|
hud_atoms[old_turf.z] -= moved_atom
|
|
|
|
//this wont include moved_atom since its removed
|
|
remove_atom_from_all_huds(get_hud_users_for_z_level(old_turf.z), 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
|
|
|
|
add_all_atoms_to_single_mob_hud(moved_atom, get_hud_atoms_for_z_level(new_turf.z))
|
|
|
|
if(hud_atoms_all_z_levels[moved_atom])
|
|
hud_atoms[new_turf.z] |= moved_atom
|
|
|
|
add_atom_to_all_mob_huds(get_hud_users_for_z_level(new_turf.z), 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]
|
|
|
|
/// all passed in hud_atoms's hud images (that are part of this atom_hud) to requesting_mob's client.images list
|
|
/// optimization of [/datum/atom_hud/proc/add_atom_to_single_mob_hud] for hot cases, we assert that no nulls will be passed in via the list
|
|
/datum/atom_hud/proc/add_all_atoms_to_single_mob_hud(mob/requesting_mob, list/atom/hud_atoms) //unsafe, no sanity apart from client
|
|
if(!requesting_mob || !requesting_mob.client)
|
|
return
|
|
|
|
// Hud entries this mob ignores
|
|
var/list/mob_exceptions = hud_exceptions[requesting_mob]
|
|
|
|
for(var/hud_category in hud_icons)
|
|
for(var/atom/hud_atom as anything in hud_atoms)
|
|
if(mob_exceptions && (hud_atom in hud_exceptions[requesting_mob]))
|
|
continue
|
|
var/image/output = hud_atom.active_hud_list?[hud_category]
|
|
// byond throws a fit if you try to add null to the images list
|
|
if(!output)
|
|
continue
|
|
requesting_mob.client.images |= output
|
|
|
|
/// add just hud_atom's hud images (that are part of this atom_hud) to all the requesting_mobs's client.images list
|
|
/// optimization of [/datum/atom_hud/proc/add_atom_to_single_mob_hud] for hot cases, we assert that no nulls will be passed in via the list
|
|
/datum/atom_hud/proc/add_atom_to_all_mob_huds(list/mob/requesting_mobs, atom/hud_atom) //unsafe, no sanity apart from client
|
|
if(!hud_atom?.active_hud_list)
|
|
return
|
|
|
|
var/list/images_to_add = list()
|
|
for(var/hud_category in (hud_icons & hud_atom.active_hud_list))
|
|
images_to_add |= hud_atom.active_hud_list[hud_category]
|
|
|
|
// Cache for sonic speed, lists are structs
|
|
var/list/exceptions = hud_exceptions
|
|
for(var/mob/requesting_mob as anything in requesting_mobs)
|
|
if(!requesting_mob.client)
|
|
continue
|
|
if(!exceptions[requesting_mob] || !(hud_atom in exceptions[requesting_mob]))
|
|
requesting_mob.client.images |= images_to_add
|
|
|
|
/// 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]
|
|
|
|
/// remove every hud image for this hud pulled from atoms_to_remove from client_mob's client.images list
|
|
/// optimization of [/datum/atom_hud/proc/remove_atom_from_single_hud] for hot cases, we assert that no nulls will be passed in via the list
|
|
/datum/atom_hud/proc/remove_all_atoms_from_single_hud(mob/client_mob, list/atom/atoms_to_remove)
|
|
if(!client_mob || !client_mob.client)
|
|
return
|
|
for(var/hud_image in hud_icons)
|
|
for(var/atom/atom_to_remove as anything in atoms_to_remove)
|
|
client_mob.client.images -= atom_to_remove.active_hud_list?[hud_image]
|
|
|
|
/// remove every hud image for this hud on atom_to_remove from client_mobs's client.images list
|
|
/// optimization of [/datum/atom_hud/proc/remove_atom_from_single_hud] for hot cases, we assert that no nulls will be passed in via the list
|
|
/datum/atom_hud/proc/remove_atom_from_all_huds(list/mob/client_mobs, atom/atom_to_remove)
|
|
if(!atom_to_remove?.active_hud_list)
|
|
return
|
|
|
|
var/list/images_to_remove = list()
|
|
for(var/hud_image in hud_icons)
|
|
images_to_remove |= atom_to_remove.active_hud_list[hud_image]
|
|
|
|
for(var/mob/client_mob as anything in client_mobs)
|
|
if(!client_mob.client)
|
|
continue
|
|
client_mob.client.images -= images_to_remove
|
|
|
|
/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(mob/hud_user, atom/hidden_atom)
|
|
hud_exceptions[hud_user] -= hidden_atom
|
|
|
|
var/turf/hud_atom_turf = get_turf(hidden_atom)
|
|
|
|
if(!hud_atom_turf)
|
|
return
|
|
|
|
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?.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
|
|
|
|
/mob/proc/add_click_catcher()
|
|
client.screen += client.void
|
|
|
|
/mob/dead/new_player/add_click_catcher()
|
|
return
|