blood brother hud (#84704)

## About The Pull Request

bloodbros get a hud
teambased antagonists may not see the HUDs of other teams
![2024-07-06
11_12_17-Window](https://github.com/tgstation/tgstation/assets/70376633/e4c6dfde-47fe-4e45-9350-956e14bf18fb)

additionally if TESTING is defined flashing a clientless mindless mob
works

## Why It's Good For The Game

fixes #83617

## Changelog
🆑
qol: blood bros get a hud to see eachother
code: teambased antagonists may not see the HUDs of other teams
/🆑

---------

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
jimmyl
2024-07-07 21:40:54 -06:00
committed by GitHub
co-authored by Mothblocks
parent 663f17c44f
commit d450359baa
3 changed files with 23 additions and 1 deletions
@@ -525,6 +525,7 @@ GLOBAL_LIST_EMPTY(antagonists)
"antag_team_hud_[REF(src)]",
hud_image_on(target),
antag_to_check || type,
get_team() && WEAKREF(get_team()),
))
// Add HUDs that they couldn't see before
@@ -4,9 +4,12 @@ GLOBAL_LIST_EMPTY_TYPED(has_antagonist_huds, /datum/atom_hud/alternate_appearanc
/// An alternate appearance that will only show if you have the antag datum
/datum/atom_hud/alternate_appearance/basic/has_antagonist
var/antag_datum_type
/// Optionally, a weakref to antag team
var/datum/weakref/team_ref
/datum/atom_hud/alternate_appearance/basic/has_antagonist/New(key, image/I, antag_datum_type)
/datum/atom_hud/alternate_appearance/basic/has_antagonist/New(key, image/I, antag_datum_type, datum/weakref/team)
src.antag_datum_type = antag_datum_type
team_ref = team
GLOB.has_antagonist_huds += src
return ..(key, I, NONE)
@@ -15,6 +18,9 @@ GLOBAL_LIST_EMPTY_TYPED(has_antagonist_huds, /datum/atom_hud/alternate_appearanc
return ..()
/datum/atom_hud/alternate_appearance/basic/has_antagonist/mobShouldSee(mob/M)
var/datum/team/antag_team = team_ref?.resolve()
if(!isnull(antag_team))
return !!(M.mind in antag_team.members)
return !!M.mind?.has_antag_datum(antag_datum_type)
/// An alternate appearance that will show all the antagonists this mob has
@@ -75,9 +75,14 @@
flashed.balloon_alert(source, "unconscious!")
return
#ifdef TESTING
if (isnull(flashed.mind))
flashed.mind_initialize()
#else
if (isnull(flashed.mind) || !GET_CLIENT(flashed))
flashed.balloon_alert(source, "[flashed.p_their()] mind is vacant!")
return
#endif
for(var/datum/objective/brother_objective as anything in source.mind.get_all_objectives())
// If the objective has a target, are we flashing them?
@@ -183,6 +188,11 @@
message_admins("[key_name_admin(admin)] made [key_name_admin(new_owner)] into a blood brother.")
log_admin("[key_name(admin)] made [key_name(new_owner)] into a blood brother.")
/datum/antagonist/brother/apply_innate_effects(mob/living/mob_override)
. = ..()
var/mob/living/the_mob = owner.current || mob_override
add_team_hud(the_mob)
/datum/antagonist/brother/ui_static_data(mob/user)
var/list/data = list()
data["antag_name"] = name
@@ -219,8 +229,13 @@
/// Adds a new brother to the team
/datum/team/brother_team/proc/add_brother(mob/living/new_brother, source)
#ifndef TESTING
if (isnull(new_brother) || isnull(new_brother.mind) || !GET_CLIENT(new_brother) || new_brother.mind.has_antag_datum(/datum/antagonist/brother))
return FALSE
#else
if (isnull(new_brother) || new_brother.mind.has_antag_datum(/datum/antagonist/brother))
return FALSE
#endif
set_brothers_left(brothers_left - 1)
for (var/datum/mind/brother_mind as anything in members)