Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mentor New Player Markers #6860

Merged
merged 12 commits into from
Oct 8, 2024
6 changes: 6 additions & 0 deletions code/__DEFINES/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@
#define NOTIFY_JOIN_XENO "join_xeno"
#define NOTIFY_XENO_TACMAP "xeno_tacmap"
#define NOTIFY_USCM_TACMAP "uscm_tacmap"

#define INHERENT_HUD_MEDICAL "med"
#define INHERENT_HUD_SECURITY "sec"
#define INHERENT_HUD_NEW_PLAYER "new"

#define HUD_MENTOR_SIGHT "New Player Markers"
2 changes: 2 additions & 0 deletions code/__DEFINES/mob_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define HUNTER_CLAN "25" //Displays a colored icon to represent ingame Hunter Clans
#define HUNTER_HUD "26" //Displays various statuses on mobs for Hunters to identify targets
#define HOLOCARD_HUD "27" //Displays the holocards set by medical personnel
#define NEW_PLAYER_HUD "29" //Makes it easy to see new players.

//data HUD (medhud, sechud) defines
#define MOB_HUD_SECURITY_BASIC 1
Expand All @@ -47,6 +48,7 @@
#define MOB_HUD_HUNTER 16
#define MOB_HUD_HUNTER_CLAN 17
#define MOB_HUD_EXECUTE 18
#define MOB_HUD_NEW_PLAYER 19

//for SL/FTL/LZ targeting on locator huds
#define TRACKER_SL "track_sl"
Expand Down
81 changes: 51 additions & 30 deletions code/datums/mob_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list(
MOB_HUD_HUNTER = new /datum/mob_hud/hunter_hud(),
MOB_HUD_HUNTER_CLAN = new /datum/mob_hud/hunter_clan(),
MOB_HUD_EXECUTE = new /datum/mob_hud/execute_hud(),
MOB_HUD_NEW_PLAYER = new /datum/mob_hud/new_player(),
))

/datum/mob_hud
Expand Down Expand Up @@ -161,6 +162,9 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list(



/datum/mob_hud/new_player
hud_icons = list(NEW_PLAYER_HUD)

//Xeno status hud, for xenos
/datum/mob_hud/xeno
hud_icons = list(HEALTH_HUD_XENO, PLASMA_HUD, PHEROMONE_HUD, QUEEN_OVERWATCH_HUD, ARMOR_HUD_XENO, XENO_STATUS_HUD, XENO_BANISHED_HUD, HUNTER_HUD)
Expand Down Expand Up @@ -230,6 +234,7 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list(
if(istype(hud, /datum/mob_hud/xeno)) //this one is xeno only
continue
hud.add_to_hud(src)
hud_set_new_player()

/mob/living/carbon/xenomorph/add_to_all_mob_huds()
for(var/datum/mob_hud/hud in GLOB.huds)
Expand Down Expand Up @@ -667,6 +672,7 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list(
holder.overlays += image('icons/mob/hud/marine_hud.dmi', src, "hudmutineer")
return

hud_set_new_player()
F.modify_hud_holder(holder, src)

/mob/living/carbon/human/yautja/hud_set_squad()
Expand All @@ -689,38 +695,29 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list(
/mob/proc/hud_set_hunter()
return

GLOBAL_DATUM(hud_icon_hunter_gear, /image)
GLOBAL_DATUM(hud_icon_hunter_hunted, /image)
GLOBAL_DATUM(hud_icon_hunter_dishonored, /image)
GLOBAL_DATUM(hud_icon_hunter_honored, /image)
GLOBAL_DATUM(hud_icon_hunter_thralled, /image)

GLOBAL_DATUM_INIT(hud_icon_hunter_gear, /image, image('icons/mob/hud/hud_yautja.dmi', src, "hunter_gear"))
GLOBAL_DATUM_INIT(hud_icon_hunter_hunted, /image, image('icons/mob/hud/hud_yautja.dmi', src, "hunter_hunted"))
GLOBAL_DATUM_INIT(hud_icon_hunter_dishonored, /image, image('icons/mob/hud/hud_yautja.dmi', src, "hunter_dishonored"))
GLOBAL_DATUM_INIT(hud_icon_hunter_honored, /image, image('icons/mob/hud/hud_yautja.dmi', src, "hunter_honored"))
GLOBAL_DATUM_INIT(hud_icon_hunter_thralled, /image, image('icons/mob/hud/hud_yautja.dmi', src, "hunter_thralled"))


/mob/living/carbon/hud_set_hunter()
var/image/holder = hud_list[HUNTER_HUD]
holder.icon_state = "hudblank"
holder.overlays.Cut()
if(hunter_data.hunted)
if(!GLOB.hud_icon_hunter_hunted)
GLOB.hud_icon_hunter_hunted = image('icons/mob/hud/hud_yautja.dmi', src, "hunter_hunted")
holder.overlays += GLOB.hud_icon_hunter_hunted

if(hunter_data.dishonored)
if(!GLOB.hud_icon_hunter_dishonored)
GLOB.hud_icon_hunter_dishonored = image('icons/mob/hud/hud_yautja.dmi', src, "hunter_dishonored")
holder.overlays += GLOB.hud_icon_hunter_dishonored
else if(hunter_data.honored)
if(!GLOB.hud_icon_hunter_honored)
GLOB.hud_icon_hunter_honored = image('icons/mob/hud/hud_yautja.dmi', src, "hunter_honored")
holder.overlays += GLOB.hud_icon_hunter_honored

if(hunter_data.thralled)
if(!GLOB.hud_icon_hunter_thralled)
GLOB.hud_icon_hunter_thralled = image('icons/mob/hud/hud_yautja.dmi', src, "hunter_thralled")
holder.overlays += GLOB.hud_icon_hunter_thralled
else if(hunter_data.gear)
if(!GLOB.hud_icon_hunter_gear)
GLOB.hud_icon_hunter_gear = image('icons/mob/hud/hud_yautja.dmi', src, "hunter_gear")
holder.overlays += GLOB.hud_icon_hunter_gear

hud_list[HUNTER_HUD] = holder
Expand All @@ -731,17 +728,11 @@ GLOBAL_DATUM(hud_icon_hunter_thralled, /image)
holder.overlays.Cut()
holder.pixel_x = -18
if(hunter_data.hunted)
if(!GLOB.hud_icon_hunter_hunted)
GLOB.hud_icon_hunter_hunted = image('icons/mob/hud/hud_yautja.dmi', src, "hunter_hunted")
holder.overlays += GLOB.hud_icon_hunter_hunted

if(hunter_data.dishonored)
if(!GLOB.hud_icon_hunter_dishonored)
GLOB.hud_icon_hunter_dishonored = image('icons/mob/hud/hud_yautja.dmi', src, "hunter_dishonored")
holder.overlays += GLOB.hud_icon_hunter_dishonored
else if(hunter_data.honored)
if(!GLOB.hud_icon_hunter_honored)
GLOB.hud_icon_hunter_honored = image('icons/mob/hud/hud_yautja.dmi', src, "hunter_honored")
holder.overlays += GLOB.hud_icon_hunter_honored

hud_list[HUNTER_HUD] = holder
Expand All @@ -750,25 +741,19 @@ GLOBAL_DATUM(hud_icon_hunter_thralled, /image)
/mob/proc/hud_set_order()
return

GLOBAL_DATUM(hud_icon_hudmove, /image)
GLOBAL_DATUM(hud_icon_hudhold, /image)
GLOBAL_DATUM(hud_icon_hudfocus, /image)
GLOBAL_DATUM_INIT(hud_icon_hudmove, /image, image('icons/mob/hud/marine_hud.dmi', src, "hudmove"))
GLOBAL_DATUM_INIT(hud_icon_hudhold, /image, image('icons/mob/hud/marine_hud.dmi', src, "hudhold"))
GLOBAL_DATUM_INIT(hud_icon_hudfocus, /image, image('icons/mob/hud/marine_hud.dmi', src, "hudfocus"))
// ORDER HUD
/mob/living/carbon/human/hud_set_order()
var/image/holder = hud_list[ORDER_HUD]
holder.icon_state = "hudblank"
holder.overlays.Cut()
if(mobility_aura)
if(!GLOB.hud_icon_hudmove)
GLOB.hud_icon_hudmove = image('icons/mob/hud/marine_hud.dmi', src, "hudmove")
holder.overlays += GLOB.hud_icon_hudmove
if(protection_aura)
if(!GLOB.hud_icon_hudhold)
GLOB.hud_icon_hudhold = image('icons/mob/hud/marine_hud.dmi', src, "hudhold")
holder.overlays += GLOB.hud_icon_hudhold
if(marksman_aura)
if(!GLOB.hud_icon_hudfocus)
GLOB.hud_icon_hudfocus = image('icons/mob/hud/marine_hud.dmi', src, "hudfocus")
holder.overlays += GLOB.hud_icon_hudfocus
hud_list[ORDER_HUD] = holder

Expand Down Expand Up @@ -839,3 +824,39 @@ GLOBAL_DATUM(hud_icon_hudfocus, /image)
var/freeze_found = HAS_TRAIT(src, TRAIT_IMMOBILIZED) && body_position == STANDING_UP && !buckled // Eligible targets are unable to move but can stand and aren't buckled (eg nested) - This is to convey that they are temporarily unable to move
if (freeze_found)
freeze_holder.overlays += image('icons/mob/hud/hud.dmi', src, "xeno_freeze")



/mob/proc/hud_set_new_player()
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
return

GLOBAL_DATUM_INIT(hud_icon_new_player_1, /image, image('icons/mob/hud/hud.dmi', src, "new_player_marker_1"))
GLOBAL_DATUM_INIT(hud_icon_new_player_2, /image, image('icons/mob/hud/hud.dmi', src, "new_player_marker_2"))
GLOBAL_DATUM_INIT(hud_icon_new_player_3, /image, image('icons/mob/hud/hud.dmi', src, "new_player_marker_3"))


/mob/living/carbon/human/hud_set_new_player()
if(!client || !job)
return FALSE
var/image/holder = hud_list[NEW_PLAYER_HUD]
holder.icon_state = "hudblank"
holder.overlays.Cut()
holder.pixel_y = 8
var/total_time = client.get_total_human_playtime()
var/playtime = get_job_playtime(client, job)
var/marker = GLOB.hud_icon_new_player_3

var/low_time = FALSE
if(total_time < JOB_PLAYTIME_TIER_2)
marker = GLOB.hud_icon_new_player_2
low_time = TRUE

if(playtime <= JOB_PLAYTIME_TIER_1)
if(low_time)
marker = GLOB.hud_icon_new_player_1
else if(!low_time)
return FALSE
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved

holder.overlays += marker
hud_list[NEW_PLAYER_HUD] = holder
return TRUE
10 changes: 8 additions & 2 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,13 @@ GLOBAL_LIST_INIT(roundstart_mod_verbs, list(
/client/proc/toggle_ob_spawn
))

GLOBAL_LIST_INIT(mentor_verbs, list(
/client/proc/cmd_mentor_say,
/datum/admins/proc/imaginary_friend,
/client/proc/toggle_newplayer_ghost_hud,
/client/proc/toggle_newplayer_ic_hud
))

/client/proc/add_admin_verbs()
if(!admin_holder)
return
Expand All @@ -332,8 +339,7 @@ GLOBAL_LIST_INIT(roundstart_mod_verbs, list(
add_verb(src, GLOB.admin_verbs_admin)
add_verb(src, GLOB.admin_verbs_major_event)
if(CLIENT_HAS_RIGHTS(src, R_MENTOR))
add_verb(src, /client/proc/cmd_mentor_say)
add_verb(src, /datum/admins/proc/imaginary_friend)
add_verb(src, GLOB.mentor_verbs)
if(CLIENT_HAS_RIGHTS(src, R_BUILDMODE))
add_verb(src, /client/proc/togglebuildmodeself)
if(CLIENT_HAS_RIGHTS(src, R_SERVER))
Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/tabs/admin_tab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@

/client/proc/cmd_mentor_say(msg as text)
set name = "MentorSay"
set category = "OOC"
set category = "Admin.Mentor"
set hidden = 0

if(!check_rights(R_MENTOR|R_MOD|R_ADMIN))
Expand Down Expand Up @@ -608,7 +608,7 @@
return

/datum/admins/proc/imaginary_friend()
set category = "OOC.Mentor"
set category = "Admin.Mentor"
set name = "Imaginary Friend"

var/mob/user = usr
Expand Down
57 changes: 57 additions & 0 deletions code/modules/admin/verbs/mentorhud.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/client/proc/toggle_newplayer_ghost_hud()
set name = "Toggle Markers (Ghost)"
set category = "Admin.Mentor"
set desc = "Toggles observer pref for mentor markers."

if(!admin_holder || !(admin_holder.rights & R_MENTOR))
to_chat(src, "Only mentors may use this HUD!")
return FALSE

prefs.observer_huds[HUD_MENTOR_SIGHT] = !prefs.observer_huds[HUD_MENTOR_SIGHT]
prefs.save_preferences()

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_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)

/client/proc/toggle_newplayer_ic_hud(sea_forced = FALSE)
set category = "Admin.Mentor"
set name = "Toggle Markers (IC)"
set desc = "Toggles new player HUD while IC."

if(!admin_holder || !(admin_holder.rights & R_MENTOR))
if(!sea_forced)
to_chat(src, "Only mentors may use this HUD!")
return FALSE

var/mob/living/carbon/human/mentor = mob
if(!ishuman(mentor))
to_chat(src, SPAN_WARNING("You cannot use this power as a non-human!"))
return FALSE

if(!mentor.looc_overhead && !(mentor.inherent_huds_toggled[INHERENT_HUD_NEW_PLAYER]))
to_chat(src, SPAN_WARNING("You are not in a mentor role! (Overhead LOOC is disabled!)"))
return FALSE

var/datum/mob_hud/the_hud
the_hud = GLOB.huds[MOB_HUD_NEW_PLAYER]

if(mentor.inherent_huds_toggled[INHERENT_HUD_NEW_PLAYER])
mentor.inherent_huds_toggled[INHERENT_HUD_NEW_PLAYER] = FALSE
the_hud.remove_hud_from(mentor, mentor)
to_chat(mentor, SPAN_INFO("<B>New Player Markers Disabled</B>"))
else
mentor.inherent_huds_toggled[INHERENT_HUD_NEW_PLAYER] = TRUE
the_hud.add_hud_to(mentor, mentor)
to_chat(mentor, SPAN_INFO("<B>New Player Markers Enabled</B>"))
return TRUE
8 changes: 6 additions & 2 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ GLOBAL_LIST_INIT(bgstate_options, list(
"Medical HUD" = FALSE,
"Security HUD" = FALSE,
"Squad HUD" = FALSE,
"Xeno Status HUD" = FALSE
"Xeno Status HUD" = FALSE,
HUD_MENTOR_SIGHT = FALSE
)
var/ghost_vision_pref = GHOST_VISION_LEVEL_MID_NVG
var/ghost_orbit = GHOST_ORBIT_CIRCLE
Expand Down Expand Up @@ -551,7 +552,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 @@ -1945,6 +1946,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 @@ -388,7 +388,7 @@
owner.typing_indicators = TRUE

if(!observer_huds)
observer_huds = list("Medical HUD" = FALSE, "Security HUD" = FALSE, "Squad HUD" = FALSE, "Xeno Status HUD" = 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
1 change: 1 addition & 0 deletions code/modules/gear_presets/uscm_ship.dm
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@
new_human.equip_to_slot_or_del(new /obj/item/device/whistle(new_human), WEAR_R_HAND)

/datum/equipment_preset/uscm_ship/sea/load_rank(mob/living/carbon/human/rankee, client/mob_client)
mob_client.toggle_newplayer_ic_hud(TRUE)
if(rankee?.client?.prefs?.pref_special_job_options[rank])
var/paygrade_choice = get_paygrade_id_by_name(rankee.client.prefs.pref_special_job_options[rank])
return paygrade_choice
Expand Down
37 changes: 20 additions & 17 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -376,35 +376,38 @@
if(!client || !client.prefs)
return

var/datum/mob_hud/H
var/datum/mob_hud/the_hud
HUD_toggled = client.prefs.observer_huds
for(var/i in HUD_toggled)
if(HUD_toggled[i])
switch(i)
if("Medical HUD")
H = GLOB.huds[MOB_HUD_MEDICAL_OBSERVER]
H.add_hud_to(src, src)
the_hud = GLOB.huds[MOB_HUD_MEDICAL_OBSERVER]
the_hud.add_hud_to(src, src)
if("Security HUD")
H = GLOB.huds[MOB_HUD_SECURITY_ADVANCED]
H.add_hud_to(src, src)
the_hud= GLOB.huds[MOB_HUD_SECURITY_ADVANCED]
the_hud.add_hud_to(src, src)
if("Squad HUD")
H = GLOB.huds[MOB_HUD_FACTION_OBSERVER]
H.add_hud_to(src, src)
the_hud= GLOB.huds[MOB_HUD_FACTION_OBSERVER]
the_hud.add_hud_to(src, src)
if("Xeno Status HUD")
H = GLOB.huds[MOB_HUD_XENO_STATUS]
H.add_hud_to(src, src)
the_hud= GLOB.huds[MOB_HUD_XENO_STATUS]
the_hud.add_hud_to(src, src)
if("Faction UPP HUD")
H = GLOB.huds[MOB_HUD_FACTION_UPP]
H.add_hud_to(src, src)
the_hud= GLOB.huds[MOB_HUD_FACTION_UPP]
the_hud.add_hud_to(src, src)
if("Faction Wey-Yu HUD")
H = GLOB.huds[MOB_HUD_FACTION_WY]
H.add_hud_to(src, src)
the_hud= GLOB.huds[MOB_HUD_FACTION_WY]
the_hud.add_hud_to(src, src)
if("Faction TWE HUD")
H = GLOB.huds[MOB_HUD_FACTION_TWE]
H.add_hud_to(src, src)
the_hud= GLOB.huds[MOB_HUD_FACTION_TWE]
the_hud.add_hud_to(src, src)
if("Faction CLF HUD")
H = GLOB.huds[MOB_HUD_FACTION_CLF]
H.add_hud_to(src, src)
the_hud= GLOB.huds[MOB_HUD_FACTION_CLF]
the_hud.add_hud_to(src, src)
if(HUD_MENTOR_SIGHT)
the_hud= GLOB.huds[MOB_HUD_NEW_PLAYER]
the_hud.add_hud_to(src, src)

see_invisible = INVISIBILITY_OBSERVER

Expand Down
Loading
Loading