Allows roundstart observers to freely use antag HUD without losing respawnability (#23009)

* First pass

* do away with old antag hud variable

* rework cannotPossess

* some verification + cleanups

* Update code/modules/mob/dead/observer/observer_base.dm

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

* splits up log call

* Slightly refactor proc calls, continuing contra's review

* Log admin

---------

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
Luc
2023-11-21 13:00:13 +00:00
committed by GitHub
co-authored by Contrabang
parent f70b534aee
commit 9384c2a074
19 changed files with 74 additions and 34 deletions
+10 -2
View File
@@ -62,14 +62,22 @@ GLOBAL_DATUM_INIT(ghost_hud_panel, /datum/ui_module/ghost_hud_panel, new)
to_chat(ghost, "<span class='danger'>You have been banned from using this feature.</span>")
return FALSE
// Check if this is the first time they're turning on Antag HUD.
if(!check_rights(R_ADMIN | R_MOD, FALSE) && !ghost.has_enabled_antagHUD && GLOB.configuration.general.restrict_antag_hud_rejoin)
if(!check_rights(R_ADMIN | R_MOD, FALSE) && !ghost.is_roundstart_observer() && GLOB.configuration.general.restrict_antag_hud_rejoin && !ghost.has_ahudded())
var/response = alert(ghost, "If you turn this on, you will not be able to take any part in the round.", "Are you sure you want to enable antag HUD?", "Yes", "No")
if(response == "No")
return FALSE
ghost.has_enabled_antagHUD = TRUE
ghost.can_reenter_corpse = FALSE
REMOVE_TRAIT(ghost, TRAIT_RESPAWNABLE, GHOSTED)
log_admin("[key_name(ghost)] has enabled antaghud as an observer and forfeited respawnability.")
message_admins("[key_name(ghost)] has enabled antaghud as an observer and forfeited respawnability.")
else if(ghost.is_roundstart_observer() && !ghost.has_ahudded())
log_admin("[key_name(ghost)] has enabled antaghud for the first time as a roundstart observer, keeping respawnability.")
GLOB.antag_hud_users |= ghost.ckey
ghost.antagHUD = TRUE
for(var/datum/atom_hud/antag/H in GLOB.huds)