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

OOC prefix proc #2536

Merged
merged 16 commits into from
Aug 17, 2023
2 changes: 1 addition & 1 deletion code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ var/global/list/whitelist_hierarchy = list(WHITELIST_NORMAL, WHITELIST_COUNCIL,

#define WHITELIST_EVERYTHING (WHITELISTS_GENERAL|WHITELISTS_COUNCIL|WHITELISTS_LEADER)

#define isCouncil(A) (RoleAuthority.roles_whitelist[A.ckey] & (WHITELIST_YAUTJA_COUNCIL | WHITELIST_SYNTHETIC_COUNCIL | WHITELIST_COMMANDER_COUNCIL))
#define isCouncil(A) (RoleAuthority.roles_whitelist[A.ckey] & WHITELIST_YAUTJA_COUNCIL) || (RoleAuthority.roles_whitelist[A.ckey] & WHITELIST_SYNTHETIC_COUNCIL) || (RoleAuthority.roles_whitelist[A.ckey] & WHITELIST_COMMANDER_COUNCIL)

//=================================================

Expand Down
22 changes: 18 additions & 4 deletions code/game/verbs/ooc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,38 @@
display_colour = CONFIG_GET(string/ooc_color_default)

msg = process_chat_markup(msg, list("*"))

var/ooc_prefix = handle_ooc_prefix()
for(var/client/C in GLOB.clients)
if(C.prefs.toggles_chat & CHAT_OOC)
var/display_name = src.key
if(prefs.unlock_content)
if(prefs.toggle_prefs & TOGGLE_MEMBER_PUBLIC)
var/byond = icon('icons/effects/effects.dmi', "byondlogo")
display_name = "[icon2html(byond, GLOB.clients)][display_name]"
ooc_prefix = "[icon2html(byond, GLOB.clients)][ooc_prefix]"
if(CONFIG_GET(flag/ooc_country_flags))
if(prefs.toggle_prefs & TOGGLE_OOC_FLAG)
display_name = "[country2chaticon(src.country, GLOB.clients)][display_name]"
to_chat(C, "<font color='[display_colour]'><span class='ooc linkify'>[src.donator ? "\[D\] " : ""]<span class='prefix'>OOC: [display_name]</span>: <span class='message'>[msg]</span></span></font>")
ooc_prefix = "[country2chaticon(src.country, GLOB.clients)][ooc_prefix]"
Copy link
Contributor

Choose a reason for hiding this comment

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

All of this should go into handle_ooc_prefix(). Otherwise you are adding membership icon and flag once per everybody listening.
image

to_chat(C, "<font color='[display_colour]'><span class='ooc linkify'>[ooc_prefix]<span class='prefix'>OOC: [display_name]</span>: <span class='message'>[msg]</span></span></font>")

/client/proc/set_ooc_color_global(newColor as color)
set name = "OOC Text Color - Global"
set desc = "Set to yellow for eye burning goodness."
set category = "OOC.OOC"
GLOB.ooc_color_override = newColor

///Used by OOC chat to generate icons for player prefix. Intended to make it easy to see at a glance if someone is staff, WL Council or Mentor.
/client/proc/handle_ooc_prefix()
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
var/prefix = ""
if(donator)
prefix += "[icon2html('icons/ooc.dmi', GLOB.clients, "Donator")]"
if(isCouncil(src))
prefix += "[icon2html('icons/ooc.dmi', GLOB.clients, "WhitelistCouncil")]"
if(admin_holder)
var/list/rank_icons = icon_states('icons/ooc.dmi')
var/rankname = admin_holder.rank
if(rankname in rank_icons)
prefix += "[icon2html('icons/ooc.dmi', GLOB.clients, admin_holder.rank)]"
return "[prefix] "

/client/verb/looc(msg as text)
set name = "LOOC" //Gave this shit a shorter name so you only have to time out "ooc" rather than "ooc message" to use it --NeoFite
Expand Down
1 change: 1 addition & 0 deletions code/global.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#define CLIENT_HAS_RIGHTS(cli, flags) ((cli?.admin_holder?.rights & flags) == flags)
#define CLIENT_IS_STAFF(cli) (cli?.admin_holder?.rights & (R_MOD|R_ADMIN))
#define CLIENT_IS_MENTOR(cli) CLIENT_HAS_RIGHTS(cli, R_MENTOR)

#define AHOLD_IS_MOD(ahold) (ahold && (ahold.rights & R_MOD))
#define AHOLD_IS_ADMIN(ahold) (ahold && (ahold.rights & R_ADMIN))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ var/list/roundstart_mod_verbs = list(
add_verb(src, clan_verbs)

/client/proc/add_admin_whitelists()
if(CLIENT_HAS_RIGHTS(src, R_MENTOR))
if(CLIENT_IS_MENTOR(src))
RoleAuthority.roles_whitelist[ckey] |= WHITELIST_MENTOR
if(CLIENT_IS_STAFF(src))
RoleAuthority.roles_whitelist[ckey] |= WHITELIST_JOE
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/randomverbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
return

if(!CLIENT_IS_STAFF(src))
if(!CLIENT_HAS_RIGHTS(src, R_MENTOR))
if(!CLIENT_IS_MENTOR(src))
to_chat(src, "Only staff members have permission to use this.")
return
if(!CONFIG_GET(flag/mentor_tools))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/client/client_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
var/area = null
var/time_died_as_mouse = null //when the client last died as a mouse

var/donator = 0
var/donator = FALSE
var/adminhelped = 0

var/datum/click_intercept = null
Expand Down
2 changes: 1 addition & 1 deletion code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(

for(var/line in lines)
if(src.ckey == line)
src.donator = 1
src.donator = TRUE
add_verb(src, /client/proc/set_ooc_color_self)

//if(prefs.window_skin & TOGGLE_WINDOW_SKIN)
Expand Down
10 changes: 5 additions & 5 deletions code/modules/mentor/mentorhelp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
if(to_thread_mentor && mentor)
hitlist |= mentor
for(var/client/candidate in GLOB.admins)
if(to_mentors && CLIENT_HAS_RIGHTS(candidate, R_MENTOR))
if(to_mentors && CLIENT_IS_MENTOR(candidate))
hitlist |= candidate
else if(to_staff && CLIENT_IS_STAFF(candidate))
hitlist |= candidate
Expand Down Expand Up @@ -137,7 +137,7 @@
if(!sender || !check_open(sender))
return
if(sender != author)
if(!CLIENT_HAS_RIGHTS(sender, R_MENTOR))
if(!CLIENT_IS_MENTOR(sender))
return

// If the mentor forgot to mark the mentorhelp, mark it for them
Expand Down Expand Up @@ -201,7 +201,7 @@
return

// Not a mentor/staff
if(!CLIENT_HAS_RIGHTS(thread_mentor, R_MENTOR))
if(!CLIENT_IS_MENTOR(thread_mentor))
return

mentor = thread_mentor
Expand Down Expand Up @@ -294,7 +294,7 @@
if(!check_open(responder))
return

if(!CLIENT_HAS_RIGHTS(responder, R_MENTOR))
if(!CLIENT_IS_MENTOR(responder))
return

// If the mentor forgot to mark the mentorhelp, mark it for them
Expand All @@ -314,7 +314,7 @@
if(!check_open(responder))
return

if(!CLIENT_HAS_RIGHTS(responder, R_MENTOR))
if(!CLIENT_IS_MENTOR(responder))
return

// Re-mark if they unmarked it while the dialog was open (???)
Expand Down
Binary file added icons/ooc.dmi
Binary file not shown.