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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
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
48 changes: 48 additions & 0 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 Down Expand Up @@ -839,3 +845,45 @@ 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(hud_icon_new_player_1, /image)
GLOBAL_DATUM(hud_icon_new_player_2, /image)
GLOBAL_DATUM(hud_icon_new_player_3, /image)
Comment on lines +854 to +856
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use GLOBAL_DATUM_INIT instead of having every human potentially set it up?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how to make GLOBAL_DATUM_INIT generate an image



/mob/living/carbon/human/hud_set_new_player()
if(!GLOB.hud_icon_new_player_1)
GLOB.hud_icon_new_player_1 = image('icons/mob/hud/hud.dmi', src, "new_player_marker_1")
if(!GLOB.hud_icon_new_player_2)
GLOB.hud_icon_new_player_2 = image('icons/mob/hud/hud.dmi', src, "new_player_marker_2")
if(!GLOB.hud_icon_new_player_3)
GLOB.hud_icon_new_player_3 = image('icons/mob/hud/hud.dmi', src, "new_player_marker_3")
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 @@ -317,6 +317,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 @@ -331,8 +338,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 @@ -75,7 +75,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 @@ -548,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 @@ -1916,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)
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 @@ -644,6 +644,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
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/human/human_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
var/last_chew = 0

//taken from human.dm
hud_possible = list(HEALTH_HUD, STATUS_HUD, STATUS_HUD_OOC, STATUS_HUD_XENO_INFECTION, STATUS_HUD_XENO_CULTIST, ID_HUD, WANTED_HUD, ORDER_HUD, XENO_HOSTILE_ACID, XENO_HOSTILE_SLOW, XENO_HOSTILE_TAG, XENO_HOSTILE_FREEZE, XENO_EXECUTE, HUNTER_CLAN, HUNTER_HUD, FACTION_HUD, HOLOCARD_HUD)
hud_possible = list(HEALTH_HUD, STATUS_HUD, STATUS_HUD_OOC, STATUS_HUD_XENO_INFECTION, STATUS_HUD_XENO_CULTIST, ID_HUD, WANTED_HUD, ORDER_HUD, XENO_HOSTILE_ACID, XENO_HOSTILE_SLOW, XENO_HOSTILE_TAG, XENO_HOSTILE_FREEZE, XENO_EXECUTE, HUNTER_CLAN, HUNTER_HUD, FACTION_HUD, HOLOCARD_HUD, NEW_PLAYER_HUD)
var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us.
var/allow_gun_usage = TRUE
var/melee_allowed = TRUE
Expand All @@ -148,7 +148,7 @@
/// A list of all the shrapnel currently embedded in the human
var/list/atom/movable/embedded_items = list()

var/list/synthetic_HUD_toggled = list(FALSE,FALSE)
var/list/inherent_huds_toggled = list(INHERENT_HUD_MEDICAL = FALSE, INHERENT_HUD_SECURITY = FALSE, INHERENT_HUD_NEW_PLAYER = FALSE)

var/default_lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE

Expand Down
20 changes: 10 additions & 10 deletions code/modules/mob/living/carbon/human/powers/human_powers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -269,22 +269,22 @@
if(usr.is_mob_incapacitated())
return

var/datum/mob_hud/H
var/chosen_HUD = 1
var/datum/mob_hud/the_hud
var/chosen_HUD = INHERENT_HUD_MEDICAL
switch(hud_choice)
if("Medical HUD")
H = GLOB.huds[MOB_HUD_MEDICAL_ADVANCED]
the_hud = GLOB.huds[MOB_HUD_MEDICAL_ADVANCED]
if("Security HUD")
H = GLOB.huds[MOB_HUD_SECURITY_ADVANCED]
chosen_HUD = 2
the_hud = GLOB.huds[MOB_HUD_SECURITY_ADVANCED]
chosen_HUD = INHERENT_HUD_SECURITY
else
return

if(synthetic_HUD_toggled[chosen_HUD])
synthetic_HUD_toggled[chosen_HUD] = FALSE
H.remove_hud_from(src, src)
if(inherent_huds_toggled[chosen_HUD])
inherent_huds_toggled[chosen_HUD] = FALSE
the_hud.remove_hud_from(src, src)
to_chat(src, SPAN_INFO("<B>[hud_choice] Disabled</B>"))
else
synthetic_HUD_toggled[chosen_HUD] = TRUE
H.add_hud_to(src, src)
inherent_huds_toggled[chosen_HUD] = TRUE
the_hud.add_hud_to(src, src)
to_chat(src, SPAN_INFO("<B>[hud_choice] Enabled</B>"))
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/Xenomorph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
see_in_dark = 12
recovery_constant = 1.5
see_invisible = SEE_INVISIBLE_LIVING
hud_possible = list(HEALTH_HUD_XENO, PLASMA_HUD, PHEROMONE_HUD, QUEEN_OVERWATCH_HUD, ARMOR_HUD_XENO, XENO_STATUS_HUD, XENO_BANISHED_HUD, XENO_HOSTILE_ACID, XENO_HOSTILE_SLOW, XENO_HOSTILE_TAG, XENO_HOSTILE_FREEZE, HUNTER_HUD)
hud_possible = list(HEALTH_HUD_XENO, PLASMA_HUD, PHEROMONE_HUD, QUEEN_OVERWATCH_HUD, ARMOR_HUD_XENO, XENO_STATUS_HUD, XENO_BANISHED_HUD, XENO_HOSTILE_ACID, XENO_HOSTILE_SLOW, XENO_HOSTILE_TAG, XENO_HOSTILE_FREEZE, HUNTER_HUD, NEW_PLAYER_HUD)
unacidable = TRUE
rebounds = TRUE
faction = FACTION_XENOMORPH
Expand Down
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,7 @@
#include "code\modules\admin\verbs\getlogs.dm"
#include "code\modules\admin\verbs\load_event_level.dm"
#include "code\modules\admin\verbs\map_template_loadverb.dm"
#include "code\modules\admin\verbs\mentorhud.dm"
#include "code\modules\admin\verbs\mob_verbs.dm"
#include "code\modules\admin\verbs\mooc.dm"
#include "code\modules\admin\verbs\noclip.dm"
Expand Down
Binary file modified icons/mob/hud/hud.dmi
Binary file not shown.
Loading