Skip to content

Commit

Permalink
OOC prefix proc (#2536)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->

# About the pull request
Adds a proc to check OOC prefixes, and adds prefixes for Staff and
Mentor. Allows for clear indication of who's talking in OOC, and useful
for planned restructure.
<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding, and may discourage maintainers from reviewing or merging
your PR. This section is not strictly required for (non-controversial)
fix PRs or backend PRs. -->


# Testing Photographs and Procedure
<!-- Include any screenshots/videos/debugging steps of the modified code
functioning successfully, ideally including edge cases. -->
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. Please note that
maintainers freely reserve the right to remove and add tags should they
deem it appropriate. You can attempt to finagle the system all you want,
but it's best to shoot for clear communication right off the bat. -->
<!-- If you add a name after the ':cl', that name will be used in the
changelog. You must add your CKEY after the CL if your GitHub name
doesn't match. Be sure to properly mark your PRs to prevent unnecessary
GBP loss. Maintainers freely reserve the right to remove and add tags
should they deem it appropriate. -->

:cl:
add: Added prefixes in OOC for Staff and Mentors. Created a proc to
check for these prefixes and Donator.
fix: Fixed isCouncil check.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! -->
  • Loading branch information
realforest2001 committed Aug 17, 2023
1 parent e369a8b commit b4121c8
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 19 deletions.
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
32 changes: 23 additions & 9 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]"
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>")
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()
var/prefix = ""
if(prefs.unlock_content && (prefs.toggle_prefs & TOGGLE_MEMBER_PUBLIC))
var/byond = icon('icons/effects/effects.dmi', "byondlogo")
prefix += "[icon2html(byond, GLOB.clients)]"
if(CONFIG_GET(flag/ooc_country_flags) && (prefs.toggle_prefs & TOGGLE_OOC_FLAG))
prefix += "[country2chaticon(src.country, GLOB.clients)]"
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)]"
if(prefix)
prefix = "[prefix] "
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.

0 comments on commit b4121c8

Please sign in to comment.