From 26ddf35f4955d948aeb995e8711c305251892d40 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 18 Sep 2017 17:01:29 -0400 Subject: [PATCH 01/25] API and licensing memes --- DMAPI/LICENSE | 24 +++++++++++++ DMAPI/server_tools.dm | 79 +++++++++++++++++++++++++++++++++++++++++ DMAPI/st_commands.dm | 49 ++++++++++++++++++++++++++ DMAPI/st_interface.dm | 82 +++++++++++++++++++++++++++++++++++++++++++ README.md | 8 +++++ 5 files changed, 242 insertions(+) create mode 100644 DMAPI/LICENSE create mode 100644 DMAPI/server_tools.dm create mode 100644 DMAPI/st_commands.dm create mode 100644 DMAPI/st_interface.dm diff --git a/DMAPI/LICENSE b/DMAPI/LICENSE new file mode 100644 index 0000000000..6eafbd734a --- /dev/null +++ b/DMAPI/LICENSE @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2011 Dominic Tarr + +Permission is hereby granted, free of charge, +to any person obtaining a copy of this software and +associated documentation files (the "Software"), to +deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/DMAPI/server_tools.dm b/DMAPI/server_tools.dm new file mode 100644 index 0000000000..2aa7d232ef --- /dev/null +++ b/DMAPI/server_tools.dm @@ -0,0 +1,79 @@ +// /tg/station 13 server tools API v3.1 + +//Required interfaces: + +//#error /tg/station server tools interface defines missing +#define SERVER_TOOLS_INSTALLATION_PATH "code/modules/server_tools" //path from the .dmb of your project to the `server_tools` folder. No leading `/` +#define SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(Name, Value) GLOBAL_VAR_INIT(##Name, ##Value); GLOBAL_PROTECT(##Name) //create a global variable named `Name` and set it to `Value` +#define SERVER_TOOLS_READ_GLOBAL(Name) GLOB.##Name //Read the value in the global variable `Name` +#define SERVER_TOOLS_WRITE_GLOBAL(Name, Value) GLOB.##Name = ##Value //Set the value in the global variable `Name` to `Value` +#define SERVER_TOOLS_WORLD_ANNOUNCE(message) to_chat(world, "[html_encode(##message)]") //display an announcement `message` from the server to all players +#define SERVER_TOOLS_LOG(message) log_world("SERVICE: [##message]") //Write a `message` to a server log +#define SERVER_TOOLS_NOTIFY_ADMINS(event) message_admins(##event) //Notify current in-game administrators of an `event` + +//Required hooks: + +//Put this somewhere in /world/New() that is always run +#define SERVER_TOOLS_ON_NEW ListServiceCustomCommands(TRUE) +//Put this somewhere in /world/Topic(T, Addr, Master, Keys) that is always run before T is modified +#define SERVER_TOOLS_ON_TOPIC var/service_topic_return = ServiceCommand(params2list(T)); if(service_topic_return) return service_topic_return +//Put at the beginning of world/Reboot(reason) +#define SERVER_TOOLS_ON_REBOOT ServiceReboot() + + +//Optional functions: + +//Returns TRUE if the world was launched under the server tools, FALSE otherwise +//No other function in this list will suceed if this is FALSE +#define SERVER_TOOLS_PRESENT (world.RunningService() != null) +//Gets the current version of the server tools, only supported in versions >= 3.0.91.0 +#define SERVER_TOOLS_VERSION world.ServiceVersion() +//Forces a hard reboot of BYOND by ending the process +#define SERVER_TOOLS_REBOOT_BYOND world.ServiceEndProcess() +/* + Gets the list of any testmerged github pull requests + + "[PR Number]" => list( + "title" -> PR title + "commit" -> Full hash of commit merged + "author" -> Github username of the author of the PR + ) +*/ +#define SERVER_TOOLS_PR_LIST GetTestMerges() +//Sends a message to connected game chats +#define SERVER_TOOLS_CHAT_BROADCAST(message) world.ChatBroadcast(message) +//Sends a message to connected admin chats +#define SERVER_TOOLS_RELAY_BROADCAST(message) world.AdminBroadcast(message) + + +//Implementation defines + +#define REBOOT_MODE_NORMAL 0 +#define REBOOT_MODE_HARD 1 +#define REBOOT_MODE_SHUTDOWN 2 + +//keep these in sync with TGS3 +#define SERVICE_WORLD_PARAM "server_service" +#define SERVICE_VERSION_PARAM "server_service_version" +#define SERVICE_PR_TEST_JSON "prtestjob.json" +#define SERVICE_INTERFACE_DLL "TGServiceInterface.dll" +#define SERVICE_INTERFACE_FUNCTION "DDEntryPoint" + +#define SERVICE_CMD_HARD_REBOOT "hard_reboot" +#define SERVICE_CMD_GRACEFUL_SHUTDOWN "graceful_shutdown" +#define SERVICE_CMD_WORLD_ANNOUNCE "world_announce" +#define SERVICE_CMD_LIST_CUSTOM "list_custom_commands" + +#define SERVICE_CMD_PARAM_KEY "serviceCommsKey" +#define SERVICE_CMD_PARAM_COMMAND "command" +#define SERVICE_CMD_PARAM_SENDER "sender" +#define SERVICE_CMD_PARAM_CUSTOM "custom" + +#define SERVICE_JSON_PARAM_HELPTEXT "help_text" +#define SERVICE_JSON_PARAM_ADMINONLY "admin_only" +#define SERVICE_JSON_PARAM_REQUIREDPARAMETERS "required_parameters" + +#define SERVICE_REQUEST_KILL_PROCESS "killme" +#define SERVICE_REQUEST_IRC_BROADCAST "irc" +#define SERVICE_REQUEST_IRC_ADMIN_CHANNEL_MESSAGE "send2irc" +#define SERVICE_REQUEST_WORLD_REBOOT "worldreboot" diff --git a/DMAPI/st_commands.dm b/DMAPI/st_commands.dm new file mode 100644 index 0000000000..89b10c2a68 --- /dev/null +++ b/DMAPI/st_commands.dm @@ -0,0 +1,49 @@ +/datum/server_tools_command + var/name = "" //the string to trigger this command on a chat bot. e.g. TGS3_BOT: do_this_command + var/help_text = "" //help text for this command + var/required_parameters = 0 //number of parameters required for this command + var/admin_only = FALSE //set to TRUE if this command should only be usable by registered chat admins + +//override to implement command +//sender is the display name of who sent the command +//params is the trimmed string following the command name +/datum/server_tools_command/proc/Run(sender, params) + CRASH("[type] has no implementation for Run()") + +/world/proc/ListServiceCustomCommands(warnings_only) + if(!warnings_only) + . = list() + var/list/command_name_types = list() + var/list/warned_command_names = warnings_only ? list() : null + for(var/I in typesof(/datum/server_tools_command) - /datum/server_tools_command) + var/datum/server_tools_command/stc = I + var/command_name = initial(stc.name) + var/static/list/warned_server_tools_names = list() + if(!command_name || findtext(command_name, " ") || findtext(command_name, "'") || findtext(command_name, "\"")) + if(warnings_only && !warned_command_names[command_name]) + SERVER_TOOLS_LOG("WARNING: Custom command [command_name] can't be used as it is empty or contains illegal characters!") + warned_command_names[command_name] = TRUE + continue + + if(command_name_types[command_name]) + if(warnings_only) + SERVER_TOOLS_LOG("WARNING: Custom commands [command_name_types[command_name]] and [stc] have the same name, only [command_name_types[command_name]] will be available!") + continue + command_name_types[stc] = command_name + + if(!warnings_only) + .[command_name] = list(SERVICE_JSON_PARAM_HELPTEXT = initial(stc.help_text), SERVICE_JSON_PARAM_ADMINONLY = initial(stc.admin_only), SERVICE_JSON_PARAM_REQUIREDPARAMETERS = initial(stc.required_parameters)) + +/world/proc/HandleServiceCustomCommand(command, sender, params) + var/static/list/cached_custom_server_tools_commands + if(!cached_custom_server_tools_commands) + cached_custom_server_tools_commands = list() + for(var/I in typesof(/datum/server_tools_command) - /datum/server_tools_command) + var/datum/server_tools_command/stc = I + cached_custom_server_tools_commands[lowertext(initial(stc.name))] = stc + + var/command_type = cached_custom_server_tools_commands[command] + if(!command_type) + return FALSE + var/datum/server_tools_command/stc = new command_type + return stc.Run(sender, params) || TRUE diff --git a/DMAPI/st_interface.dm b/DMAPI/st_interface.dm new file mode 100644 index 0000000000..8354f888df --- /dev/null +++ b/DMAPI/st_interface.dm @@ -0,0 +1,82 @@ +SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(reboot_mode, REBOOT_MODE_NORMAL) + +/proc/GetTestMerges() + if(world.RunningService() && fexists(SERVICE_PR_TEST_JSON)) + . = json_decode(file2text(SERVICE_PR_TEST_JSON)) + if(.) + return + return list() + +/world/proc/RunningService() + return params[SERVICE_WORLD_PARAM] + +/proc/ServiceVersion() + if(world.RunningService()) + return world.params[SERVICE_VERSION_PARAM] + +/world/proc/ExportService(command) + . = FALSE + call(SERVICE_INTERFACE_DLL, SERVICE_INTERFACE_FUNCTION)(command) //trust no retval + return TRUE + +/world/proc/ChatBroadcast(message) + ExportService("[SERVICE_REQUEST_IRC_BROADCAST] [message]") + +/world/proc/AdminBroadcast(message) + ExportService("[SERVICE_REQUEST_IRC_ADMIN_CHANNEL_MESSAGE] [message]") + +/world/proc/ServiceEndProcess() + SERVER_TOOLS_LOG("Sending shutdown request!"); + sleep(world.tick_lag) //flush the buffers + ExportService(SERVICE_REQUEST_KILL_PROCESS) + +//called at the exact moment the world is supposed to reboot +/world/proc/ServiceReboot() + switch(SERVER_TOOLS_READ_GLOBAL(reboot_mode)) + if(REBOOT_MODE_HARD) + SERVER_TOOLS_WORLD_ANNOUNCE("Hard reboot triggered, you will automatically reconnect...") + ServiceEndProcess() + if(REBOOT_MODE_SHUTDOWN) + SERVER_TOOLS_WORLD_ANNOUNCE("The server is shutting down...") + ServiceEndProcess() + else + ExportService(SERVICE_REQUEST_WORLD_REBOOT) //just let em know + +/world/proc/ServiceCommand(list/params) + var/sCK = RunningService() + var/their_sCK = params[SERVICE_CMD_PARAM_KEY] + + if(!their_sCK) + return FALSE //continue world/Topic + + if(their_sCK != sCK) + return "Invalid comms key!"; + + var/command = params[SERVICE_CMD_PARAM_COMMAND] + if(!command) + return "No command!" + + switch(command) + if(SERVICE_CMD_HARD_REBOOT) + if(SERVER_TOOLS_READ_GLOBAL(reboot_mode) != REBOOT_MODE_HARD) + SERVER_TOOLS_WRITE_GLOBAL(reboot_mode, REBOOT_MODE_HARD) + SERVER_TOOLS_LOG("Hard reboot requested by service") + SERVER_TOOLS_NOTIFY_ADMINS("The world will hard reboot at the end of the game. Requested by service.") + if(SERVICE_CMD_GRACEFUL_SHUTDOWN) + if(SERVER_TOOLS_READ_GLOBAL(reboot_mode) != REBOOT_MODE_SHUTDOWN) + SERVER_TOOLS_WRITE_GLOBAL(reboot_mode, REBOOT_MODE_SHUTDOWN) + SERVER_TOOLS_LOG("Shutdown requested by service") + message_admins("The world will shutdown at the end of the game. Requested by service.") + if(SERVICE_CMD_WORLD_ANNOUNCE) + var/msg = params["message"] + if(!istext(msg) || !msg) + return "No message set!" + SERVER_TOOLS_WORLD_ANNOUNCE(msg) + return "SUCCESS" + if(SERVICE_CMD_LIST_CUSTOM) + return json_encode(ListServiceCustomCommands(FALSE)) + else + var/custom_command_result = HandleServiceCustomCommand(lowertext(command), params[SERVICE_CMD_PARAM_SENDER], params[SERVICE_CMD_PARAM_CUSTOM]) + if(custom_command_result) + return istext(custom_command_result) ? custom_command_result : "SUCCESS" + return "Unknown command: [command]" diff --git a/README.md b/README.md index abc3e3943f..d5cfa6a1db 100644 --- a/README.md +++ b/README.md @@ -180,3 +180,11 @@ You can clear all active test merges using `Reset to Origin Branch` in the `Repo ## CONTRIBUTING * Version numbers and releases will be handled by maintainers, do not modify these in your PR + +## LICENSING + +* The DM API for TGS3 is licensed under the MIT license. +* The /tg/station 13 icon is licensed under [Creative Commons 3.0 BY-SA](http://creativecommons.org/licenses/by-sa/3.0/). +* The remainder of the project is licensed under [GNU AGPL v3](http://www.gnu.org/licenses/agpl-3.0.html) + +See DMAPI/LICENSE for the MIT license From 0d895422728308739d966d6b618bf2e0e1614c72 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 18 Sep 2017 17:16:43 -0400 Subject: [PATCH 02/25] This is so WIP --- DMAPI/LICENSE | 24 -------------- DMAPI/server_tools.dm | 65 +++++++++++++++++++++++++++++--------- DMAPI/st_commands.dm | 27 ++++++++++++++++ DMAPI/st_interface.dm | 29 +++++++++++++++++ README.md | 2 +- TGServerService/Interop.cs | 6 ++++ TGStationServer3.sln | 14 ++++++-- 7 files changed, 125 insertions(+), 42 deletions(-) delete mode 100644 DMAPI/LICENSE diff --git a/DMAPI/LICENSE b/DMAPI/LICENSE deleted file mode 100644 index 6eafbd734a..0000000000 --- a/DMAPI/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -The MIT License - -Copyright (c) 2011 Dominic Tarr - -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software and -associated documentation files (the "Software"), to -deal in the Software without restriction, including -without limitation the rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom -the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/DMAPI/server_tools.dm b/DMAPI/server_tools.dm index 2aa7d232ef..a25ac1cec6 100644 --- a/DMAPI/server_tools.dm +++ b/DMAPI/server_tools.dm @@ -1,15 +1,23 @@ // /tg/station 13 server tools API v3.1 -//Required interfaces: +//CONFIGURATION +//Comment this out once you've filled the below +#error /tg/station server tools interface unconfigured -//#error /tg/station server tools interface defines missing -#define SERVER_TOOLS_INSTALLATION_PATH "code/modules/server_tools" //path from the .dmb of your project to the `server_tools` folder. No leading `/` -#define SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(Name, Value) GLOBAL_VAR_INIT(##Name, ##Value); GLOBAL_PROTECT(##Name) //create a global variable named `Name` and set it to `Value` -#define SERVER_TOOLS_READ_GLOBAL(Name) GLOB.##Name //Read the value in the global variable `Name` -#define SERVER_TOOLS_WRITE_GLOBAL(Name, Value) GLOB.##Name = ##Value //Set the value in the global variable `Name` to `Value` -#define SERVER_TOOLS_WORLD_ANNOUNCE(message) to_chat(world, "[html_encode(##message)]") //display an announcement `message` from the server to all players -#define SERVER_TOOLS_LOG(message) log_world("SERVICE: [##message]") //Write a `message` to a server log -#define SERVER_TOOLS_NOTIFY_ADMINS(event) message_admins(##event) //Notify current in-game administrators of an `event` +//Required interfaces (fill in with your codebase equivalent): + +//create a global variable named `Name` and set it to `Value` +#define SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(Name, Value) +//Read the value in the global variable `Name` +#define SERVER_TOOLS_READ_GLOBAL(Name) +//Set the value in the global variable `Name` to `Value` +#define SERVER_TOOLS_WRITE_GLOBAL(Name, Value) +//display an announcement `message` from the server to all players +#define SERVER_TOOLS_WORLD_ANNOUNCE(message) +//Write a string `message` to a server log +#define SERVER_TOOLS_LOG(message) +//Notify current in-game administrators of a string `event` +#define SERVER_TOOLS_NOTIFY_ADMINS(event) //Required hooks: @@ -20,11 +28,10 @@ //Put at the beginning of world/Reboot(reason) #define SERVER_TOOLS_ON_REBOOT ServiceReboot() +//Optional callable functions: -//Optional functions: - -//Returns TRUE if the world was launched under the server tools, FALSE otherwise -//No other function in this list will suceed if this is FALSE +//Returns TRUE if the world was launched under the server tools and the API matches, FALSE otherwise +//No other function in this list will succeed if this is FALSE #define SERVER_TOOLS_PRESENT (world.RunningService() != null) //Gets the current version of the server tools, only supported in versions >= 3.0.91.0 #define SERVER_TOOLS_VERSION world.ServiceVersion() @@ -45,14 +52,14 @@ //Sends a message to connected admin chats #define SERVER_TOOLS_RELAY_BROADCAST(message) world.AdminBroadcast(message) +//IMPLEMENTATION -//Implementation defines +#define SERVICE_API_VERSION "3.1.0.0" #define REBOOT_MODE_NORMAL 0 #define REBOOT_MODE_HARD 1 #define REBOOT_MODE_SHUTDOWN 2 -//keep these in sync with TGS3 #define SERVICE_WORLD_PARAM "server_service" #define SERVICE_VERSION_PARAM "server_service_version" #define SERVICE_PR_TEST_JSON "prtestjob.json" @@ -63,6 +70,7 @@ #define SERVICE_CMD_GRACEFUL_SHUTDOWN "graceful_shutdown" #define SERVICE_CMD_WORLD_ANNOUNCE "world_announce" #define SERVICE_CMD_LIST_CUSTOM "list_custom_commands" +#define SERVICE_CMD_API_VERSION "api_ver" #define SERVICE_CMD_PARAM_KEY "serviceCommsKey" #define SERVICE_CMD_PARAM_COMMAND "command" @@ -77,3 +85,30 @@ #define SERVICE_REQUEST_IRC_BROADCAST "irc" #define SERVICE_REQUEST_IRC_ADMIN_CHANNEL_MESSAGE "send2irc" #define SERVICE_REQUEST_WORLD_REBOOT "worldreboot" + +/* +The MIT License + +Copyright (c) 2011 Dominic Tarr + +Permission is hereby granted, free of charge, +to any person obtaining a copy of this software and +associated documentation files (the "Software"), to +deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ diff --git a/DMAPI/st_commands.dm b/DMAPI/st_commands.dm index 89b10c2a68..5334e41eac 100644 --- a/DMAPI/st_commands.dm +++ b/DMAPI/st_commands.dm @@ -47,3 +47,30 @@ return FALSE var/datum/server_tools_command/stc = new command_type return stc.Run(sender, params) || TRUE + +/* +The MIT License + +Copyright (c) 2011 Dominic Tarr + +Permission is hereby granted, free of charge, +to any person obtaining a copy of this software and +associated documentation files (the "Software"), to +deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ diff --git a/DMAPI/st_interface.dm b/DMAPI/st_interface.dm index 8354f888df..c21fe28fdc 100644 --- a/DMAPI/st_interface.dm +++ b/DMAPI/st_interface.dm @@ -73,6 +73,8 @@ SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(reboot_mode, REBOOT_MODE_NORMAL) return "No message set!" SERVER_TOOLS_WORLD_ANNOUNCE(msg) return "SUCCESS" + if(SERVICE_CMD_API_VERSION) + return SERVICE_API_VERSION if(SERVICE_CMD_LIST_CUSTOM) return json_encode(ListServiceCustomCommands(FALSE)) else @@ -80,3 +82,30 @@ SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(reboot_mode, REBOOT_MODE_NORMAL) if(custom_command_result) return istext(custom_command_result) ? custom_command_result : "SUCCESS" return "Unknown command: [command]" + +/* +The MIT License + +Copyright (c) 2011 Dominic Tarr + +Permission is hereby granted, free of charge, +to any person obtaining a copy of this software and +associated documentation files (the "Software"), to +deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ diff --git a/README.md b/README.md index d5cfa6a1db..259d5eedec 100644 --- a/README.md +++ b/README.md @@ -187,4 +187,4 @@ You can clear all active test merges using `Reset to Origin Branch` in the `Repo * The /tg/station 13 icon is licensed under [Creative Commons 3.0 BY-SA](http://creativecommons.org/licenses/by-sa/3.0/). * The remainder of the project is licensed under [GNU AGPL v3](http://www.gnu.org/licenses/agpl-3.0.html) -See DMAPI/LICENSE for the MIT license +See the bottom of each file in the /DMAPI tree for the MIT license diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index e4ec5796cc..8e0949391a 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -13,15 +13,21 @@ namespace TGServerService //handles talking between the world and us partial class TGStationServer : ITGServiceBridge { + object topicLock = new object(); const int CommsKeyLen = 64; string serviceCommsKey; //regenerated every DD restart + //range of supported api versions + const string MinAPIVersion = "3.1.0.0"; + const string MaxAPIVersion = "3.1.0.0"; + //See code/modules/server_tools/server_tools.dm for command switch const string SCHardReboot = "hard_reboot"; //requests that dreamdaemon restarts when the round ends const string SCGracefulShutdown = "graceful_shutdown"; //requests that dreamdaemon stops when the round ends const string SCWorldAnnounce = "world_announce"; //sends param 'message' to the world const string SCListCustomCommands = "list_custom_commands"; //Get a list of commands supported by the server + const string SCGetAPIVer = "api_ver"; //Returns the server's API version const string SRKillProcess = "killme"; const string SRIRCBroadcast = "irc"; diff --git a/TGStationServer3.sln b/TGStationServer3.sln index 77d969b67f..2e3f029c88 100644 --- a/TGStationServer3.sln +++ b/TGStationServer3.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.15 +VisualStudioVersion = 15.0.26730.3 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGServerService", "TGServerService\TGServerService.csproj", "{F32EDA25-0855-411C-AF5E-F0D042917E2D}" EndProject @@ -29,7 +29,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TGInstallerWrapper", "TGIns {154435F6-0890-42D4-9AEC-B743D4FBC1CB} = {154435F6-0890-42D4-9AEC-B743D4FBC1CB} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TGS2", "TGS2", "{0DDF886A-7ABB-4DCA-96A3-349B2DA00016}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "legacy", "legacy", "{0DDF886A-7ABB-4DCA-96A3-349B2DA00016}" ProjectSection(SolutionItems) = preProject legacy\config.bat = legacy\config.bat legacy\copyexclude.txt = legacy\copyexclude.txt @@ -62,6 +62,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "bin", "bin", "{3BB3DA66-970 legacy\bin\updategit.bat = legacy\bin\updategit.bat EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DMAPI", "DMAPI", "{9032B448-5E2B-4E71-8ECB-D5FB828E049C}" + ProjectSection(SolutionItems) = preProject + DMAPI\server_tools.dm = DMAPI\server_tools.dm + DMAPI\st_commands.dm = DMAPI\st_commands.dm + DMAPI\st_interface.dm = DMAPI\st_interface.dm + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -99,4 +106,7 @@ Global GlobalSection(NestedProjects) = preSolution {3BB3DA66-970C-4AAE-A77C-9E40F5E7E56A} = {0DDF886A-7ABB-4DCA-96A3-349B2DA00016} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1B511D10-AB55-43E0-B363-7F8838E9E977} + EndGlobalSection EndGlobal From 5200d9a2b9fbbca9fb9a9799e774e85115740588 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 11:11:11 -0400 Subject: [PATCH 03/25] API Version Verification. Interface revision. Test project --- .travis.yml | 17 ++++++++++++++ DMAPI/server_tools.dm | 22 +++++++++++------- DMAPI/st_interface.dm | 29 ++++++++++++++++++------ DMAPITravisTester.dm | 39 ++++++++++++++++++++++++++++++++ DMAPITravisTester.dme | 20 ++++++++++++++++ TGServerService/Interop.cs | 21 ++++++++++++++--- TGServerService/ServerService.cs | 1 + build_byond.sh | 18 +++++++++++++++ install_byond.sh | 21 +++++++++++++++++ 9 files changed, 170 insertions(+), 18 deletions(-) create mode 100644 .travis.yml create mode 100644 DMAPITravisTester.dm create mode 100644 DMAPITravisTester.dme create mode 100755 build_byond.sh create mode 100755 install_byond.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..e3cd01e65a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: generic +sudo: false + +env: + global: + - BYOND_MAJOR="511" + - BYOND_MINOR="1385" + +cache: + directories: + - $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR} + +install: + - install_byond.sh + +build: + - build_byond.sh diff --git a/DMAPI/server_tools.dm b/DMAPI/server_tools.dm index a25ac1cec6..4c4c27583f 100644 --- a/DMAPI/server_tools.dm +++ b/DMAPI/server_tools.dm @@ -1,12 +1,13 @@ // /tg/station 13 server tools API v3.1 //CONFIGURATION -//Comment this out once you've filled the below +//Comment this out once you've filled in the below #error /tg/station server tools interface unconfigured //Required interfaces (fill in with your codebase equivalent): //create a global variable named `Name` and set it to `Value` +//These globals must not be modifiable from anywhere outside of the server tools #define SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(Name, Value) //Read the value in the global variable `Name` #define SERVER_TOOLS_READ_GLOBAL(Name) @@ -22,7 +23,7 @@ //Required hooks: //Put this somewhere in /world/New() that is always run -#define SERVER_TOOLS_ON_NEW ListServiceCustomCommands(TRUE) +#define SERVER_TOOLS_ON_NEW ServiceInit() //Put this somewhere in /world/Topic(T, Addr, Master, Keys) that is always run before T is modified #define SERVER_TOOLS_ON_TOPIC var/service_topic_return = ServiceCommand(params2list(T)); if(service_topic_return) return service_topic_return //Put at the beginning of world/Reboot(reason) @@ -30,12 +31,16 @@ //Optional callable functions: +//Returns the string version of the API +#define SERVER_TOOLS_API_VERSION ServiceAPIVersion() //Returns TRUE if the world was launched under the server tools and the API matches, FALSE otherwise -//No other function in this list will succeed if this is FALSE -#define SERVER_TOOLS_PRESENT (world.RunningService() != null) -//Gets the current version of the server tools, only supported in versions >= 3.0.91.0 -#define SERVER_TOOLS_VERSION world.ServiceVersion() +//No function below this succeed if this is FALSE +#define SERVER_TOOLS_PRESENT (RunningService() != null) +//Gets the current version of the service running the server +#define SERVER_TOOLS_VERSION ServiceVersion() //Forces a hard reboot of BYOND by ending the process +//unlike del(world) this will release any open .dll handles, purge all memory leaks, and clients will try to reconnect +//If the service has not requested a shutdown, the world will reboot shortly after #define SERVER_TOOLS_REBOOT_BYOND world.ServiceEndProcess() /* Gets the list of any testmerged github pull requests @@ -54,7 +59,7 @@ //IMPLEMENTATION -#define SERVICE_API_VERSION "3.1.0.0" +#define SERVICE_API_VERSION_STRING "3.1.0.0" #define REBOOT_MODE_NORMAL 0 #define REBOOT_MODE_HARD 1 @@ -70,12 +75,12 @@ #define SERVICE_CMD_GRACEFUL_SHUTDOWN "graceful_shutdown" #define SERVICE_CMD_WORLD_ANNOUNCE "world_announce" #define SERVICE_CMD_LIST_CUSTOM "list_custom_commands" -#define SERVICE_CMD_API_VERSION "api_ver" #define SERVICE_CMD_PARAM_KEY "serviceCommsKey" #define SERVICE_CMD_PARAM_COMMAND "command" #define SERVICE_CMD_PARAM_SENDER "sender" #define SERVICE_CMD_PARAM_CUSTOM "custom" +#define SERVICE_CMD_API_COMPATIBLE "api_compat" #define SERVICE_JSON_PARAM_HELPTEXT "help_text" #define SERVICE_JSON_PARAM_ADMINONLY "admin_only" @@ -85,6 +90,7 @@ #define SERVICE_REQUEST_IRC_BROADCAST "irc" #define SERVICE_REQUEST_IRC_ADMIN_CHANNEL_MESSAGE "send2irc" #define SERVICE_REQUEST_WORLD_REBOOT "worldreboot" +#define SERVICE_REQUEST_API_VERSION "api_ver" /* The MIT License diff --git a/DMAPI/st_interface.dm b/DMAPI/st_interface.dm index c21fe28fdc..570798eead 100644 --- a/DMAPI/st_interface.dm +++ b/DMAPI/st_interface.dm @@ -1,21 +1,35 @@ SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(reboot_mode, REBOOT_MODE_NORMAL) +SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(server_tools_api_compatible, FALSE) /proc/GetTestMerges() - if(world.RunningService() && fexists(SERVICE_PR_TEST_JSON)) + if(RunningService() && fexists(SERVICE_PR_TEST_JSON)) . = json_decode(file2text(SERVICE_PR_TEST_JSON)) if(.) return return list() -/world/proc/RunningService() - return params[SERVICE_WORLD_PARAM] +/world/proc/ServiceInit() + if(!RunningService(TRUE)) + return + ListCustomCommands() + ExportService("[SERVICE_REQUEST_API_VERSION] [SERVICE_API_VERSION]", TRUE) + +/proc/RunningService(skip_compat_check = FALSE) + return (skip_compat_check || SERVER_TOOLS_READ_GLOBAL(server_tools_api_compatible)) && world.params[SERVICE_WORLD_PARAM] /proc/ServiceVersion() - if(world.RunningService()) + if(RunningService(TRUE)) return world.params[SERVICE_VERSION_PARAM] -/world/proc/ExportService(command) +/proc/ServiceAPIVersion() + return SERVICE_API_VERSION_STRING + +/world/proc/ExportService(command, skip_compat_check = FALSE) . = FALSE + if(!RunningService(skip_compat_check)) + return + if(skip_compat_check && !fexists(SERVICE_INTERFACE_DLL)) + CRASH("Service parameter present but no interface DLL detected. This is symptomatic of running a service less than version 3.1! Please upgrade.") call(SERVICE_INTERFACE_DLL, SERVICE_INTERFACE_FUNCTION)(command) //trust no retval return TRUE @@ -57,6 +71,9 @@ SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(reboot_mode, REBOOT_MODE_NORMAL) return "No command!" switch(command) + if(SERVICE_CMD_API_COMPATIBLE) + SERVER_TOOLS_WRITE_GLOBAL(server_tools_api_compatible, TRUE) + return "SUCCESS" if(SERVICE_CMD_HARD_REBOOT) if(SERVER_TOOLS_READ_GLOBAL(reboot_mode) != REBOOT_MODE_HARD) SERVER_TOOLS_WRITE_GLOBAL(reboot_mode, REBOOT_MODE_HARD) @@ -73,8 +90,6 @@ SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(reboot_mode, REBOOT_MODE_NORMAL) return "No message set!" SERVER_TOOLS_WORLD_ANNOUNCE(msg) return "SUCCESS" - if(SERVICE_CMD_API_VERSION) - return SERVICE_API_VERSION if(SERVICE_CMD_LIST_CUSTOM) return json_encode(ListServiceCustomCommands(FALSE)) else diff --git a/DMAPITravisTester.dm b/DMAPITravisTester.dm new file mode 100644 index 0000000000..fa7df9f483 --- /dev/null +++ b/DMAPITravisTester.dm @@ -0,0 +1,39 @@ +//Fill out a dummy API +#define SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(Name, Value) var/##Name = ##Value +#define SERVER_TOOLS_READ_GLOBAL(Name) global.##Name +#define SERVER_TOOLS_WRITE_GLOBAL(Name, Value) global.##Name = ##Value +#define SERVER_TOOLS_WORLD_ANNOUNCE(message) world << ##message +#define SERVER_TOOLS_LOG(message) world.log << ##message +#define SERVER_TOOLS_NOTIFY_ADMINS(event) message_admins(event) + +/world/New() + SERVER_TOOLS_ON_NEW + world.log << "Service API Version: [SERVER_TOOLS_API_VERSION]" + WaitForAPICompatResponse() + +/world/Topic(T, Addr, Master, Keys) + SERVER_TOOLS_ON_TOPIC + +/world/Reboot(reason) + SERVER_TOOLS_ON_REBOOT + SERVER_TOOLS_REBOOT_BYOND + +/proc/message_admins(event) + world << event + world.log << event + +/proc/WaitForAPICompatResponse() + set waitfor = FALSE + sleep(50) + if(!SERVER_TOOLS_PRESENT) + world.log << "No running service detected" + return + world.log << "Running service version: [SERVER_TOOLS_VERSION]" + var/list/prs = SERVER_TOOLS_PR_LIST + for(var/I in prs) + var/data = prs[I] + world.log << "Testmerge: #[I]: [data["title"]] by [data["author"]] at commit [data["commit"]]" + var/checks_complete = "Server tools API checks complete! Rebooting..." + SERVER_TOOLS_CHAT_BROADCAST(checks_complete) + SERVER_TOOLS_RELAY_BROADCAST(checks_complete) + world.Reboot() diff --git a/DMAPITravisTester.dme b/DMAPITravisTester.dme new file mode 100644 index 0000000000..721607b654 --- /dev/null +++ b/DMAPITravisTester.dme @@ -0,0 +1,20 @@ +// DM Environment file for DMAPITravisTester.dme. +// All manual changes should be made outside the BEGIN_ and END_ blocks. +// New source code should be placed in .dm files: choose File/New --> Code File. + +// BEGIN_INTERNALS +// END_INTERNALS + +// BEGIN_FILE_DIR +#define FILE_DIR . +// END_FILE_DIR + +// BEGIN_PREFERENCES +// END_PREFERENCES + +// BEGIN_INCLUDE +#include "DMAPITravisTester.dm" +#include "DMAPI\server_tools.dm" +#include "DMAPI\st_commands.dm" +#include "DMAPI\st_interface.dm" +// END_INCLUDE diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index 8e0949391a..5cf968e842 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; using System.Text; -using System.Threading; using System.Web.Script.Serialization; using System.Web.Security; using TGServiceInterface; @@ -20,19 +19,20 @@ namespace TGServerService //range of supported api versions const string MinAPIVersion = "3.1.0.0"; - const string MaxAPIVersion = "3.1.0.0"; + const string MaxAPIVersion = "3.1.0.99"; //See code/modules/server_tools/server_tools.dm for command switch const string SCHardReboot = "hard_reboot"; //requests that dreamdaemon restarts when the round ends const string SCGracefulShutdown = "graceful_shutdown"; //requests that dreamdaemon stops when the round ends const string SCWorldAnnounce = "world_announce"; //sends param 'message' to the world const string SCListCustomCommands = "list_custom_commands"; //Get a list of commands supported by the server - const string SCGetAPIVer = "api_ver"; //Returns the server's API version + const string SCAPICompat = "api_compat"; //Tells the server we understand each other const string SRKillProcess = "killme"; const string SRIRCBroadcast = "irc"; const string SRIRCAdminChannelMessage = "send2irc"; const string SRWorldReboot = "worldreboot"; + const string SRAPIVersion = "api_ver"; const string CCPHelpText = "help_text"; const string CCPAdminOnly = "admin_only"; @@ -88,6 +88,21 @@ namespace TGServerService } } break; + case SRAPIVersion: + try + { + var theirs = new Version(splits[1]); + var minimum = new Version(MinAPIVersion); + var maximum = new Version(MaxAPIVersion); + if (theirs < minimum || theirs > maximum) + throw new Exception(); + SendCommand(SCAPICompat); + } + catch + { + TGServerService.WriteWarning("API version of the game ({0}) is incompatible with the current supported API versions (Min: {1}. Max: {2})", TGServerService.EventID.APIVersionMismatch); + } + break; } } diff --git a/TGServerService/ServerService.cs b/TGServerService/ServerService.cs index d32c8bbb5a..3241c4c295 100644 --- a/TGServerService/ServerService.cs +++ b/TGServerService/ServerService.cs @@ -79,6 +79,7 @@ namespace TGServerService PreactionEvent = 6800, PreactionFail = 6900, InteropCallException = 7000, + APIVersionMismatch = 7100, } static TGServerService ActiveService; //So everyone else can write to our eventlog diff --git a/build_byond.sh b/build_byond.sh new file mode 100755 index 0000000000..392ff04378 --- /dev/null +++ b/build_byond.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +#nb: must be bash to support shopt globstar +set -e +source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup +if hash DreamMaker 2>/dev/null +then + DreamMaker $dmepath.mdme 2>&1 | tee result.log + retval=$? + if ! grep '\- 0 errors, 0 warnings' result.log + then + retval=1 #hard fail, due to warnings or errors + fi +else + echo "Couldn't find the DreamMaker executable, aborting." + retval=2 +fi +exit $retval \ No newline at end of file diff --git a/install_byond.sh b/install_byond.sh new file mode 100755 index 0000000000..b2da430247 --- /dev/null +++ b/install_byond.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -e + +if [ -d "$HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin" ]; +then + echo "Using cached directory." + exit 0 +else + echo "Setting up BYOND." + mkdir -p "$HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}" + cd "$HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}" + curl "http://www.byond.com/download/build/${BYOND_MAJOR}/${BYOND_MAJOR}.${BYOND_MINOR}_byond_linux.zip" -o byond.zip + unzip byond.zip + cd byond + make here + cd ~/ + exit 0 +fi + +#some variable not set correctly, panic +exit 1 From b036d31d0146f9006189eef2c50a42ae42f7b945 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 11:15:03 -0400 Subject: [PATCH 04/25] The one time I don't need tabs --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e3cd01e65a..8d0c6210b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,13 @@ env: global: - BYOND_MAJOR="511" - BYOND_MINOR="1385" - + cache: directories: - $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR} install: - - install_byond.sh + - install_byond.sh -build: - - build_byond.sh +script: + - build_byond.sh From 8bfb955d429923d387cee39f07d2bae654b30c71 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 11:18:13 -0400 Subject: [PATCH 05/25] Good ol bash --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8d0c6210b6..3ed9f0cfa5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ cache: - $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR} install: - - install_byond.sh + - ./install_byond.sh script: - - build_byond.sh + - ./build_byond.sh From 010c9794bbe4b63bcb4c6c0aa8169f08b8c6191c Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 11:22:09 -0400 Subject: [PATCH 06/25] Remove unecessary comment --- build_byond.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build_byond.sh b/build_byond.sh index 392ff04378..a5836f94b8 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -1,6 +1,5 @@ #!/bin/bash -#nb: must be bash to support shopt globstar set -e source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup if hash DreamMaker 2>/dev/null From 105db3063414f7f9e3fed504bbf60489860bf147 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 11:24:25 -0400 Subject: [PATCH 07/25] Turn off caching until this works --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3ed9f0cfa5..ba9d5ab8d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,6 @@ env: global: - BYOND_MAJOR="511" - BYOND_MINOR="1385" - -cache: - directories: - - $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR} install: - ./install_byond.sh From 05f74cac52ea7dabece17fc3de6a626d52214b9b Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 11:35:28 -0400 Subject: [PATCH 08/25] Specify the dme to use --- .travis.yml | 1 + build_byond.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ba9d5ab8d4..030658fb77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ env: global: - BYOND_MAJOR="511" - BYOND_MINOR="1385" + - DMEName="DMAPITravisTester.dme" install: - ./install_byond.sh diff --git a/build_byond.sh b/build_byond.sh index a5836f94b8..bee6ef072c 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -4,7 +4,7 @@ set -e source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup if hash DreamMaker 2>/dev/null then - DreamMaker $dmepath.mdme 2>&1 | tee result.log + DreamMaker $DMEName 2>&1 | tee result.log retval=$? if ! grep '\- 0 errors, 0 warnings' result.log then From 8f2d19db1ac9b7a2b773b21e7ee3f7fac4dda072 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 11:44:27 -0400 Subject: [PATCH 09/25] Use before_script instead of install --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 030658fb77..778cca6553 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ env: - BYOND_MINOR="1385" - DMEName="DMAPITravisTester.dme" -install: +before_script: - ./install_byond.sh script: From c158420d7cd4a3dcfed2fc4f0577b09a29eef6b6 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 11:48:14 -0400 Subject: [PATCH 10/25] Can you at least souce successfully? --- .travis.yml | 6 +++++- build_byond.sh | 13 ------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 778cca6553..c2c726f4c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,11 @@ env: - BYOND_MINOR="1385" - DMEName="DMAPITravisTester.dme" -before_script: +cache: + directories: + - $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR} + +install: - ./install_byond.sh script: diff --git a/build_byond.sh b/build_byond.sh index bee6ef072c..a5f737ff86 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -2,16 +2,3 @@ set -e source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup -if hash DreamMaker 2>/dev/null -then - DreamMaker $DMEName 2>&1 | tee result.log - retval=$? - if ! grep '\- 0 errors, 0 warnings' result.log - then - retval=1 #hard fail, due to warnings or errors - fi -else - echo "Couldn't find the DreamMaker executable, aborting." - retval=2 -fi -exit $retval \ No newline at end of file From a6060203b92bf597ff625cc63254113a46a59268 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 11:54:58 -0400 Subject: [PATCH 11/25] Travis debugging --- build_byond.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build_byond.sh b/build_byond.sh index a5f737ff86..c2b5df11b3 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -1,4 +1,21 @@ #!/bin/bash set -e +retval=1 source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup + +ls $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin + +if hash DreamMaker 2>/dev/null +then + DreamMaker $DMEName 2>&1 | tee result.log + retval=$? + if ! grep '\- 0 errors, 0 warnings' result.log + then + retval=1 #hard fail, due to warnings or errors + fi +else + echo "Couldn't find the DreamMaker executable, aborting." + retval=2 +fi +exit $retval \ No newline at end of file From 7408f215ce263c95c169e1f69d51970ed1d27b60 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:07:15 -0400 Subject: [PATCH 12/25] More debugging --- build_byond.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_byond.sh b/build_byond.sh index c2b5df11b3..76c9f8f569 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -4,7 +4,7 @@ set -e retval=1 source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup -ls $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin +ls -l $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin if hash DreamMaker 2>/dev/null then From 0be5db47f6f314b0c76cd27cf5362cab8c1b4dbd Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:09:21 -0400 Subject: [PATCH 13/25] Fix readme wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 259d5eedec..cbe383f14c 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ You can clear all active test merges using `Reset to Origin Branch` in the `Repo ## LICENSING -* The DM API for TGS3 is licensed under the MIT license. +* The DM API for the project is licensed under the MIT license. * The /tg/station 13 icon is licensed under [Creative Commons 3.0 BY-SA](http://creativecommons.org/licenses/by-sa/3.0/). * The remainder of the project is licensed under [GNU AGPL v3](http://www.gnu.org/licenses/agpl-3.0.html) From e809d78a5856eceab8d0fb2b2605b66097319bc0 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:11:07 -0400 Subject: [PATCH 14/25] More debugging --- build_byond.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_byond.sh b/build_byond.sh index 76c9f8f569..5733d4cff8 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -4,7 +4,7 @@ set -e retval=1 source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup -ls -l $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin +which DreamMaker if hash DreamMaker 2>/dev/null then From fcb078330961cf025d2ed026fdc007194205a699 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:14:47 -0400 Subject: [PATCH 15/25] Kill the cache again --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c2c726f4c1..030658fb77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,6 @@ env: - BYOND_MINOR="1385" - DMEName="DMAPITravisTester.dme" -cache: - directories: - - $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR} - install: - ./install_byond.sh From 117f08b794fde2c54900d2b9d22e3c78a83912b3 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:16:38 -0400 Subject: [PATCH 16/25] Get off the meme distro --- .travis.yml | 5 +++++ build_byond.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 030658fb77..8bee3495b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: generic sudo: false +dist: precise env: global: @@ -7,6 +8,10 @@ env: - BYOND_MINOR="1385" - DMEName="DMAPITravisTester.dme" +cache: + directories: + - $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR} + install: - ./install_byond.sh diff --git a/build_byond.sh b/build_byond.sh index 5733d4cff8..dc3edb3d22 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -4,7 +4,7 @@ set -e retval=1 source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup -which DreamMaker +file DreamMaker if hash DreamMaker 2>/dev/null then From 0d71c6489105817b428e6cc1b4e8c64034da1bea Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:22:16 -0400 Subject: [PATCH 17/25] What dark gods must I pray to for this to work? --- build_byond.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build_byond.sh b/build_byond.sh index dc3edb3d22..4b107a9d28 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -4,11 +4,12 @@ set -e retval=1 source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup -file DreamMaker +ls $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin +file $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker -if hash DreamMaker 2>/dev/null +if hash $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker 2>/dev/null then - DreamMaker $DMEName 2>&1 | tee result.log + $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker $DMEName 2>&1 | tee result.log retval=$? if ! grep '\- 0 errors, 0 warnings' result.log then From 2220a7cddda2027045e48b85f7f994aeb68a862a Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:27:52 -0400 Subject: [PATCH 18/25] Gonna be a madlad for a second --- build_byond.sh | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/build_byond.sh b/build_byond.sh index 4b107a9d28..64ef163fee 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -4,19 +4,11 @@ set -e retval=1 source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup -ls $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin -file $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker - -if hash $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker 2>/dev/null +DreamMaker $DMEName 2>&1 | tee result.log +retval=$? +if ! grep '\- 0 errors, 0 warnings' result.log then - $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker $DMEName 2>&1 | tee result.log - retval=$? - if ! grep '\- 0 errors, 0 warnings' result.log - then - retval=1 #hard fail, due to warnings or errors - fi -else - echo "Couldn't find the DreamMaker executable, aborting." - retval=2 + retval=1 #hard fail, due to warnings or errors fi + exit $retval \ No newline at end of file From fa681323132d0685518e0269f8e981ad3e6fced7 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:30:00 -0400 Subject: [PATCH 19/25] The dist wasnt the problem --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8bee3495b0..c2c726f4c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: generic sudo: false -dist: precise env: global: From 4a056cb37e8de390c24ee4d60c83bb157dd22975 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:31:29 -0400 Subject: [PATCH 20/25] Rapid fire commiting --- build_byond.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/build_byond.sh b/build_byond.sh index 64ef163fee..51233964b2 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -4,11 +4,20 @@ set -e retval=1 source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup -DreamMaker $DMEName 2>&1 | tee result.log -retval=$? -if ! grep '\- 0 errors, 0 warnings' result.log +env +file $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker +env +if hash $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker 2>/dev/null then - retval=1 #hard fail, due to warnings or errors + env + $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker $DMEName 2>&1 | tee result.log + retval=$? + if ! grep '\- 0 errors, 0 warnings' result.log + then + retval=1 #hard fail, due to warnings or errors + fi +else + echo "Couldn't find the DreamMaker executable, aborting." + retval=2 fi - exit $retval \ No newline at end of file From 249a792eda4f3f42ce2b86c4553de58e66613461 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:37:04 -0400 Subject: [PATCH 21/25] Throw on the libs from tgstation cause why not? --- .travis.yml | 7 +++++++ build_byond.sh | 8 ++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index c2c726f4c1..b2a5107e62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,13 @@ cache: directories: - $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR} +addons: + apt: + packages: + - libc6-i386 + - libgcc1:i386 + - libstdc++6:i386 + install: - ./install_byond.sh diff --git a/build_byond.sh b/build_byond.sh index 51233964b2..ac4473ad9a 100755 --- a/build_byond.sh +++ b/build_byond.sh @@ -4,13 +4,9 @@ set -e retval=1 source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup -env -file $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker -env -if hash $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker 2>/dev/null +if hash DreamMaker 2>/dev/null then - env - $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/DreamMaker $DMEName 2>&1 | tee result.log + DreamMaker $DMEName 2>&1 | tee result.log retval=$? if ! grep '\- 0 errors, 0 warnings' result.log then From 7f14d8a8af3301f893423d5f7e44a96277f955d1 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:39:40 -0400 Subject: [PATCH 22/25] See if we can get away with just one --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b2a5107e62..ea84445658 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,6 @@ addons: apt: packages: - libc6-i386 - - libgcc1:i386 - - libstdc++6:i386 install: - ./install_byond.sh From 0931e2200a2b05ca45d05c8016be5feb01d06b5e Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:41:55 -0400 Subject: [PATCH 23/25] Fix build errors --- DMAPI/server_tools.dm | 5 ++++- DMAPITravisTester.dm | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DMAPI/server_tools.dm b/DMAPI/server_tools.dm index 4c4c27583f..268a2d9164 100644 --- a/DMAPI/server_tools.dm +++ b/DMAPI/server_tools.dm @@ -1,6 +1,8 @@ // /tg/station 13 server tools API v3.1 //CONFIGURATION +//use this define if you want to do configuration outside of this file +#ifndef SERVER_TOOLS_EXTERNAL_CONFIGURATION //Comment this out once you've filled in the below #error /tg/station server tools interface unconfigured @@ -19,6 +21,7 @@ #define SERVER_TOOLS_LOG(message) //Notify current in-game administrators of a string `event` #define SERVER_TOOLS_NOTIFY_ADMINS(event) +#endif //Required hooks: @@ -39,7 +42,7 @@ //Gets the current version of the service running the server #define SERVER_TOOLS_VERSION ServiceVersion() //Forces a hard reboot of BYOND by ending the process -//unlike del(world) this will release any open .dll handles, purge all memory leaks, and clients will try to reconnect +//unlike del(world) clients will try to reconnect //If the service has not requested a shutdown, the world will reboot shortly after #define SERVER_TOOLS_REBOOT_BYOND world.ServiceEndProcess() /* diff --git a/DMAPITravisTester.dm b/DMAPITravisTester.dm index fa7df9f483..448fb5e0c9 100644 --- a/DMAPITravisTester.dm +++ b/DMAPITravisTester.dm @@ -1,4 +1,4 @@ -//Fill out a dummy API +#define SERVER_TOOLS_EXTERNAL_CONFIGURATION #define SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(Name, Value) var/##Name = ##Value #define SERVER_TOOLS_READ_GLOBAL(Name) global.##Name #define SERVER_TOOLS_WRITE_GLOBAL(Name, Value) global.##Name = ##Value From 0e3dc43f6dc35f7eabe7e5243bbebfb9da2c2971 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:43:29 -0400 Subject: [PATCH 24/25] Grab another C-lib --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ea84445658..4085bed57e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ addons: apt: packages: - libc6-i386 + - libstdc++6:i386 install: - ./install_byond.sh From f3f5540382e6073c8e5f677b2090e1bc77a37ba8 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 19 Sep 2017 12:47:51 -0400 Subject: [PATCH 25/25] More DM fixes --- .gitignore | 2 ++ Config.dm | 7 +++++++ DMAPI/server_tools.dm | 2 +- DMAPI/st_interface.dm | 6 +++--- DMAPITravisTester.dme | 3 ++- TGStationServer3.sln | 6 ++++++ DMAPITravisTester.dm => Test.dm | 11 ++++------- 7 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 Config.dm rename DMAPITravisTester.dm => Test.dm (67%) diff --git a/.gitignore b/.gitignore index 2daa302ddd..5dee86e7ae 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ packages/* *.user +*.dmb +*.int diff --git a/Config.dm b/Config.dm new file mode 100644 index 0000000000..6ea3f64cc3 --- /dev/null +++ b/Config.dm @@ -0,0 +1,7 @@ +#define SERVER_TOOLS_EXTERNAL_CONFIGURATION +#define SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(Name, Value) var/##Name = ##Value +#define SERVER_TOOLS_READ_GLOBAL(Name) global.##Name +#define SERVER_TOOLS_WRITE_GLOBAL(Name, Value) global.##Name = ##Value +#define SERVER_TOOLS_WORLD_ANNOUNCE(message) world << ##message +#define SERVER_TOOLS_LOG(message) world.log << ##message +#define SERVER_TOOLS_NOTIFY_ADMINS(event) message_admins(event) diff --git a/DMAPI/server_tools.dm b/DMAPI/server_tools.dm index 268a2d9164..6640ff13df 100644 --- a/DMAPI/server_tools.dm +++ b/DMAPI/server_tools.dm @@ -38,7 +38,7 @@ #define SERVER_TOOLS_API_VERSION ServiceAPIVersion() //Returns TRUE if the world was launched under the server tools and the API matches, FALSE otherwise //No function below this succeed if this is FALSE -#define SERVER_TOOLS_PRESENT (RunningService() != null) +#define SERVER_TOOLS_PRESENT RunningService() //Gets the current version of the service running the server #define SERVER_TOOLS_VERSION ServiceVersion() //Forces a hard reboot of BYOND by ending the process diff --git a/DMAPI/st_interface.dm b/DMAPI/st_interface.dm index 570798eead..b7bdda3364 100644 --- a/DMAPI/st_interface.dm +++ b/DMAPI/st_interface.dm @@ -11,11 +11,11 @@ SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(server_tools_api_compatible, FALSE) /world/proc/ServiceInit() if(!RunningService(TRUE)) return - ListCustomCommands() - ExportService("[SERVICE_REQUEST_API_VERSION] [SERVICE_API_VERSION]", TRUE) + ListServiceCustomCommands(TRUE) + ExportService("[SERVICE_REQUEST_API_VERSION] [SERVER_TOOLS_API_VERSION]", TRUE) /proc/RunningService(skip_compat_check = FALSE) - return (skip_compat_check || SERVER_TOOLS_READ_GLOBAL(server_tools_api_compatible)) && world.params[SERVICE_WORLD_PARAM] + return (skip_compat_check || SERVER_TOOLS_READ_GLOBAL(server_tools_api_compatible)) && world.params[SERVICE_WORLD_PARAM] != null /proc/ServiceVersion() if(RunningService(TRUE)) diff --git a/DMAPITravisTester.dme b/DMAPITravisTester.dme index 721607b654..e1f4f19dac 100644 --- a/DMAPITravisTester.dme +++ b/DMAPITravisTester.dme @@ -13,8 +13,9 @@ // END_PREFERENCES // BEGIN_INCLUDE -#include "DMAPITravisTester.dm" +#include "Config.dm" #include "DMAPI\server_tools.dm" #include "DMAPI\st_commands.dm" #include "DMAPI\st_interface.dm" +#include "Test.dm" // END_INCLUDE diff --git a/TGStationServer3.sln b/TGStationServer3.sln index 2e3f029c88..5d14e44608 100644 --- a/TGStationServer3.sln +++ b/TGStationServer3.sln @@ -16,8 +16,14 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2D8FC6AA-1D33-44B6-81C2-35ED7A87EDBC}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore + .travis.yml = .travis.yml appveyor.yml = appveyor.yml + build_byond.sh = build_byond.sh + Config.dm = Config.dm + DMAPITravisTester.dme = DMAPITravisTester.dme + install_byond.sh = install_byond.sh README.md = README.md + Test.dm = Test.dm tgs.ico = tgs.ico TGS3Release.ps1 = TGS3Release.ps1 Version.cs = Version.cs diff --git a/DMAPITravisTester.dm b/Test.dm similarity index 67% rename from DMAPITravisTester.dm rename to Test.dm index 448fb5e0c9..7df062b584 100644 --- a/DMAPITravisTester.dm +++ b/Test.dm @@ -1,10 +1,6 @@ -#define SERVER_TOOLS_EXTERNAL_CONFIGURATION -#define SERVER_TOOLS_DEFINE_AND_SET_GLOBAL(Name, Value) var/##Name = ##Value -#define SERVER_TOOLS_READ_GLOBAL(Name) global.##Name -#define SERVER_TOOLS_WRITE_GLOBAL(Name, Value) global.##Name = ##Value -#define SERVER_TOOLS_WORLD_ANNOUNCE(message) world << ##message -#define SERVER_TOOLS_LOG(message) world.log << ##message -#define SERVER_TOOLS_NOTIFY_ADMINS(event) message_admins(event) +#ifndef SERVER_TOOLS_ON_NEW +#error DreamMaker rearranges the intentionally weird file layout of this project. Compile using dm.exe instead +#endif /world/New() SERVER_TOOLS_ON_NEW @@ -27,6 +23,7 @@ sleep(50) if(!SERVER_TOOLS_PRESENT) world.log << "No running service detected" + del(world) return world.log << "Running service version: [SERVER_TOOLS_VERSION]" var/list/prs = SERVER_TOOLS_PR_LIST