diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 2b3d9d2f72..c3ae90cc1b 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -431,3 +431,7 @@ /datum/config_entry/flag/log_pictures /datum/config_entry/flag/picture_logging_camera + +/datum/config_entry/number/max_bunker_days + config_entry_value = 7 + min_val = 1 diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index e43c8f21a2..2825f4343b 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -39,6 +39,7 @@ SUBSYSTEM_DEF(persistence) if(CONFIG_GET(flag/use_antag_rep)) LoadAntagReputation() LoadRandomizedRecipes() + LoadPanicBunker() return ..() /datum/controller/subsystem/persistence/proc/LoadSatchels() @@ -259,6 +260,15 @@ SUBSYSTEM_DEF(persistence) if(CONFIG_GET(flag/use_antag_rep)) CollectAntagReputation() SaveRandomizedRecipes() + SavePanicBunker() + +/datum/controller/subsystem/persistence/proc/LoadPanicBunker() + var/bunker_path = file("data/bunker_passthrough.json") + if(fexists(bunker_path)) + GLOB.bunker_passthrough = json_decode(file2text(bunker_path)) + for(var/ckey in GLOB.bunker_passthrough) + if(daysSince(GLOB.bunker_passthrough[ckey]) >= CONFIG_GET(number/max_bunker_days)) + GLOB.bunker_passthrough -= ckey /datum/controller/subsystem/persistence/proc/GetPhotoAlbums() var/album_path = file("data/photo_albums.json") @@ -381,6 +391,13 @@ SUBSYSTEM_DEF(persistence) fdel(json_file) WRITE_FILE(json_file, json_encode(file_data)) +/datum/controller/subsystem/persistence/proc/SavePanicBunker() + var/json_file = file("data/bunker_passthrough.json") + var/list/file_data = list() + file_data["data"] = GLOB.bunker_passthrough + fdel(json_file) + WRITE_FILE(json_file,json_encode(file_data)) + /datum/controller/subsystem/persistence/proc/remove_duplicate_trophies(list/trophies) var/list/ukeys = list() . = list() diff --git a/code/modules/admin/chat_commands.dm b/code/modules/admin/chat_commands.dm index 52ba3c521e..e2ddcdcf6a 100644 --- a/code/modules/admin/chat_commands.dm +++ b/code/modules/admin/chat_commands.dm @@ -137,7 +137,8 @@ GLOBAL_LIST(round_end_notifiees) return "The Database is not enabled!" GLOB.bunker_passthrough |= ckey(params) - + GLOB.bunker_passthrough[ckey(params)] = world.realtime + SSpersistence.SavePanicBunker() //we can do this every time, it's okay log_admin("[sender.friendly_name] has added [params] to the current round's bunker bypass list.") message_admins("[sender.friendly_name] has added [params] to the current round's bunker bypass list.") return "[params] has been added to the current round's bunker bypass list." diff --git a/code/modules/admin/verbs/panicbunker.dm b/code/modules/admin/verbs/panicbunker.dm index 2897427d6f..daaf15c70f 100644 --- a/code/modules/admin/verbs/panicbunker.dm +++ b/code/modules/admin/verbs/panicbunker.dm @@ -24,6 +24,8 @@ return GLOB.bunker_passthrough |= ckey(ckeytobypass) + GLOB.bunker_passthrough[ckey(ckeytobypass)] = world.realtime + SSpersistence.SavePanicBunker() //we can do this every time, it's okay log_admin("[key_name(usr)] has added [ckeytobypass] to the current round's bunker bypass list.") message_admins("[key_name_admin(usr)] has added [ckeytobypass] to the current round's bunker bypass list.") send2irc("Panic Bunker", "[key_name(usr)] has added [ckeytobypass] to the current round's bunker bypass list.") @@ -37,6 +39,7 @@ return GLOB.bunker_passthrough -= ckey(ckeytobypass) + SSpersistence.SavePanicBunker() log_admin("[key_name(usr)] has removed [ckeytobypass] from the current round's bunker bypass list.") message_admins("[key_name_admin(usr)] has removed [ckeytobypass] from the current round's bunker bypass list.") send2irc("Panic Bunker", "[key_name(usr)] has removed [ckeytobypass] from the current round's bunker bypass list.") diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index b6e0d52dad..e05cee3487 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -514,7 +514,7 @@ GLOBAL_LIST_EMPTY(external_rsc_urls) if (CONFIG_GET(flag/panic_bunker) && !holder && !GLOB.deadmins[ckey] && !(ckey in GLOB.bunker_passthrough)) 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, "You must first join the Discord to verify your account before joining this server.
To do so, read the rules and post a request in the #station-access-requests channel under the \"Main server\" category in the Discord server linked here: https://discord.gg/E6SQuhz
") //CIT CHANGE - makes the panic bunker disconnect message point to the discord + to_chat(src, "You must first join the Discord to verify your account before joining this server.
To do so, read the rules and post a request in the #station-access-requests channel under the \"Main server\" category in the Discord server linked here: https://discord.gg/E6SQuhz
If you have already done so, wait a few minutes then try again; sometimes the server needs to fully load before you can join.
") //CIT CHANGE - makes the panic bunker disconnect message point to the discord var/list/connectiontopic_a = params2list(connectiontopic) var/list/panic_addr = CONFIG_GET(string/panic_server_address) if(panic_addr && !connectiontopic_a["redirect"]) @@ -538,6 +538,8 @@ GLOBAL_LIST_EMPTY(external_rsc_urls) if(!account_join_date) account_join_date = "Error" account_age = -1 + else if(ckey in GLOB.bunker_passthrough) + GLOB.bunker_passthrough -= ckey qdel(query_client_in_db) var/datum/DBQuery/query_get_client_age = SSdbcore.NewQuery("SELECT firstseen, DATEDIFF(Now(),firstseen), accountjoindate, DATEDIFF(Now(),accountjoindate) FROM [format_table_name("player")] WHERE ckey = '[sql_ckey]'") if(!query_get_client_age.Execute()) diff --git a/config/config.txt b/config/config.txt index a89827809f..6d302a5512 100644 --- a/config/config.txt +++ b/config/config.txt @@ -470,6 +470,8 @@ DISABLE_HIGH_POP_MC_MODE_AMOUNT 60 ## Uncomment to set the number of /world/Reboot()s before the DreamDaemon restarts itself. 0 means restart every round. Requires tgstation server tools. #ROUNDS_UNTIL_HARD_RESTART 10 +## Number of days for an individual panic bunker passthrough entry to be wiped. Note that they're also wiped as soon as a player is in the database. +#MAX_BUNKER_DAYS 7 ##Default screen resolution, in tiles. ## By default, this is 15x15, which gets simplified to 7 by BYOND, as it is a 1:1 screen ratio.