mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 02:16:05 +00:00
HUDs and AI Cameras No Longer Track Invisible Mobs (#16276)
* Medical HUDs and Security HUDs no longer track invisible mobs. * Now works with alphas lists and body alphas as well. * Forgot indents. * Does it better this time. * Typo. * Forgot this. * AI cameras can no longer track invisible mobs. * More OOP.
This commit is contained in:
committed by
Pieter-Jan Briers
parent
f449bbdb3f
commit
f830b559a7
@@ -13,6 +13,20 @@ mob/proc/regular_hud_updates() //Used in the life.dm of mobs that can use HUDs.
|
||||
if(src in sec_hud_users)
|
||||
sec_hud_users -= src
|
||||
|
||||
proc/check_HUD_visibility(var/mob/living/target, var/mob/user)
|
||||
if(user.see_invisible < target.invisibility)
|
||||
return FALSE
|
||||
if(target.alpha <= 1)
|
||||
return FALSE
|
||||
for(var/i in target.alphas)
|
||||
if(target.alphas[i] <= 1)
|
||||
return FALSE
|
||||
if(iscarbon(target))
|
||||
var/mob/living/carbon/C = target
|
||||
for(var/i in C.body_alphas)
|
||||
if(C.body_alphas[i] <= 1)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
//Medical HUD outputs. Called by the Life() proc of the mob using it, usually.
|
||||
proc/process_med_hud(var/mob/M, var/mob/eye)
|
||||
@@ -32,7 +46,7 @@ proc/process_med_hud(var/mob/M, var/mob/eye)
|
||||
for(var/mob/living/carbon/human/patient in range(T))
|
||||
if(patient.head && istype(patient.head,/obj/item/clothing/head/tinfoil)) //Tinfoil hat? Move along.
|
||||
continue
|
||||
if(M.see_invisible < patient.invisibility)
|
||||
if(!check_HUD_visibility(patient, M))
|
||||
continue
|
||||
if(!C)
|
||||
continue
|
||||
@@ -74,7 +88,7 @@ proc/process_sec_hud(var/mob/M, var/advanced_mode,var/mob/eye)
|
||||
else
|
||||
T = get_turf(M)
|
||||
for(var/mob/living/carbon/human/perp in range(T))
|
||||
if(M.see_invisible < perp.invisibility)
|
||||
if(!check_HUD_visibility(perp, M))
|
||||
continue
|
||||
holder = perp.hud_list[ID_HUD]
|
||||
if(!holder)
|
||||
|
||||
@@ -63,9 +63,7 @@
|
||||
continue
|
||||
if(M == usr)
|
||||
continue
|
||||
if(see_invisible < M.invisibility) //cloaked
|
||||
continue
|
||||
if(M.alpha <= 1) //fully transparent
|
||||
if(!check_HUD_visibility(M, src))
|
||||
continue
|
||||
if(M.digitalcamo)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user