Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 30 additions & 17 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -365,46 +365,56 @@
moblist += friend
return moblist

/proc/key_name(whom, include_link = null, include_name = 1, highlight_special_characters = 1, show_username = FALSE)
/proc/key_name(whom, include_link = null, include_name = 1, highlight_special_characters = 1, show_username = FALSE, logging = TRUE)
var/mob/M
var/client/C
var/key
var/ckey // If it's going to go anywhere programatic like logs, we want consistent formatting, so the ckey rather than the key
var/key // Otherwise, we can use the key for friendly display
var/username

if(!whom)
return "*null*"

if(istype(whom, /client))
C = whom
M = C.mob
ckey = C.ckey
key = C.key
username = C.username()

else if(ismob(whom))
M = whom
C = M.client
ckey = M.persistent_ckey
key = M.key
username = M.username()
else if(istype(whom, /datum))

else if(istype(whom, /datum) && !logging)
var/datum/D = whom
return "*invalid:[D.type]*"

else
return "*invalid*"

. = ""

if(key)
if(include_link && C)
. += "<a href='byond://?priv_msg=[C.ckey]'>"

if(show_username && username && username != key)
. += "[username] ([key])"
else
. += key

if(include_link)
if(C) . += "</a>"
else . += " (DC)"
// We still output the links in logging mode because message_admins is everywhere. They'll be stripped by logging backend later.
if(ckey && include_link)
. += "<a href='byond://?priv_msg=[ckey]'>"
else
include_link = FALSE

if(key && show_username && username && username != key)
. += "[username] ([logging ? ckey : key])"
else if(ckey && logging)
. += ckey
else if(key)
. += key
else
. += "*no key*"
. += "*no_key*" // No spaces here to be loosely format-compatible with ckeys

if(include_link)
. += "</a>"

if(include_name && M)
var/name
Expand All @@ -416,14 +426,17 @@

. += "/([name])"

if(!C)
. += " (DC)"

return .

/proc/key_name_admin(whom, include_name = 1)
return key_name(whom, 1, include_name)

/// Returns key_name with username shown when it differs from key - for admin contexts
/proc/key_name_with_username(whom, include_name = 1)
return key_name(whom, TRUE, include_name, TRUE, TRUE)
return key_name(whom, TRUE, include_name, TRUE, TRUE, logging = FALSE)


// returns the turf located at the map edge in the specified direction relative to A
Expand Down
1 change: 0 additions & 1 deletion code/controllers/configuration/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ SET_PROTECTED_DATUM(/datum/controller/configuration)
if(IsAdminAdvancedProcCall())
alert_proccall("configuration admin_reload")
return PROC_BLOCKED
log_admin("[key_name(usr)] has forcefully reloaded the configuration from disk.")
message_admins("[key_name_admin(usr)] has forcefully reloaded the configuration from disk.")
full_wipe()
Load(world.params[OVERRIDE_CONFIG_DIRECTORY_PARAMETER])
Expand Down