Skip to content

Commit

Permalink
ok (#1265)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraith-54321 authored Mar 25, 2024
1 parent 7bc26e2 commit 4b92077
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
3 changes: 2 additions & 1 deletion code/modules/antagonists/_common/antag_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -486,14 +486,15 @@ GLOBAL_LIST_EMPTY(antagonists)

/// Adds a HUD that will show you other members with the same antagonist.
/// If an antag typepath is passed to `antag_to_check`, will check that, otherwise will use the source type.
/datum/antagonist/proc/add_team_hud(mob/target, antag_to_check)
/datum/antagonist/proc/add_team_hud(mob/target, antag_to_check, passed_hud_keys) //monkestation edit: adds passed_hud_keys
QDEL_NULL(team_hud_ref)

team_hud_ref = WEAKREF(target.add_alt_appearance(
/datum/atom_hud/alternate_appearance/basic/has_antagonist,
"antag_team_hud_[REF(src)]",
hud_image_on(target),
antag_to_check || type,
passed_hud_keys || hud_keys, //monkestation edit
))

// Add HUDs that they couldn't see before
Expand Down
7 changes: 4 additions & 3 deletions code/modules/antagonists/_common/antag_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ GLOBAL_LIST_EMPTY_TYPED(has_antagonist_huds, /datum/atom_hud/alternate_appearanc
/datum/atom_hud/alternate_appearance/basic/has_antagonist
var/antag_datum_type

/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, valid_keys) //monkestation edit: adds valid_keys
src.antag_datum_type = antag_datum_type
src.valid_keys = valid_keys
GLOB.has_antagonist_huds += src
return ..(key, I, NONE)

/datum/atom_hud/alternate_appearance/basic/has_antagonist/Destroy()
GLOB.has_antagonist_huds -= src
return ..()

/datum/atom_hud/alternate_appearance/basic/has_antagonist/mobShouldSee(mob/M)
return !!M.mind?.has_antag_datum(antag_datum_type)
///datum/atom_hud/alternate_appearance/basic/has_antagonist/mobShouldSee(mob/M) //monkestation removal, moved to the modular version of this file
// return !!M.mind?.has_antag_datum(antag_datum_type) //monkestation removal

/// An alternate appearance that will show all the antagonists this mob has
/datum/atom_hud/alternate_appearance/basic/antagonist_hud
Expand Down
4 changes: 4 additions & 0 deletions monkestation/code/modules/antagonists/_common/antag_datum.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/datum/antagonist
///The key or list of keys that are valid to see our antag hud/of huds we can see
var/list/hud_keys

/datum/antagonist/proc/antag_token(datum/mind/hosts_mind, mob/spender)
SHOULD_CALL_PARENT(FALSE)
if(isobserver(spender))
Expand Down
20 changes: 20 additions & 0 deletions monkestation/code/modules/antagonists/_common/antag_hud.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/datum/atom_hud/alternate_appearance/basic/has_antagonist
///The key or list of keys that are valid to see this hud, if unset then it will display to everyone with the antag datum like normal
var/list/valid_keys

/datum/atom_hud/alternate_appearance/basic/has_antagonist/mobShouldSee(mob/M)
var/datum/antagonist/antag_datum = M.mind?.has_antag_datum(antag_datum_type)
if(!antag_datum)
return FALSE

if(!valid_keys)
return TRUE

var/islist_datum_keys = islist(antag_datum.hud_keys)
if(islist(valid_keys))
if(islist_datum_keys)
return length(valid_keys - antag_datum.hud_keys) != length(valid_keys)
return antag_datum.hud_keys in valid_keys
else if(islist_datum_keys)
return valid_keys in antag_datum.hud_keys
return valid_keys == antag_datum.hud_keys
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -5778,6 +5778,7 @@
#include "monkestation\code\modules\aesthetics\subsystem\coloring.dm"
#include "monkestation\code\modules\aesthetics\walls\iron.dm"
#include "monkestation\code\modules\antagonists\_common\antag_datum.dm"
#include "monkestation\code\modules\antagonists\_common\antag_hud.dm"
#include "monkestation\code\modules\antagonists\brainwashing\brainwashing.dm"
#include "monkestation\code\modules\antagonists\brainwashing\brainwashing_alert.dm"
#include "monkestation\code\modules\antagonists\brainwashing\brainwashing_helpers.dm"
Expand Down

0 comments on commit 4b92077

Please sign in to comment.