Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Game Interface / AC Callbacks + support for T5ZM, T6MP and T6ZM for the Game Interface. #288

Merged
merged 12 commits into from May 29, 2023
Merged
Binary file not shown.
263 changes: 0 additions & 263 deletions GameFiles/AntiCheat/PT6/storage/t6/scripts/mp/_customcallbacks.gsc.src

This file was deleted.

11 changes: 6 additions & 5 deletions GameFiles/GameInterface/_integration_base.gsc
@@ -1,6 +1,4 @@
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;

Init()
{
Expand All @@ -22,6 +20,8 @@ Setup()
level.commonFunctions = spawnstruct();
level.commonFunctions.setDvar = "SetDvarIfUninitialized";
level.commonFunctions.isBot = "IsBot";
level.commonFunctions.getXuid = "GetXuid";
level.commonFunctions.GetPlayerFromClientNum = "GetPlayerFromClientNum";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use camelCase for functionName
level.commonFunctions.getPlayerFromClientNum


level.commonKeys = spawnstruct();

Expand Down Expand Up @@ -51,6 +51,7 @@ Setup()
level.clientCommandRusAsTarget = [];
level.logger = spawnstruct();
level.overrideMethods = [];
level.overrideMethods["GetPlayerFromClientNum"] = ::GetPlayerFromClientNum;

level.iw4madminIntegrationDebug = GetDvarInt( "sv_iw4madmin_integration_debug" );
InitializeLogger();
Expand Down Expand Up @@ -360,7 +361,7 @@ GenerateJoinTeamString( isSpectator )
}
}

guid = self GetXuid();
guid = self [[level.overrideMethods[level.commonFunctions.getXuid]]]();
Copy link
Owner

@RaidMax RaidMax Apr 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So after thinking about this, I think we should move the GenerateJoinTeamString into the _integration_shared.gsc
I added this in here before I created the shared functionality file.
Philosophically the _integration_base,gsc should really only be responsible for facilitating the game interface data transfer/notifications. No direct game interaction or action on game events.

That should put the above registration of the overrideMethods more in line with what's already done in the shared gsc


if ( guid == "0" )
{
Expand Down Expand Up @@ -565,8 +566,8 @@ NotifyClientEventTimeout( eventType )

NotifyClientEvent( eventInfo )
{
origin = getPlayerFromClientNum( int( eventInfo[3] ) );
target = getPlayerFromClientNum( int( eventInfo[4] ) );
origin = [[level.overrideMethods[level.commonFunctions.GetPlayerFromClientNum]]]( int( eventInfo[3] ) );
target = [[level.overrideMethods[level.commonFunctions.GetPlayerFromClientNum]]]( int( eventInfo[4] ) );

event = spawnstruct();
event.type = eventInfo[1];
Expand Down
9 changes: 7 additions & 2 deletions GameFiles/GameInterface/_integration_iw4x.gsc
Expand Up @@ -2,8 +2,6 @@

Init()
{
level.eventBus.gamename = "IW4";

thread Setup();
}

Expand All @@ -13,12 +11,14 @@ Setup()

// it's possible that the notify type has not been defined yet so we have to hard code it
level waittill( "IntegrationBootstrapInitialized" );
level.eventBus.gamename = "IW4";

scripts\_integration_base::RegisterLogger( ::Log2Console );

level.overrideMethods["GetTotalShotsFired"] = ::GetTotalShotsFired;
level.overrideMethods[level.commonFunctions.setDvar] = ::_SetDvarIfUninitialized;
level.overrideMethods[level.commonFunctions.isBot] = ::IsTestClient;
level.overrideMethods[level.commonFunctions.getXuid] = ::_GetXUID;
level.overrideMethods["waittill_notify_or_timeout"] = ::_waittill_notify_or_timeout;
level.overrideMethods[level.commonFunctions.changeTeam] = ::ChangeTeam;
level.overrideMethods[level.commonFunctions.getTeamCounts] = ::CountPlayers;
Expand Down Expand Up @@ -199,6 +199,11 @@ Log2Console( logLevel, message )
PrintConsole( "[" + logLevel + "] " + message + "\n" );
}

_GetXUID()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this is wrong. See how ISTestClient function is called in the same file.
You need to use the call keyword.

{
return self GetXUID();
}

//////////////////////////////////
// GUID helpers
/////////////////////////////////
Expand Down