Merge pull request #13642 from Citadel-Station-13/tgs-dmapi-update

Automatic TGS DMAPI Update
This commit is contained in:
silicons
2020-11-07 00:33:36 -07:00
committed by GitHub
7 changed files with 44 additions and 43 deletions
+4 -1
View File
@@ -1,6 +1,6 @@
// tgstation-server DMAPI
#define TGS_DMAPI_VERSION "5.2.1"
#define TGS_DMAPI_VERSION "5.2.7"
// All functions and datums outside this document are subject to change with any version and should not be relied on.
@@ -95,6 +95,8 @@
#define TGS_EVENT_WATCHDOG_SHUTDOWN 15
/// Before the watchdog detaches for a TGS update/restart. No parameters.
#define TGS_EVENT_WATCHDOG_DETACH 16
// We don't actually implement this value as the DMAPI can never receive it
// #define TGS_EVENT_WATCHDOG_LAUNCH 17
// OTHER ENUMS
@@ -127,6 +129,7 @@
* Call this when your initializations are complete and your game is ready to play before any player interactions happen.
*
* This may use [/world/var/sleep_offline] to make this happen so ensure no changes are made to it while this call is running.
* Afterwards, consider explicitly setting it to what you want to avoid this BYOND bug: http://www.byond.com/forum/post/2575184
* Before this point, note that any static files or directories may be in use by another server. Your code should account for this.
* This function should not be called before ..() in [/world/proc/New].
*/
+1 -1
View File
@@ -50,7 +50,7 @@ TGS_PROTECT_DATUM(/datum/tgs_api)
/datum/tgs_api/proc/ChatTargetedBroadcast(message, admin_only)
return TGS_UNIMPLEMENTED
/datum/tgs_api/proc/ChatPrivateMessage(message, admin_only)
/datum/tgs_api/proc/ChatPrivateMessage(message, datum/tgs_chat_user/user)
return TGS_UNIMPLEMENTED
/datum/tgs_api/proc/SecurityLevel()
+2 -2
View File
@@ -39,7 +39,7 @@
var/warned_custom_commands = FALSE
/datum/tgs_api/v3210/ApiVersion()
return new /datum/tgs_version("3.2.1.0")
return new /datum/tgs_version("3.2.1.3")
/datum/tgs_api/v3210/proc/trim_left(text)
for (var/i = 1 to length(text))
@@ -180,7 +180,7 @@
ExportService(SERVICE_REQUEST_KILL_PROCESS)
/datum/tgs_api/v3210/ChatChannelInfo()
return list()
return list() // :omegalul:
/datum/tgs_api/v3210/ChatBroadcast(message, list/channels)
if(channels)
+6
View File
@@ -42,5 +42,11 @@
var/datum/tgs_chat_command/stc = new command_type
var/datum/tgs_chat_user/user = new
user.friendly_name = sender
// Discord hack, fix the mention if it's only numbers (fuck you IRC trolls)
var/regex/discord_id_regex = regex(@"^[0-9]+$")
if(findtext(sender, discord_id_regex))
sender = "<@[sender]>"
user.mention = sender
return stc.Run(user, params) || TRUE
+1 -8
View File
@@ -114,13 +114,6 @@
/datum/tgs_api/v4/OnInitializationComplete()
Export(TGS4_COMM_SERVER_PRIMED)
var/tgs4_secret_sleep_offline_sauce = 24051994
var/old_sleep_offline = world.sleep_offline
world.sleep_offline = tgs4_secret_sleep_offline_sauce
sleep(1)
if(world.sleep_offline == tgs4_secret_sleep_offline_sauce) //if not someone changed it
world.sleep_offline = old_sleep_offline
/datum/tgs_api/v4/OnTopic(T)
var/list/params = params2list(T)
var/their_sCK = params[TGS4_INTEROP_ACCESS_IDENTIFIER]
@@ -255,7 +248,7 @@
return instance_name
/datum/tgs_api/v4/TestMerges()
return cached_test_merges
return cached_test_merges.Copy()
/datum/tgs_api/v4/EndProcess()
Export(TGS4_COMM_END_PROCESS)
+10 -11
View File
@@ -15,8 +15,10 @@
var/datum/tgs_revision_information/revision
var/list/chat_channels
var/initialized = FALSE
/datum/tgs_api/v5/ApiVersion()
return new /datum/tgs_version("5.2.1")
return new /datum/tgs_version(TGS_DMAPI_VERSION)
/datum/tgs_api/v5/OnWorldNew(minimum_required_security_level)
server_port = world.params[DMAPI5_PARAM_SERVER_PORT]
@@ -79,6 +81,7 @@
chat_channels = list()
DecodeChannels(runtime_information)
initialized = TRUE
return TRUE
/datum/tgs_api/v5/proc/RequireInitialBridgeResponse()
@@ -88,13 +91,6 @@
/datum/tgs_api/v5/OnInitializationComplete()
Bridge(DMAPI5_BRIDGE_COMMAND_PRIME)
var/tgs4_secret_sleep_offline_sauce = 29051994
var/old_sleep_offline = world.sleep_offline
world.sleep_offline = tgs4_secret_sleep_offline_sauce
sleep(1)
if(world.sleep_offline == tgs4_secret_sleep_offline_sauce) //if not someone changed it
world.sleep_offline = old_sleep_offline
/datum/tgs_api/v5/proc/TopicResponse(error_message = null)
var/list/response = list()
response[DMAPI5_RESPONSE_ERROR_MESSAGE] = error_message
@@ -102,10 +98,13 @@
return json_encode(response)
/datum/tgs_api/v5/OnTopic(T)
if(!initialized)
return FALSE //continue world/Topic
var/list/params = params2list(T)
var/json = params[DMAPI5_TOPIC_DATA]
if(!json)
return FALSE //continue world/Topic
return FALSE
var/list/topic_parameters = json_decode(json)
if(!topic_parameters)
@@ -282,7 +281,7 @@
/datum/tgs_api/v5/TestMerges()
RequireInitialBridgeResponse()
return test_merges
return test_merges.Copy()
/datum/tgs_api/v5/EndProcess()
Bridge(DMAPI5_BRIDGE_COMMAND_KILL)
@@ -327,7 +326,7 @@
/datum/tgs_api/v5/ChatChannelInfo()
RequireInitialBridgeResponse()
return chat_channels
return chat_channels.Copy()
/datum/tgs_api/v5/proc/DecodeChannels(chat_update_json)
var/list/chat_channels_json = chat_update_json[DMAPI5_CHAT_UPDATE_CHANNELS]
+20 -20
View File
@@ -1,20 +1,20 @@
import sys
import json
if len(sys.argv) <= 1:
exit(1)
status = 0
for file in sys.argv[1:]:
with open(file, encoding="ISO-8859-1") as f:
try:
json.load(f)
except ValueError as exception:
print("JSON error in {}".format(file))
print(exception)
status = 1
else:
print("Valid {}".format(file))
exit(status)
import sys
import json
if len(sys.argv) <= 1:
exit(1)
status = 0
for file in sys.argv[1:]:
with open(file, encoding="ISO-8859-1") as f:
try:
json.load(f)
except ValueError as exception:
print("JSON error in {}".format(file))
print(exception)
status = 1
else:
print("Valid {}".format(file))
exit(status)