Active job bans are displayed to players when they join the lobby (#22732)

* you've got mail

* fixes to server load issues

* contra
This commit is contained in:
S34N
2023-11-04 20:19:23 +00:00
committed by GitHub
parent f01e3de488
commit ec21a774b7
3 changed files with 37 additions and 20 deletions
+34 -17
View File
@@ -32,7 +32,36 @@
return jobs
/client/verb/displayjobbans()
/**
* Lists all active jobbans for src client
*
* from_client_connection - If true, user will not recieve any info in chat if they have no job bans, used when a player loads into to the lobby.
*/
/client/proc/display_job_bans(from_client_connection = FALSE)
if(!from_client_connection) // Only reload if this is being checked by a user manually, as we load job bans at client new anyway
jbh.reload_jobbans(src)
if(!length(jbh.job_bans))
if(!from_client_connection)
to_chat(src, chat_box_red("<span class='warning'>You have no active jobbans!</span>"))
return
var/list/messages = list()
for(var/ban in jbh.job_bans)
var/datum/job_ban/JB = jbh.job_bans[ban] // Remember. Its assoc.
switch(JB.bantype)
if("JOB_PERMABAN")
messages.Add("<span class='warning'>[JB.bantype]: [JB.job] - REASON: [JB.reason], by [JB.a_ckey]; [JB.bantime]</span>")
if("JOB_TEMPBAN")
messages.Add("<span class='warning'>[JB.bantype]: [JB.job] - REASON: [JB.reason], by [JB.a_ckey]; [JB.bantime]; [JB.duration]; expires [JB.expiration_time]</span>")
if(GLOB.configuration.url.banappeals_url)
messages.Add("<span class='warning'>You can appeal the bans at: [GLOB.configuration.url.banappeals_url]</span>")
to_chat(src, chat_box_red(messages.Join("<br>")))
/client/verb/displayjobbans() //Shell verb to call the proc
set category = "OOC"
set name = "Display Current Jobbans"
set desc = "Displays all of your current jobbans."
@@ -40,20 +69,8 @@
// Ok. I know this verb here is scoped to client, I know.
// But sometimes when executing, the src will be a mob
// I have no idea why, but this is a workaround.
jbh.reload_jobbans(usr.client)
if(!length(jbh.job_bans))
to_chat(src, "<span class='warning'>You have no active jobbans!</span>")
return
for(var/ban in jbh.job_bans)
var/datum/job_ban/JB = jbh.job_bans[ban] // Remember. Its assoc.
switch(JB.bantype)
if("JOB_PERMABAN")
to_chat(src, "<span class='warning'>[JB.bantype]: [JB.job] - REASON: [JB.reason], by [JB.a_ckey]; [JB.bantime]</span>")
if("JOB_TEMPBAN")
to_chat(src, "<span class='warning'>[JB.bantype]: [JB.job] - REASON: [JB.reason], by [JB.a_ckey]; [JB.bantime]; [JB.duration]; expires [JB.expiration_time]</span>")
if(GLOB.configuration.url.banappeals_url)
to_chat(src, "<span class='warning'>You can appeal the bans at: [GLOB.configuration.url.banappeals_url]</span>")
var/client/C = src
if(!istype(C))
C = usr.client
C.display_job_bans(FALSE)