Actually add support for the active API version

This commit is contained in:
Jordan Brown
2020-04-27 23:26:12 -04:00
parent ac1919e1e6
commit c3291e5b71
5 changed files with 19 additions and 10 deletions
+5 -1
View File
@@ -183,7 +183,7 @@
return
//Returns TRUE if the world was launched under the server tools and the API matches, FALSE otherwise
//No function below this succeeds if it returns FALSE
//No function below this succeeds if it returns FALSE or if TgsNew() has yet to be called
/world/proc/TgsAvailable()
return
@@ -191,6 +191,10 @@
/world/proc/TgsVersion()
return
//Gets the current /datum/tgs_version of the DMAPI being used
/world/proc/TgsApiVersion()
return
//Gets the name of the TGS instance running the game
/world/proc/TgsInstanceName()
return
+5
View File
@@ -90,6 +90,11 @@
if(api)
return api.version
/world/TgsApiVersion()
var/datum/tgs_api/api = TGS_READ_GLOBAL(tgs)
if(api)
return api.ApiVersion()
/world/TgsInstanceName()
var/datum/tgs_api/api = TGS_READ_GLOBAL(tgs)
if(api)
+1 -1
View File
@@ -39,7 +39,7 @@
var/warned_custom_commands = FALSE
/datum/tgs_api/v3210/ApiVersion()
return "3.2.1.0"
return new /datum/tgs_version("3.2.1.0")
/datum/tgs_api/v3210/proc/trim_left(text)
for (var/i = 1 to length(text))
+7 -7
View File
@@ -35,9 +35,9 @@
var/security_level
var/requesting_new_port = FALSE
var/list/intercepted_message_queue
var/list/custom_commands
var/list/cached_test_merges
@@ -49,7 +49,7 @@
var/list/last_interop_response
/datum/tgs_api/v4/ApiVersion()
return "4.0.0.0"
return new /datum/tgs_version("4.0.0.0")
/datum/tgs_api/v4/OnWorldNew(datum/tgs_event_handler/event_handler, minimum_required_security_level)
json_path = world.params[TGS4_PARAM_INFO_JSON]
@@ -185,7 +185,7 @@
data = list()
data[TGS4_PARAMETER_COMMAND] = command
var/json = json_encode(data)
while(requesting_new_port && !override_requesting_new_port)
sleep(1)
@@ -199,7 +199,7 @@
//request a new port
export_lock = FALSE
var/list/new_port_json = Export(TGS4_COMM_NEW_PORT, list(TGS4_PARAMETER_DATA = "[world.port]"), TRUE) //stringify this on purpose
if(!new_port_json)
TGS_ERROR_LOG("No new port response from server![TGS4_PORT_CRITFAIL_MESSAGE]")
del(world)
@@ -236,7 +236,7 @@
var/list/result = Export(TGS4_COMM_WORLD_REBOOT)
if(!result)
return
//okay so the standard TGS4 proceedure is: right before rebooting change the port to whatever was sent to us in the above json's data parameter
var/port = result[TGS4_PARAMETER_DATA]
@@ -255,7 +255,7 @@
/datum/tgs_api/v4/TestMerges()
return cached_test_merges
/datum/tgs_api/v4/EndProcess()
Export(TGS4_COMM_END_PROCESS)
+1 -1
View File
@@ -18,7 +18,7 @@
var/datum/tgs_event_handler/event_handler
/datum/tgs_api/v5/ApiVersion()
return "5.0.0"
return new /datum/tgs_version("5.0.0")
/datum/tgs_api/v5/OnWorldNew(datum/tgs_event_handler/event_handler, minimum_required_security_level)
src.event_handler = event_handler