Skip to content

Commit

Permalink
Adds a config for client versions
Browse files Browse the repository at this point in the history
  • Loading branch information
MrStonedOne committed Apr 16, 2016
1 parent 6a2df04 commit 859714b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
14 changes: 14 additions & 0 deletions code/controllers/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@
// The object used for the clickable stat() button.
var/obj/effect/statclick/statclick

var/client_warn_version = 0
var/client_warn_message = "Your version of byond may have issues or be blocked from accessing this server in the future."
var/client_error_version = 0
var/client_error_message = "Your version of byond is too old, may have issues, and is blocked from accessing this server."


/datum/configuration/New()
var/list/L = subtypesof(/datum/game_mode)
Expand Down Expand Up @@ -401,6 +406,15 @@
protected_config.autoadmin_rank = ckeyEx(value)
if("generate_minimaps")
config.generate_minimaps = 1
if("client_warn_version")
config.client_warn_version = text2num(value)
if("client_warn_message")
config.client_warn_message = value
if("client_error_version")
config.client_error_version = text2num(value)
if("client_error_message")
config.client_error_message = value

else
diary << "Unknown setting in configuration: '[name]'"

Expand Down
21 changes: 17 additions & 4 deletions code/modules/client/client procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
//SECURITY//
////////////
#define UPLOAD_LIMIT 1048576 //Restricts client uploads to the server to 1MB //Could probably do with being lower.
#define MIN_CLIENT_VERSION 0 //Just an ambiguously low version for now, I don't want to suddenly stop people playing.
//I would just like the code ready should it ever need to be used.

/*
When somebody clicks a link in game, this Topic is called first.
It does the stuff in this proc and then is redirected to the Topic() proc for the src=[0xWhatever]
Expand Down Expand Up @@ -103,8 +102,6 @@ var/next_external_rsc = 0

if(connection != "seeker" && connection != "web")//Invalid connection type.
return null
if(byond_version < MIN_CLIENT_VERSION) //Out of date client.
return null

#if (PRELOAD_RSC == 0)
if(external_rsc_urls && external_rsc_urls.len)
Expand Down Expand Up @@ -143,6 +140,22 @@ var/next_external_rsc = 0

. = ..() //calls mob.Login()

if (byond_version < config.client_error_version) //Out of date client.
src << "<span class='danger'><b>Your version of byond is too old:</b></span>"
src << config.client_error_message
src << "Your version: [byond_version]"
src << "Required version: [config.client_error_version] or later"
if (holder)
src << "Because you are an admin, you are being allowed to walk past this limitation, But it is still STRONGLY suggested you upgrade"
else
del(src)
return 0
else if (byond_version < config.client_warn_version) //We have words for this client.
src << "<span class='danger'><b>Your version of byond may be getting out of date:</b></span>"
src << config.client_warn_message
src << "Your version: [byond_version]"
src << "Required version to remove this message: [config.client_warn_version] or later"

if (connection == "web")
if (!config.allowwebclient)
src << "Web client is disabled"
Expand Down
11 changes: 10 additions & 1 deletion config/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,13 @@ ANNOUNCE_ADMIN_LOGOUT

## GENERATE_MINIMAPS
## Generating minimaps(For crew monitor) is slow and bogs down testing, so its disabled by default and must be enabled by uncommenting this config if you are running a production server.
#GENERATE_MINIMAPS
#GENERATE_MINIMAPS

## CLIENT VERSION CONTROL
## This allows you to configure the minimum required client version, as well as a warning version, and message for both.
## These trigger for any version below (non-inclusive) the given version, so 510 triggers on 509 or lower.
## These messages will be followed by one stating the clients current version and the required version for clarity.
#CLIENT_WARN_VERSION 510
#CLIENT_WARN_MESSAGE Byond is really close to releasing 510 beta as the stable release, please take this time to try it out. Reports are that the client preforms better then the version you are using, and also handles network lag better. Shortly after it's release we will end up using 510 client features and you will be forced to update.
#CLIENT_ERROR_VERSION 509
#CLIENT_ERROR_MESSAGE Your version of byond is not supported. Please upgrade.

0 comments on commit 859714b

Please sign in to comment.