diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 75253e430e4..7fe7af96553 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -81,6 +81,7 @@ var/forumurl = "http://baystation12.net/forums/" var/media_base_url = "http://nanotrasen.se/media" // http://ss13.nexisonline.net/media + var/overflow_server_url = "byond://nanotrasen.se:6666" var/forbid_singulo_possession = 0 @@ -154,6 +155,7 @@ var/starlight = 0 // Whether space turfs have ambient light or not var/allow_holidays = 0 + var/player_overflow_cap = 0 //number of players before the server starts rerouting /datum/configuration/New() var/list/L = typesof(/datum/game_mode) - /datum/game_mode @@ -508,6 +510,13 @@ var/vvalue = text2num(value) config.starlight = vvalue >= 0 ? vvalue : 0 + if("player_reroute_cap") + var/vvalue = text2num(value) + config.player_overflow_cap = vvalue >= 0 ? vvalue : 0 + + if("overflow_server_url") + config.overflow_server_url = value + else diary << "Unknown setting in configuration: '[name]'" diff --git a/code/modules/mob/new_player/login.dm b/code/modules/mob/new_player/login.dm index a32e373fccd..967e830248e 100644 --- a/code/modules/mob/new_player/login.dm +++ b/code/modules/mob/new_player/login.dm @@ -34,3 +34,11 @@ if(client) handle_privacy_poll() client.playtitlemusic() + + if(config.player_overflow_cap && config.overflow_server_url) //Overflow rerouting, if set, forces players to be moved to a different server once a player cap is reached. Less rough than a pure kick. + if(src.client.holder) return //admins are immune to overflow rerouting + var/tally = 0 + for(var/client/C in clients) + tally++ + if(tally > config.player_overflow_cap) + src << link(config.overflow_server_url) \ No newline at end of file diff --git a/config/example/config.txt b/config/example/config.txt index 4f4b034718b..7b6945468f7 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -273,4 +273,13 @@ EVENT_DELAY_UPPER 15;45;70 EVENT_CUSTOM_START_MAJOR 80;100 ## Strength of ambient star light. Set to 0 or less to turn off. -STARLIGHT 0 \ No newline at end of file +STARLIGHT 0 + +## Player rerouting stuff +## If not 0, players can be rerouted to an overflow server after a certain cap is reached + + ## Cap before players start being rerouted +PLAYER_REROUTE_CAP 0 + + ## Server to reroute to +OVERFLOW_SERVER_URL byond://nanotrasen.se:6666 \ No newline at end of file