diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index ac212377724..0379517190f 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -521,3 +521,17 @@ CREATE TABLE `memo` ( PRIMARY KEY (`ckey`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `discord` +-- +DROP TABLE IF EXISTS `discord`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `discord` ( + `ckey` varchar(32) NOT NULL, + `discord_id` bigint(20) NOT NULL, + `notify` int(11) NOT NULL, + PRIMARY KEY (`ckey`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; diff --git a/SQL/paradise_schema_prefixed.sql b/SQL/paradise_schema_prefixed.sql index 4946add50f2..e9a622cf037 100644 --- a/SQL/paradise_schema_prefixed.sql +++ b/SQL/paradise_schema_prefixed.sql @@ -520,3 +520,17 @@ CREATE TABLE `SS13_memo` ( PRIMARY KEY (`ckey`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `SS13_discord` +-- +DROP TABLE IF EXISTS `SS13_discord`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS `SS13_discord` ( + `ckey` varchar(32) NOT NULL, + `discord_id` bigint(20) NOT NULL, + `notify` int(11) NOT NULL, + PRIMARY KEY (`ckey`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; diff --git a/SQL/updates/4-5.sql b/SQL/updates/4-5.sql new file mode 100644 index 00000000000..f8f6193239b --- /dev/null +++ b/SQL/updates/4-5.sql @@ -0,0 +1,9 @@ +#Updating the SQL from version 4 to version 5. -AffectedArc07 +#Creating a table to track discord IDs for round notifying +DROP TABLE IF EXISTS `discord`; +CREATE TABLE IF NOT EXISTS `discord` ( + `ckey` varchar(32) NOT NULL, + `discord_id` bigint(20) NOT NULL, + `notify` int(11) NOT NULL, + PRIMARY KEY (`ckey`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index c59d39dc14c..f95eb8cce22 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -367,7 +367,7 @@ #define INVESTIGATE_BOMB "bombs" // The SQL version required by this version of the code -#define SQL_VERSION 4 +#define SQL_VERSION 5 // Vending machine stuff #define CAT_NORMAL 1 diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 17f8fcd3865..b3e5c82d22b 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -209,6 +209,7 @@ // Developer var/developer_express_start = 0 + var/developer_disable_subsystem[] /datum/configuration/New() for(var/T in subtypesof(/datum/game_mode)) @@ -636,6 +637,8 @@ config.disable_high_pop_mc_mode_amount = text2num(value) if("developer_express_start") config.developer_express_start = 1 + if("developer_disable_subsystem") + config.developer_disable_subsystem = splittext(value, ",") else log_config("Unknown setting in configuration: '[name]'") diff --git a/code/controllers/master.dm b/code/controllers/master.dm index a9c7e0dbb7b..11417f3b5a0 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -176,6 +176,12 @@ GLOBAL_REAL(Master, /datum/controller/master) = new to_chat(world, "Initializing subsystems...") + // Config disable subsystem + for(var/select=1, select <= subsystems.len, select++) + for(var/disable=1, disable <= config.developer_disable_subsystem.len, disable++) + if(subsystems[select].name == config.developer_disable_subsystem[disable]) + subsystems -= subsystems[select] + // Sort subsystems by init_order, so they initialize in the correct order. sortTim(subsystems, /proc/cmp_subsystem_init) diff --git a/code/modules/customitems/item_defines.dm b/code/modules/customitems/item_defines.dm index 2b56cf74298..02647cbfb58 100644 --- a/code/modules/customitems/item_defines.dm +++ b/code/modules/customitems/item_defines.dm @@ -1327,6 +1327,13 @@ /obj/item/toy/plushie/fluff/fox/ui_action_click() change_color() +/obj/item/clothing/suit/jacket/miljacket/desert/fox + name = "rugged military jacket" + desc = "A rugged brown military jacket with a stylized 'A' embroidered on the back. It seems very old, yet is in near mint condition. Has a tag on the inside collar signed 'Fox McCloud'." + icon = 'icons/obj/custom_items.dmi' + icon_state = "fox_coat" + item_color = "fox_coat" + // TheFlagbearer: Willow Walker /obj/item/clothing/under/fluff/arachno_suit name = "Arachno-Man costume" diff --git a/code/modules/discord/accountlink.dm b/code/modules/discord/accountlink.dm new file mode 100644 index 00000000000..c2091082f6c --- /dev/null +++ b/code/modules/discord/accountlink.dm @@ -0,0 +1,52 @@ +// DONT TOUCH ANYTHING IN HERE UNLESS YOU KNOW WHAT YOU ARE DOING -affected +/client/verb/linkdiscord() + set category = "OOC" + set name = "Link Discord Account" + set desc = "Link your discord account to your BYOND account." + ckey = sanitizeSQL(usr.ckey) // Probably not neccassary but better safe than sorry + if(!config.sql_enabled) + to_chat(src, "This is feature requires the SQL backend") + return + var/DBQuery/db_discord_id = dbcon.NewQuery("SELECT discord_id FROM [format_table_name("discord")] WHERE ckey = '[ckey]'") + if(!db_discord_id.Execute()) + var/err = db_discord_id.ErrorMsg() + log_game("SQL ERROR while selecting discord account. Error : \[[err]\]\n") + to_chat(src, "Error checking Discord account. Please inform an administrator") + return + var/stored_id + while(db_discord_id.NextRow()) + stored_id = db_discord_id.item[1] + if(!stored_id) // Not linked + var/know_how = alert("Do you know how to get a discord user ID?","Question","Yes","No") + if(know_how == "No") // Opens discord support on how to collect IDs + src << link("https://support.discordapp.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID") + var/entered_id = input("Please enter your Discord ID.", "Enter Discord ID", null, null) as text|null + var/sql_id = sanitizeSQL(entered_id) + var/DBQuery/store_discord_id = dbcon.NewQuery("INSERT INTO [format_table_name("discord")] (ckey, discord_id, notify) VALUES ('[ckey]', [sql_id], 0)") + if(!store_discord_id.Execute()) + var/err = db_discord_id.ErrorMsg() + log_game("SQL ERROR while linking discord account. Error : \[[err]\]\n") + to_chat(src, "Error linking Discord account. Please inform an administrator") + return + to_chat(src, "Successfully linked discord account [entered_id] to [ckey]") + else // Linked + var/choice = alert("You already have the Discord Account [stored_id] linked to [ckey]. Would you like to unlink or replace","Already Linked","Unlink","Replace") + switch(choice) + if("Unlink") + var/DBQuery/unlink_discord_id = dbcon.NewQuery("DELETE FROM [format_table_name("discord")] WHERE ckey = '[ckey]'") + if(!unlink_discord_id.Execute()) + var/err = unlink_discord_id.ErrorMsg() + log_game("SQL ERROR while unlinking discord account. Error : \[[err]\]\n") + to_chat(src, "Error unlinking Discord account. Please inform an administrator") + return + to_chat(src, "Successfully unlinked discord account") + if("Replace") + var/entered_id = input("Please enter your Discord ID. Instructions can be found at https://bit.ly/2AfUu40", "Enter Discord ID", null, null) as text|null + var/sql_id = sanitizeSQL(entered_id) + var/DBQuery/store_discord_id = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET discord_id = '[sql_id]' WHERE ckey='[ckey]'") + if(!store_discord_id.Execute()) + var/err = db_discord_id.ErrorMsg() + to_chat(src, "Error replacing Discord account. Please inform an administrator") + log_game("SQL ERROR while linking discord account. Error : \[[err]\]\n") + return + to_chat(src, "Successfully linked discord account [entered_id] to [ckey]") diff --git a/code/modules/discord/notify.dm b/code/modules/discord/notify.dm new file mode 100644 index 00000000000..bca1b38f954 --- /dev/null +++ b/code/modules/discord/notify.dm @@ -0,0 +1,48 @@ +// DONT TOUCH ANYTHING IN HERE UNLESS YOU KNOW WHAT YOU ARE DOING -affected +/client/verb/notify_restart() + set category = "OOC" + set name = "Notify Restart" + set desc = "Notifies you on Discord when the server restarts." + if(!config.sql_enabled) + to_chat(src, "This is feature requires the SQL backend") + return + var/DBQuery/db_discord_id = dbcon.NewQuery("SELECT discord_id FROM [format_table_name("discord")] WHERE ckey = '[ckey]'") + if(!db_discord_id.Execute()) + var/err = db_discord_id.ErrorMsg() + log_game("SQL ERROR while selecting discord account. Error : \[[err]\]\n") + to_chat(src, "Error checking Discord account. Please inform an administrator") + return + var/stored_id + while(db_discord_id.NextRow()) + stored_id = db_discord_id.item[1] + if(!stored_id) // Not linked + to_chat(src, "This requires you to link your Discord account with the \"Link Discord Account\" verb.") + return + else // Linked + var/DBQuery/toggle_status = dbcon.NewQuery("SELECT notify FROM [format_table_name("discord")] WHERE ckey = '[ckey]'") + if(!toggle_status.Execute()) + var/err = toggle_status.ErrorMsg() + log_game("SQL ERROR while getting discord account. Error : \[[err]\]\n") + var/notify_status + while(toggle_status.NextRow()) + notify_status = toggle_status.item[1] + if(notify_status) // Data is there + switch(notify_status) + if("0") + var/DBQuery/update_notify = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET notify = 1 WHERE ckey='[ckey]'") + if(!update_notify.Execute()) + var/err = db_discord_id.ErrorMsg() + to_chat(src, "Error updating notify status. Please inform an administrator") + log_game("SQL ERROR while updating notify status. Error : \[[err]\]\n") + return + to_chat(src, "You will now be notified on discord when the next round is starting") + if("1") + var/DBQuery/update_notify = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET notify = 0 WHERE ckey='[ckey]'") + if(!update_notify.Execute()) + var/err = db_discord_id.ErrorMsg() + to_chat(src, "Error updating notify status. Please inform an administrator") + log_game("SQL ERROR while updating notify status. Error : \[[err]\]\n") + return + to_chat(src, "You will no longer be notified on discord when the next round is starting") + else // Oh fuck what the hell happened + to_chat(src, "Something has gone VERY wrong, or affected cant code.") diff --git a/code/modules/ext_scripts/irc.dm b/code/modules/ext_scripts/irc.dm index 3cc29ff39fb..11b799aa203 100644 --- a/code/modules/ext_scripts/irc.dm +++ b/code/modules/ext_scripts/irc.dm @@ -17,5 +17,18 @@ return /hook/startup/proc/ircNotify() - send2mainirc("Server starting up on [station_name()]. Connect to: [config.server? "[config.server]" : "[world.address]:[world.port]"]") + var/people_to_ping = "" + var/DBQuery/pull_notify = dbcon.NewQuery("SELECT discord_id FROM [format_table_name("discord")] WHERE notify = 1") + if(!pull_notify.Execute()) + var/err = pull_notify.ErrorMsg() + log_game("SQL ERROR while pulling notify people. Error : \[[err]\]\n") + else + while(pull_notify.NextRow()) + people_to_ping += "<@" + pull_notify.item[1] + "> " + send2mainirc("Server starting up on [station_name()]. Connect to: "+people_to_ping) + // Set notify to 0 so people arent pinged round after round + var/DBQuery/reset_notify = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET notify = 0 WHERE notify = 1") + if(!reset_notify.Execute()) + var/err = reset_notify.ErrorMsg() + log_game("SQL ERROR while resetting notify status. Error : \[[err]\]\n") return 1 diff --git a/config/example/config.txt b/config/example/config.txt index 39a1b13d23b..b063ad19cbc 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -387,4 +387,9 @@ HIGH_POP_MC_MODE_AMOUNT 65 DISABLE_HIGH_POP_MC_MODE_AMOUNT 60 ##Uncomment to enable developer start. Auto starts the server after initialization -##DEVELOPER_EXPRESS_START \ No newline at end of file +##DEVELOPER_EXPRESS_START + +##Disable subsystems by name comma delimited. Last verified 1-30-2019 list of subsystems +## Garbage, Atoms, Machines, Timer, Fires, Mobs, Nanoui, NPC AI, NPC Pool, Space Drift, Sun, Throwing, Weather, +## Atmospherics, Icon Smoothing, Overlay, Tickets, Shuttle, Night Shift, Nano-Mob Hunter GO Server +DEVELOPER_DISABLE_SUBSYSTEM \ No newline at end of file diff --git a/config/example/dbconfig.txt b/config/example/dbconfig.txt index 563768b69bc..6ca1f0201e8 100644 --- a/config/example/dbconfig.txt +++ b/config/example/dbconfig.txt @@ -9,7 +9,7 @@ ## This value must be set to the version of the paradise schema in use. ## If this value does not match, the SQL database will not be loaded and an error will be generated. ## Roundstart will be delayed. -DB_VERSION 4 +DB_VERSION 5 ## Server the MySQL database can be found at. # Examples: localhost, 200.135.5.43, www.mysqldb.com, etc. diff --git a/html/changelogs/AutoChangeLog-pr-10740.yml b/html/changelogs/AutoChangeLog-pr-10740.yml new file mode 100644 index 00000000000..c217466e861 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-10740.yml @@ -0,0 +1,5 @@ +author: "AffectedArc07" +delete-after: True +changes: + - rscadd: "You can now link your discord account and BYOND account together" + - rscadd: "With the accounts linked, you can get roundstart notifications within discord!" diff --git a/html/changelogs/AutoChangeLog-pr-10781.yml b/html/changelogs/AutoChangeLog-pr-10781.yml new file mode 100644 index 00000000000..677f157aa48 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-10781.yml @@ -0,0 +1,4 @@ +author: "MINIMAN10000" +delete-after: True +changes: + - rscadd: "Configuration option for disabling subsystems" diff --git a/html/changelogs/AutoChangeLog-pr-10850.yml b/html/changelogs/AutoChangeLog-pr-10850.yml new file mode 100644 index 00000000000..42bf5fb906a --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-10850.yml @@ -0,0 +1,4 @@ +author: "Fox McCloud" +delete-after: True +changes: + - rscadd: "Adds Fox's fluff coat" diff --git a/icons/mob/suit.dmi b/icons/mob/suit.dmi index 3f3c3ddb090..258804468de 100644 Binary files a/icons/mob/suit.dmi and b/icons/mob/suit.dmi differ diff --git a/icons/obj/custom_items.dmi b/icons/obj/custom_items.dmi index d762918a650..fe4e452b6ea 100644 Binary files a/icons/obj/custom_items.dmi and b/icons/obj/custom_items.dmi differ diff --git a/paradise.dme b/paradise.dme index 912ff79c344..b4d7e8ef5c6 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1373,6 +1373,8 @@ #include "code\modules\detective_work\evidence.dm" #include "code\modules\detective_work\footprints_and_rag.dm" #include "code\modules\detective_work\scanner.dm" +#include "code\modules\discord\accountlink.dm" +#include "code\modules\discord\notify.dm" #include "code\modules\economy\Accounts.dm" #include "code\modules\economy\Accounts_DB.dm" #include "code\modules\economy\ATM.dm"