Skip to content

Commit

Permalink
Settings option
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Sep 7, 2024
1 parent aeb4b9a commit 1457cba
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@
#define INHERENT_HUD_MEDICAL "med"
#define INHERENT_HUD_SECURITY "sec"
#define INHERENT_HUD_NEW_PLAYER "new"

#define HUD_MENTOR_SIGHT "New Player Markers"
9 changes: 4 additions & 5 deletions code/modules/admin/verbs/mentorhud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@
to_chat(src, "Only mentors may use this HUD!")
return FALSE

var/hud_choice = "New Player Markers"
prefs.observer_huds[hud_choice] = !prefs.observer_huds[hud_choice]
prefs.observer_huds[HUD_MENTOR_SIGHT] = !prefs.observer_huds[HUD_MENTOR_SIGHT]
prefs.save_preferences()

to_chat(src, SPAN_BOLDNOTICE("You toggled [hud_choice] to be [prefs.observer_huds[hud_choice] ? "ON" : "OFF"] by default when you are observer."))
to_chat(src, SPAN_BOLDNOTICE("You toggled [HUD_MENTOR_SIGHT] to be [prefs.observer_huds[HUD_MENTOR_SIGHT] ? "ON" : "OFF"] by default when you are observer."))

if(!isobserver(usr))
return
var/mob/dead/observer/observer_user = usr
var/datum/mob_hud/the_hud
the_hud = GLOB.huds[MOB_HUD_NEW_PLAYER]

observer_user.HUD_toggled[hud_choice] = prefs.observer_huds[hud_choice]
if(observer_user.HUD_toggled[hud_choice])
observer_user.HUD_toggled[HUD_MENTOR_SIGHT] = prefs.observer_huds[HUD_MENTOR_SIGHT]
if(observer_user.HUD_toggled[HUD_MENTOR_SIGHT])
the_hud.add_hud_to(observer_user, observer_user)
else
the_hud.remove_hud_from(observer_user, observer_user)
Expand Down
7 changes: 5 additions & 2 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ GLOBAL_LIST_INIT(bgstate_options, list(
"Security HUD" = FALSE,
"Squad HUD" = FALSE,
"Xeno Status HUD" = FALSE,
"New Player Markers" = FALSE
HUD_MENTOR_SIGHT = FALSE
)
var/ghost_vision_pref = GHOST_VISION_LEVEL_MID_NVG
var/ghost_orbit = GHOST_ORBIT_CIRCLE
Expand Down Expand Up @@ -549,7 +549,7 @@ GLOBAL_LIST_INIT(bgstate_options, list(
dat += "<b>You do not have the whitelist for this role.</b>"
if(MENU_MENTOR)
if(owner.check_whitelist_status(WHITELIST_MENTOR))
dat += "<b>Nothing here. For now.</b>"
dat += "<b>New Player Ghost HUD:</b> <a href='?_src_=prefs;preference=newplayer_ghost_hud'><b>[observer_huds[HUD_MENTOR_SIGHT] ? "Enabled" : "Disabled"]</b></a><br>"
else
dat += "<b>You do not have the whitelist for this role.</b>"
if(MENU_SETTINGS)
Expand Down Expand Up @@ -1917,6 +1917,9 @@ GLOBAL_LIST_INIT(bgstate_options, list(
return
plane_master.backdrop(user?.client.mob)

if("newplayer_ghost_hud")
observer_huds[HUD_MENTOR_SIGHT] = !observer_huds[HUD_MENTOR_SIGHT]

if("auto_fit_viewport")
auto_fit_viewport = !auto_fit_viewport
if(auto_fit_viewport && owner)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@
owner.typing_indicators = TRUE

if(!observer_huds)
observer_huds = list("Medical HUD" = FALSE, "Security HUD" = FALSE, "Squad HUD" = FALSE, "Xeno Status HUD" = FALSE, "New Player Markers" = FALSE)
observer_huds = list("Medical HUD" = FALSE, "Security HUD" = FALSE, "Squad HUD" = FALSE, "Xeno Status HUD" = FALSE, HUD_MENTOR_SIGHT = FALSE)

return 1

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@
if("Faction CLF HUD")
the_hud= GLOB.huds[MOB_HUD_FACTION_CLF]
the_hud.add_hud_to(src, src)
if("New Player Markers")
if(HUD_MENTOR_SIGHT)
the_hud= GLOB.huds[MOB_HUD_NEW_PLAYER]
the_hud.add_hud_to(src, src)

Expand Down

0 comments on commit 1457cba

Please sign in to comment.