From 66327aecc792616a7c8027e771467180b0de1e7f Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Mon, 10 Apr 2017 22:38:58 -0400 Subject: [PATCH] Quick & Dirty Panic Bunker Port Tested on our server, works. Doesn't work if you don't have a DB (how would it?). --- code/controllers/configuration.dm | 1 + code/modules/admin/admin_verbs.dm | 3 ++- code/modules/admin/verbs/panicbunker.dm | 15 +++++++++++++++ code/modules/client/client procs.dm | 8 ++++++++ polaris.dme | 1 + 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 code/modules/admin/verbs/panicbunker.dm diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index c1a0f83a87..6039dd6612 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -94,6 +94,7 @@ var/list/gamemode_cache = list() var/allow_extra_antags = 0 var/guests_allowed = 1 var/debugparanoid = 0 + var/panic_bunker = 0 var/serverurl var/server diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 91fff2c4c2..a4a2197288 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -162,7 +162,8 @@ var/list/admin_verbs_server = list( /client/proc/check_customitem_activity, /client/proc/nanomapgen_DumpImage, /client/proc/modify_server_news, - /client/proc/recipe_dump + /client/proc/recipe_dump, + /client/proc/panicbunker ) var/list/admin_verbs_debug = list( /client/proc/getruntimelog, //allows us to access runtime logs to somebody, diff --git a/code/modules/admin/verbs/panicbunker.dm b/code/modules/admin/verbs/panicbunker.dm new file mode 100644 index 0000000000..ac31c26071 --- /dev/null +++ b/code/modules/admin/verbs/panicbunker.dm @@ -0,0 +1,15 @@ +/client/proc/panicbunker() + set category = "Server" + set name = "Toggle Panic Bunker" + if (!config.sql_enabled) + to_chat(usr, "The Database is not enabled!") + return + + config.panic_bunker = (!config.panic_bunker) + + log_admin("[key_name(usr)] has toggled the Panic Bunker, it is now [(config.panic_bunker?"on":"off")]") + message_admins("[key_name_admin(usr)] has toggled the Panic Bunker, it is now [(config.panic_bunker?"enabled":"disabled")].") + if (config.panic_bunker && (!dbcon || !dbcon.IsConnected())) + message_admins("The Database is not connected! Panic bunker will not work until the connection is reestablished.") + feedback_add_details("admin_verb","PANIC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 90ecb8eb17..e8c16fdb54 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -266,6 +266,14 @@ var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `erro_connection_log`(`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[sql_ckey]','[sql_ip]','[sql_computerid]');") query_accesslog.Execute() + //Panic bunker code + if (isnum(player_age) && player_age == 0) //first connection + if (config.panic_bunker && !holder && !deadmin_holder) + log_access("Failed Login: [key] - New account attempting to connect during panic bunker") + message_admins("Failed Login: [key] - New account attempting to connect during panic bunker") + to_chat(src, "Sorry but the server is currently not accepting connections from never before seen players.") + qdel(src) + return 0 #undef TOPIC_SPAM_DELAY #undef UPLOAD_LIMIT diff --git a/polaris.dme b/polaris.dme index 1f6c125707..71d44b8da6 100644 --- a/polaris.dme +++ b/polaris.dme @@ -1110,6 +1110,7 @@ #include "code\modules\admin\verbs\mapping.dm" #include "code\modules\admin\verbs\massmodvar.dm" #include "code\modules\admin\verbs\modifyvariables.dm" +#include "code\modules\admin\verbs\panicbunker.dm" #include "code\modules\admin\verbs\playsound.dm" #include "code\modules\admin\verbs\possess.dm" #include "code\modules\admin\verbs\pray.dm"