Merge branch 'master' into corporate-comms

This commit is contained in:
warior4356
2020-10-12 16:31:15 -07:00
169 changed files with 7138 additions and 5077 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ SUBSYSTEM_DEF(afk)
var/turf/T
// Only players and players with the AFK watch enabled
// No dead, unconcious, restrained, people without jobs or people on other Z levels than the station
if(!H.client || !H.client.prefs.afk_watch || !H.mind || \
if(!H.client || !H.client.prefs.toggles2 & PREFTOGGLE_2_AFKWATCH || !H.mind || \
H.stat || H.restrained() || !H.job || !is_station_level((T = get_turf(H)).z)) // Assign the turf as last. Small optimization
if(afk_players[H.ckey])
toRemove += H.ckey
+4 -4
View File
@@ -57,7 +57,7 @@ SUBSYSTEM_DEF(changelog)
return // Only return here, we dont have to worry about a queue list because this will be called from ShowChangelog()
// Technically this is only for the date but we can also do the UI button at the same time
var/datum/preferences/P = GLOB.preferences_datums[C.ckey]
if(P.toggles & UI_DARKMODE)
if(P.toggles & PREFTOGGLE_UI_DARKMODE)
winset(C, "rpane.changelog", "background-color=#40628a;font-color=#ffffff;font-style=none")
else
winset(C, "rpane.changelog", "background-color=none;font-style=none")
@@ -74,7 +74,7 @@ SUBSYSTEM_DEF(changelog)
/datum/controller/subsystem/changelog/proc/UpdatePlayerChangelogButton(client/C)
// If SQL aint even enabled, just set the button to default style
if(!GLOB.dbcon.IsConnected())
if(C.prefs.toggles & UI_DARKMODE)
if(C.prefs.toggles & PREFTOGGLE_UI_DARKMODE)
winset(C, "rpane.changelog", "background-color=#40628a;text-color=#FFFFFF")
else
winset(C, "rpane.changelog", "background-color=none;text-color=#000000")
@@ -83,7 +83,7 @@ SUBSYSTEM_DEF(changelog)
// If SQL is enabled but we aint ready, queue them up, and use the default style
if(!ss_ready)
startup_clients_button |= C
if(C.prefs.toggles & UI_DARKMODE)
if(C.prefs.toggles & PREFTOGGLE_UI_DARKMODE)
winset(C, "rpane.changelog", "background-color=#40628a;text-color=#FFFFFF")
else
winset(C, "rpane.changelog", "background-color=none;text-color=#000000")
@@ -96,7 +96,7 @@ SUBSYSTEM_DEF(changelog)
winset(C, "rpane.changelog", "background-color=#bb7700;text-color=#FFFFFF;font-style=bold")
to_chat(C, "<span class='info'>Changelog has changed since your last visit.</span>")
else
if(C.prefs.toggles & UI_DARKMODE)
if(C.prefs.toggles & PREFTOGGLE_UI_DARKMODE)
winset(C, "rpane.changelog", "background-color=#40628a;text-color=#FFFFFF")
else
winset(C, "rpane.changelog", "background-color=none;text-color=#000000")
+1 -1
View File
@@ -285,7 +285,7 @@ SUBSYSTEM_DEF(jobs)
for(var/mob/new_player/player in GLOB.player_list)
if(player.ready && player.has_valid_preferences() && player.mind && !player.mind.assigned_role)
unassigned += player
if(player.client.prefs.randomslot)
if(player.client.prefs.toggles2 & PREFTOGGLE_2_RANDOMSLOT)
player.client.prefs.load_random_character_slot(player.client)
Debug("DO, Len: [unassigned.len]")
@@ -10,6 +10,9 @@ GLOBAL_REAL(SSmentor_tickets, /datum/controller/subsystem/tickets/mentor_tickets
ticket_system_name = "Mentor Tickets"
ticket_name = "Mentor Ticket"
span_class = "mentorhelp"
anchor_link_extra = ";is_mhelp=1"
ticket_help_type = "Mentorhelp"
ticket_help_span = "mentorhelp"
other_ticket_name = "Admin"
other_ticket_permission = R_ADMIN
close_rights = R_MENTOR | R_ADMIN
@@ -21,8 +24,11 @@ GLOBAL_REAL(SSmentor_tickets, /datum/controller/subsystem/tickets/mentor_tickets
"<span class='[span_class]'>Your [ticket_name] has now been closed.</span>")
return ..()
/datum/controller/subsystem/tickets/mentor_tickets/message_staff(msg)
message_mentorTicket(msg)
/datum/controller/subsystem/tickets/mentor_tickets/message_staff(msg, prefix_type = NONE, important = FALSE)
message_mentorTicket(msg, important)
/datum/controller/subsystem/tickets/mentor_tickets/create_other_system_ticket(datum/ticket/T)
SStickets.newTicket(get_client_by_ckey(T.client_ckey), T.content, T.title)
SStickets.newTicket(get_client_by_ckey(T.client_ckey), T.content, T.raw_title)
/datum/controller/subsystem/tickets/mentor_tickets/autoRespond(N)
return
+78 -16
View File
@@ -10,6 +10,9 @@
#define TICKET_RESOLVED 3
#define TICKET_STALE 4
#define TICKET_STAFF_MESSAGE_ADMIN_CHANNEL 1
#define TICKET_STAFF_MESSAGE_PREFIX 2
SUBSYSTEM_DEF(tickets)
name = "Admin Tickets"
init_order = INIT_ORDER_TICKETS
@@ -24,6 +27,11 @@ SUBSYSTEM_DEF(tickets)
var/close_rights = R_ADMIN
var/rights_needed = R_ADMIN | R_MOD
/// Text that will be added to the anchor link
var/anchor_link_extra = ""
var/ticket_help_type = "Adminhelp"
var/ticket_help_span = "adminhelp"
/// The name of the other ticket type to convert to
var/other_ticket_name = "Mentor"
/// Which permission to look for when seeing if there is staff available for the other ticket type
@@ -34,7 +42,8 @@ SUBSYSTEM_DEF(tickets)
var/ticketCounter = 1
/datum/controller/subsystem/tickets/Initialize()
close_messages = list("<font color='red' size='4'><b>- [ticket_name] Rejected! -</b></font>",
if(!close_messages)
close_messages = list("<font color='red' size='4'><b>- [ticket_name] Rejected! -</b></font>",
"<span class='boldmessage'>Please try to be calm, clear, and descriptive in admin helps, do not assume the staff member has seen any related events, and clearly state the names of anybody you are reporting. If you asked a question, please ensure it was clear what you were asking.</span>",
"<span class='[span_class]'>Your [ticket_name] has now been closed.</span>")
return ..()
@@ -76,22 +85,56 @@ SUBSYSTEM_DEF(tickets)
var/datum/ticket/T = i
resolveTicket(T.ticketNum)
/**
* Will either make a new ticket using the given text or will add the text to an existing ticket.
* Staff will get a message
* Arguments:
* C - The client who requests help
* text - The text the client send
*/
/datum/controller/subsystem/tickets/proc/newHelpRequest(client/C, text)
var/ticketNum // Holder for the ticket number
var/datum/ticket/T
// Get the open ticket assigned to the client and add a response. If no open tickets then make a new one
if((T = checkForOpenTicket(C)))
ticketNum = T.ticketNum
T.addResponse(C, text)
T.setCooldownPeriod()
to_chat(C.mob, "<span class='[span_class]'>Your [ticket_name] #[ticketNum] remains open! Visit \"My tickets\" under the Admin Tab to view it.</span>")
var/url_message = makeUrlMessage(C, text, ticketNum)
message_staff(url_message, NONE, TRUE)
else
newTicket(C, text, text)
/**
* Will add the URLs usable by staff to the message and return it
* Arguments:
* C - The client who send the message
* msg - The raw message
* ticketNum - Which ticket number the ticket has
*/
/datum/controller/subsystem/tickets/proc/makeUrlMessage(client/C, msg, ticketNum)
var/list/L = list()
L += "<span class='[ticket_help_span]'>[ticket_help_type]: </span><span class='boldnotice'>[key_name(C, TRUE, ticket_help_type)] "
L += "([ADMIN_QUE(C.mob,"?")]) ([ADMIN_PP(C.mob,"PP")]) ([ADMIN_VV(C.mob,"VV")]) ([ADMIN_TP(C.mob,"TP")]) ([ADMIN_SM(C.mob,"SM")]) "
L += "([admin_jump_link(C.mob)]) (<a href='?_src_=holder;openticket=[ticketNum][anchor_link_extra]'>TICKET</a>) "
L += "[isAI(C.mob) ? "(<a href='?_src_=holder;adminchecklaws=[C.mob.UID()]'>CL</a>)" : ""] (<a href='?_src_=holder;take_question=[ticketNum][anchor_link_extra]'>TAKE</a>) "
L += "(<a href='?_src_=holder;resolve=[ticketNum][anchor_link_extra]'>RESOLVE</a>) <a href='?_src_=holder;autorespond=[ticketNum][anchor_link_extra]'>(AUTO)</a> "
L += "<a href='?_src_=holder;convert_ticket=[ticketNum][anchor_link_extra]'>(CONVERT)</a> :</span> <span class='[ticket_help_span]'>[msg]</span>"
return L.Join()
//Open a new ticket and populate details then add to the list of open tickets
/datum/controller/subsystem/tickets/proc/newTicket(client/C, passedContent, title)
if(!C || !passedContent)
return
//Check if the user has an open ticket already within the cooldown period, if so we don't create a new one and re-set the cooldown period
var/datum/ticket/existingTicket = checkForOpenTicket(C)
if(existingTicket)
existingTicket.setCooldownPeriod()
to_chat(C.mob, "<span class='[span_class]'>Your [ticket_name] #[existingTicket.ticketNum] remains open! Visit \"My tickets\" under the Admin Tab to view it.</span>")
return
if(!title)
title = passedContent
var/datum/ticket/T = new(title, passedContent, getTicketCounterAndInc())
var/new_ticket_num = getTicketCounterAndInc()
var/url_title = makeUrlMessage(C, title, new_ticket_num)
var/datum/ticket/T = new(url_title, title, passedContent, new_ticket_num)
allTickets += T
T.client_ckey = C.ckey
T.locationSent = C.mob.loc.name
@@ -102,6 +145,8 @@ SUBSYSTEM_DEF(tickets)
var/ticket_open_sound = sound('sound/effects/adminticketopen.ogg')
SEND_SOUND(C, ticket_open_sound)
message_staff(url_title, NONE, TRUE)
//Set ticket state with key N to open
/datum/controller/subsystem/tickets/proc/openTicket(N)
var/datum/ticket/T = allTickets[N]
@@ -148,7 +193,7 @@ SUBSYSTEM_DEF(tickets)
/datum/controller/subsystem/tickets/proc/create_other_system_ticket(datum/ticket/T)
var/client/C = get_client_by_ckey(T.client_ckey)
SSmentor_tickets.newTicket(C, T.content, T.title)
SSmentor_tickets.newTicket(C, T.content, T.raw_title)
/datum/controller/subsystem/tickets/proc/autoRespond(N)
if(!check_rights(rights_needed))
@@ -250,6 +295,7 @@ SUBSYSTEM_DEF(tickets)
var/client_ckey
var/timeOpened // Time the ticket was opened
var/title //The initial message with links
var/raw_title // The title without URLs added
var/list/content // content of the staff help
var/lastStaffResponse // Last staff member who responded
var/lastResponseTime // When the staff last responded
@@ -260,8 +306,9 @@ SUBSYSTEM_DEF(tickets)
var/ticketCooldown // Cooldown before allowing the user to open another ticket.
var/client/staffAssigned // Staff member who has assigned themselves to this ticket
/datum/ticket/New(tit, cont, num)
/datum/ticket/New(tit, raw_tit, cont, num)
title = tit
raw_title = raw_tit
content = list()
content += cont
timeOpened = worldtime2text()
@@ -440,9 +487,21 @@ UI STUFF
to_chat(target, text)
return TRUE
//Sends a message to the designated staff
/datum/controller/subsystem/tickets/proc/message_staff(var/msg, var/alt = FALSE)
message_adminTicket(msg, alt)
/**
* Sends a message to the designated staff
* Arguments:
* msg - The message being send
* alt - If an alternative prefix should be used or not. Defaults to TICKET_STAFF_MESSAGE_PREFIX
* important - If the message is important. If TRUE it will ignore the CHAT_NO_TICKETLOGS preferences,
send a sound and flash the window. Defaults to FALSE
*/
/datum/controller/subsystem/tickets/proc/message_staff(msg, prefix_type = TICKET_STAFF_MESSAGE_PREFIX, important = FALSE)
switch(prefix_type)
if(TICKET_STAFF_MESSAGE_ADMIN_CHANNEL)
msg = "<span class='admin_channel'>ADMIN TICKET: [msg]</span>"
if(TICKET_STAFF_MESSAGE_PREFIX)
msg = "<span class='adminticket'><span class='prefix'>ADMIN TICKET:</span> [msg]</span>"
message_adminTicket(msg, important)
/datum/controller/subsystem/tickets/Topic(href, href_list)
@@ -524,7 +583,7 @@ UI STUFF
if(span_class == "mentorhelp")
message_staff("<span class='[span_class]'>[usr.client] / ([usr]) has taken [ticket_name] number [index]</span>")
else
message_staff("<span class='admin_channel'>[usr.client] / ([usr]) has taken [ticket_name] number [index]</span>", TRUE)
message_staff("<span class='admin_channel'>[usr.client] / ([usr]) has taken [ticket_name] number [index]</span>", TICKET_STAFF_MESSAGE_ADMIN_CHANNEL)
to_chat_safe(returnClient(index), "<span class='[span_class]'>Your [ticket_name] is being handled by [usr.client].</span>")
/datum/controller/subsystem/tickets/proc/unassignTicket(index)
@@ -535,4 +594,7 @@ UI STUFF
if(span_class == "mentorhelp")
message_staff("<span class='[span_class]'>[usr.client] / ([usr]) has unassigned [ticket_name] number [index]</span>")
else
message_staff("<span class='admin_channel'>[usr.client] / ([usr]) has unassigned [ticket_name] number [index]</span>", TRUE)
message_staff("<span class='admin_channel'>[usr.client] / ([usr]) has unassigned [ticket_name] number [index]</span>", TICKET_STAFF_MESSAGE_ADMIN_CHANNEL)
#undef TICKET_STAFF_MESSAGE_ADMIN_CHANNEL
#undef TICKET_STAFF_MESSAGE_PREFIX