Skip to content

Commit

Permalink
Another TGS DMAPI update (tgstation#40470)
Browse files Browse the repository at this point in the history
Wew it's almost like i'm testmerging these PRs to get it working
  • Loading branch information
Cyberboss authored and SpaceManiac committed Sep 26, 2018
1 parent a4970f5 commit 92e399f
Show file tree
Hide file tree
Showing 6 changed files with 353 additions and 358 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/tgs.config.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define TGS_EXTERNAL_CONFIGURATION
#define TGS_V3_API
#define TGS_DEFINE_AND_SET_GLOBAL(Name, Value) GLOBAL_VAR_INIT(##Name, ##Value); GLOBAL_PROTECT(##Name)
#define TGS_READ_GLOBAL(Name) GLOB.##Name
#define TGS_WRITE_GLOBAL(Name, Value) GLOB.##Name = ##Value
Expand Down
4 changes: 4 additions & 0 deletions code/__DEFINES/tgs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
//create this define if you want to do configuration outside of this file
#ifndef TGS_EXTERNAL_CONFIGURATION

//Uncomment this if you wish to allow the game to interact with TGS 3
//This will raise the minimum required security level of your game to TGS_SECURITY_TRUSTED due to it utilizing call()()
//#define TGS_V3_API

//Comment this out once you've filled in the below
#error TGS API unconfigured

Expand Down
10 changes: 9 additions & 1 deletion code/modules/tgs/core/core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
TGS_ERROR_LOG("TgsNew(): TGS API datum already set ([current_api])!")
return

#ifdef TGS_V3_API
minimum_required_security_level = TGS_SECURITY_TRUSTED
#endif

var/tgs_version = world.params[TGS_VERSION_PARAMETER]
if(!tgs_version)
return
Expand All @@ -18,7 +22,7 @@

TGS_WRITE_GLOBAL(tgs, new_api)

var/result = new_api.OnWorldNew(event_handler ? event_handler : new /datum/tgs_event_handler/tgs_default, minimum_required_security_level)
var/result = new_api.OnWorldNew(event_handler, minimum_required_security_level)
if(!result || result == TGS_UNIMPLEMENTED)
TGS_WRITE_GLOBAL(tgs, null)
TGS_ERROR_LOG("Failed to activate API!")
Expand All @@ -36,9 +40,13 @@

switch(super)
if(3)
#ifndef TGS_V3_API
TGS_ERROR_LOG("Detected V3 API but TGS_V3_API isn't defined!")
#else
switch(major)
if(2)
return /datum/tgs_api/v3210
#endif
if(4)
switch(major)
if(0)
Expand Down
30 changes: 0 additions & 30 deletions code/modules/tgs/core/default_event_handler.dm

This file was deleted.

3 changes: 2 additions & 1 deletion code/modules/tgs/includes.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "core\_definitions.dm"
#include "core\core.dm"
#include "core\datum.dm"
#include "core\default_event_handler.dm"
#ifdef TGS_V3_API
#include "v3210\api.dm"
#include "v3210\commands.dm"
#endif
#include "v4\api.dm"
#include "v4\commands.dm"
Loading

0 comments on commit 92e399f

Please sign in to comment.