From fb8d95a2f52e070a4492a94dc92c01c5fe7ce7f3 Mon Sep 17 00:00:00 2001 From: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Date: Sat, 20 Nov 2021 11:06:50 +0000 Subject: [PATCH] Allows players to send more visible adminhelps when no admins are on, which'll definitely alert admins (#62711) Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com> --- SQL/database_changelog.txt | 14 +- SQL/tgstation_schema.sql | 1 + SQL/tgstation_schema_prefixed.sql | 1 + code/__DEFINES/subsystems.dm | 2 +- code/__HELPERS/chat.dm | 7 +- .../configuration/entries/general.dm | 15 ++ code/controllers/subsystem/blackbox.dm | 19 ++- code/datums/keybinding/client.dm | 2 +- code/modules/admin/sql_ban_system.dm | 2 +- code/modules/admin/verbs/adminhelp.dm | 152 ++++++++++++++---- code/modules/client/client_defines.dm | 3 + code/modules/client/client_procs.dm | 4 + config/config.txt | 19 +++ tgui/packages/tgui/components/TextArea.js | 10 ++ tgui/packages/tgui/interfaces/Adminhelp.tsx | 111 +++++++++++++ 15 files changed, 319 insertions(+), 43 deletions(-) create mode 100644 tgui/packages/tgui/interfaces/Adminhelp.tsx diff --git a/SQL/database_changelog.txt b/SQL/database_changelog.txt index 6209e6872f4..2c538a1d8f3 100644 --- a/SQL/database_changelog.txt +++ b/SQL/database_changelog.txt @@ -1,13 +1,21 @@ Any time you make a change to the schema files, remember to increment the database schema version. Generally increment the minor number, major should be reserved for significant changes to the schema. Both values go up to 255. -The latest database version is 5.17; The query to update the schema revision table is: +The latest database version is 5.19; The query to update the schema revision table is: -INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 18); +INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 19); or -INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 18); +INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 19); In any query remember to add a prefix to the table names if you use one. +----------------------------------------------------- +Version 5.19, 10 November 2021, by WalterMeldron +Adds an urgent column to tickets for ahelps marked as urgent. + +``` +ALTER TABLE `ticket` ADD COLUMN `urgent` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `sender`; +``` + ----------------------------------------------------- Version 5.18, 1 November 2021, by Mothblocks Added `known_alts` table for tracking who not to create suspicious logins for. diff --git a/SQL/tgstation_schema.sql b/SQL/tgstation_schema.sql index ac913be0149..2a5bb7bfde5 100644 --- a/SQL/tgstation_schema.sql +++ b/SQL/tgstation_schema.sql @@ -588,6 +588,7 @@ CREATE TABLE `ticket` ( `round_id` int(11) unsigned NULL, `ticket` smallint(11) unsigned NOT NULL, `action` varchar(20) NOT NULL DEFAULT 'Message', + `urgent` TINYINT(1) unsigned NOT NULL DEFAULT '0', `message` text NOT NULL, `timestamp` datetime NOT NULL, `recipient` varchar(32) DEFAULT NULL, diff --git a/SQL/tgstation_schema_prefixed.sql b/SQL/tgstation_schema_prefixed.sql index bcb26de7d25..c599e3466b8 100644 --- a/SQL/tgstation_schema_prefixed.sql +++ b/SQL/tgstation_schema_prefixed.sql @@ -588,6 +588,7 @@ CREATE TABLE `SS13_ticket` ( `round_id` int(11) unsigned NULL, `ticket` smallint(11) unsigned NOT NULL, `action` varchar(20) NOT NULL DEFAULT 'Message', + `urgent` TINYINT(1) unsigned NOT NULL DEFAULT '0', `message` text NOT NULL, `timestamp` datetime NOT NULL, `recipient` varchar(32) DEFAULT NULL, diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 32a3be09510..94fd44f7a3c 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -20,7 +20,7 @@ * * make sure you add an update to the schema_version stable in the db changelog */ -#define DB_MINOR_VERSION 18 +#define DB_MINOR_VERSION 19 //! ## Timing subsystem diff --git a/code/__HELPERS/chat.dm b/code/__HELPERS/chat.dm index 230dd03361e..fe291f690ef 100644 --- a/code/__HELPERS/chat.dm +++ b/code/__HELPERS/chat.dm @@ -40,21 +40,22 @@ In TGS3 it will always be sent to all connected designated game chats. * * message - The message to send. * channel_tag - Required. If "", the message with be sent to all connected (Game-type for TGS3) channels. Otherwise, it will be sent to TGS4 channels with that tag (Delimited by ','s). + * admin_only - Determines if this communication can only be sent to admin only channels. */ -/proc/send2chat(message, channel_tag) +/proc/send2chat(message, channel_tag, admin_only = FALSE) if(channel_tag == null || !world.TgsAvailable()) return var/datum/tgs_version/version = world.TgsVersion() if(channel_tag == "" || version.suite == 3) - world.TgsTargetedChatBroadcast(message, FALSE) + world.TgsTargetedChatBroadcast(message, admin_only) return var/list/channels_to_use = list() for(var/I in world.TgsChatChannelInfo()) var/datum/tgs_chat_channel/channel = I var/list/applicable_tags = splittext(channel.custom_tag, ",") - if(channel_tag in applicable_tags) + if((!admin_only || channel.is_admin_channel) && (channel_tag in applicable_tags)) channels_to_use += channel if(channels_to_use.len) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index b142ce6217e..a9d4c2028b9 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -543,3 +543,18 @@ min_val = 0 /datum/config_entry/str_list/motd + +/datum/config_entry/number/urgent_ahelp_cooldown + default = 300 + +/datum/config_entry/string/urgent_ahelp_message + default = "This ahelp is urgent!" + +/datum/config_entry/string/urgent_ahelp_user_prompt + default = "There are no admins currently on. Do not press the button below if your ahelp is a joke, a request or a question. Use it only for cases of obvious grief." + +/datum/config_entry/string/adminhelp_webhook_url + +/datum/config_entry/string/adminhelp_webhook_pfp + +/datum/config_entry/string/adminhelp_webhook_name diff --git a/code/controllers/subsystem/blackbox.dm b/code/controllers/subsystem/blackbox.dm index abc5a6a02f1..0b195613417 100644 --- a/code/controllers/subsystem/blackbox.dm +++ b/code/controllers/subsystem/blackbox.dm @@ -288,14 +288,25 @@ Versioning key = new_key key_type = new_key_type -/datum/controller/subsystem/blackbox/proc/LogAhelp(ticket, action, message, recipient, sender) +/datum/controller/subsystem/blackbox/proc/LogAhelp(ticket, action, message, recipient, sender, urgent = FALSE) if(!SSdbcore.Connect()) return var/datum/db_query/query_log_ahelp = SSdbcore.NewQuery({" - INSERT INTO [format_table_name("ticket")] (ticket, action, message, recipient, sender, server_ip, server_port, round_id, timestamp) - VALUES (:ticket, :action, :message, :recipient, :sender, INET_ATON(:server_ip), :server_port, :round_id, :time) - "}, list("ticket" = ticket, "action" = action, "message" = message, "recipient" = recipient, "sender" = sender, "server_ip" = world.internet_address || "0", "server_port" = world.port, "round_id" = GLOB.round_id, "time" = SQLtime())) + INSERT INTO [format_table_name("ticket")] (ticket, action, message, recipient, sender, server_ip, server_port, round_id, timestamp, urgent) + VALUES (:ticket, :action, :message, :recipient, :sender, INET_ATON(:server_ip), :server_port, :round_id, :time, :urgent) + "}, list( + "ticket" = ticket, + "action" = action, + "message" = message, + "recipient" = recipient, + "sender" = sender, + "server_ip" = world.internet_address || "0", + "server_port" = world.port, + "round_id" = GLOB.round_id, + "time" = SQLtime(), + "urgent" = urgent, + )) query_log_ahelp.Execute() qdel(query_log_ahelp) diff --git a/code/datums/keybinding/client.dm b/code/datums/keybinding/client.dm index e4b940c7f72..5b23c823ddb 100644 --- a/code/datums/keybinding/client.dm +++ b/code/datums/keybinding/client.dm @@ -14,7 +14,7 @@ . = ..() if(.) return - user.get_adminhelp() + user.adminhelp() return TRUE diff --git a/code/modules/admin/sql_ban_system.dm b/code/modules/admin/sql_ban_system.dm index 8715d2a6690..c7f45de4c6d 100644 --- a/code/modules/admin/sql_ban_system.dm +++ b/code/modules/admin/sql_ban_system.dm @@ -279,7 +279,7 @@ break_counter = 0 var/list/other_job_lists = list( - "Abstract" = list("Appearance", "Emote", "Deadchat", "OOC"), + "Abstract" = list("Appearance", "Emote", "Deadchat", "OOC", "Urgent Adminhelp"), ) for(var/department in other_job_lists) output += "