fix indentation on shared integration
This commit is contained in:
parent
c06b0982a7
commit
9cf91d030d
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
Init()
|
Init()
|
||||||
{
|
{
|
||||||
level thread Setup();
|
level thread Setup();
|
||||||
@ -14,7 +15,7 @@ Setup()
|
|||||||
level.commonFunctions.getClientTeam = "GetClientTeam";
|
level.commonFunctions.getClientTeam = "GetClientTeam";
|
||||||
level.commonFunctions.getClientKillStreak = "GetClientKillStreak";
|
level.commonFunctions.getClientKillStreak = "GetClientKillStreak";
|
||||||
level.commonFunctions.backupRestoreClientKillStreakData = "BackupRestoreClientKillStreakData";
|
level.commonFunctions.backupRestoreClientKillStreakData = "BackupRestoreClientKillStreakData";
|
||||||
level.commonFunctions.waitTillAnyTimeout = "WaitTillAnyTimeout";
|
level.commonFunctions.waitTillAnyTimeout = "WaitTillAnyTimeout";
|
||||||
|
|
||||||
level.overrideMethods[level.commonFunctions.changeTeam] = scripts\_integration_base::NotImplementedFunction;
|
level.overrideMethods[level.commonFunctions.changeTeam] = scripts\_integration_base::NotImplementedFunction;
|
||||||
level.overrideMethods[level.commonFunctions.getTeamCounts] = scripts\_integration_base::NotImplementedFunction;
|
level.overrideMethods[level.commonFunctions.getTeamCounts] = scripts\_integration_base::NotImplementedFunction;
|
||||||
@ -23,7 +24,7 @@ Setup()
|
|||||||
level.overrideMethods[level.commonFunctions.getClientTeam] = scripts\_integration_base::NotImplementedFunction;
|
level.overrideMethods[level.commonFunctions.getClientTeam] = scripts\_integration_base::NotImplementedFunction;
|
||||||
level.overrideMethods[level.commonFunctions.getClientKillStreak] = scripts\_integration_base::NotImplementedFunction;
|
level.overrideMethods[level.commonFunctions.getClientKillStreak] = scripts\_integration_base::NotImplementedFunction;
|
||||||
level.overrideMethods[level.commonFunctions.backupRestoreClientKillStreakData] = scripts\_integration_base::NotImplementedFunction;
|
level.overrideMethods[level.commonFunctions.backupRestoreClientKillStreakData] = scripts\_integration_base::NotImplementedFunction;
|
||||||
level.overrideMethods[level.commonFunctions.waitTillAnyTimeout] = scripts\_integration_base::NotImplementedFunction;
|
level.overrideMethods[level.commonFunctions.waitTillAnyTimeout] = scripts\_integration_base::NotImplementedFunction;
|
||||||
|
|
||||||
// these can be overridden per game if needed
|
// these can be overridden per game if needed
|
||||||
level.commonKeys.team1 = "allies";
|
level.commonKeys.team1 = "allies";
|
||||||
@ -33,7 +34,7 @@ Setup()
|
|||||||
level.eventTypes.connect = "connected";
|
level.eventTypes.connect = "connected";
|
||||||
level.eventTypes.disconnect = "disconnect";
|
level.eventTypes.disconnect = "disconnect";
|
||||||
level.eventTypes.joinTeam = "joined_team";
|
level.eventTypes.joinTeam = "joined_team";
|
||||||
level.eventTypes.spawned = "spawned_player";
|
level.eventTypes.spawned = "spawned_player";
|
||||||
level.eventTypes.gameEnd = "game_ended";
|
level.eventTypes.gameEnd = "game_ended";
|
||||||
|
|
||||||
level.iw4madminIntegrationDefaultPerformance = 200;
|
level.iw4madminIntegrationDefaultPerformance = 200;
|
||||||
@ -43,7 +44,7 @@ Setup()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetDvarInt( "sv_iw4madmin_autobalance" ) != 1 )
|
if ( GetDvarInt( "sv_iw4madmin_autobalance" ) != 1 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -67,7 +68,7 @@ OnPlayerConnect()
|
|||||||
teamToJoin = player GetTeamToJoin();
|
teamToJoin = player GetTeamToJoin();
|
||||||
player [[level.overrideMethods[level.commonFunctions.changeTeam]]]( teamToJoin );
|
player [[level.overrideMethods[level.commonFunctions.changeTeam]]]( teamToJoin );
|
||||||
|
|
||||||
player thread OnClientFirstSpawn();
|
player thread OnClientFirstSpawn();
|
||||||
player thread OnClientJoinedTeam();
|
player thread OnClientJoinedTeam();
|
||||||
player thread OnClientDisconnect();
|
player thread OnClientDisconnect();
|
||||||
player thread WaitForClientEvents();
|
player thread WaitForClientEvents();
|
||||||
@ -84,18 +85,18 @@ OnClientDisconnect()
|
|||||||
self waittill( level.eventTypes.disconnect );
|
self waittill( level.eventTypes.disconnect );
|
||||||
scripts\_integration_base::LogDebug( "client is disconnecting" );
|
scripts\_integration_base::LogDebug( "client is disconnecting" );
|
||||||
|
|
||||||
OnTeamSizeChanged();
|
OnTeamSizeChanged();
|
||||||
self notify( "disconnect_logic_end" );
|
self notify( "disconnect_logic_end" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OnClientJoinedTeam()
|
OnClientJoinedTeam()
|
||||||
{
|
{
|
||||||
self endon( level.eventTypes.disconnect );
|
self endon( level.eventTypes.disconnect );
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
self waittill( level.eventTypes.joinTeam );
|
self waittill( level.eventTypes.joinTeam );
|
||||||
|
|
||||||
if ( IsDefined( self.wasAutoBalanced ) && self.wasAutoBalanced )
|
if ( IsDefined( self.wasAutoBalanced ) && self.wasAutoBalanced )
|
||||||
{
|
{
|
||||||
@ -103,12 +104,12 @@ OnClientJoinedTeam()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
newTeam = self [[level.overrideMethods[level.commonFunctions.getClientTeam]]]();
|
newTeam = self [[level.overrideMethods[level.commonFunctions.getClientTeam]]]();
|
||||||
scripts\_integration_base::LogDebug( self.name + " switched to " + newTeam );
|
scripts\_integration_base::LogDebug( self.name + " switched to " + newTeam );
|
||||||
|
|
||||||
if ( newTeam != level.commonKeys.team1 && newTeam != level.commonKeys.team2 )
|
if ( newTeam != level.commonKeys.team1 && newTeam != level.commonKeys.team2 )
|
||||||
{
|
{
|
||||||
OnTeamSizeChanged();
|
OnTeamSizeChanged();
|
||||||
scripts\_integration_base::LogDebug( "not force balancing " + self.name + " because they switched to spec" );
|
scripts\_integration_base::LogDebug( "not force balancing " + self.name + " because they switched to spec" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -121,13 +122,13 @@ OnClientJoinedTeam()
|
|||||||
wait ( 0.1 );
|
wait ( 0.1 );
|
||||||
self [[level.overrideMethods[level.commonFunctions.backupRestoreClientKillStreakData]]]( true );
|
self [[level.overrideMethods[level.commonFunctions.backupRestoreClientKillStreakData]]]( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OnClientFirstSpawn()
|
OnClientFirstSpawn()
|
||||||
{
|
{
|
||||||
self endon( level.eventTypes.disconnect );
|
self endon( level.eventTypes.disconnect );
|
||||||
timeoutResult = self [[level.overrideMethods[level.commonFunctions.waitTillAnyTimeout]]]( 30, level.eventTypes.spawned );
|
timeoutResult = self [[level.overrideMethods[level.commonFunctions.waitTillAnyTimeout]]]( 30, level.eventTypes.spawned );
|
||||||
|
|
||||||
if ( timeoutResult != "timeout" )
|
if ( timeoutResult != "timeout" )
|
||||||
{
|
{
|
||||||
@ -140,17 +141,17 @@ OnClientFirstSpawn()
|
|||||||
|
|
||||||
OnTeamSizeChanged()
|
OnTeamSizeChanged()
|
||||||
{
|
{
|
||||||
if ( level.players.size < 3 )
|
if ( level.players.size < 3 )
|
||||||
{
|
{
|
||||||
scripts\_integration_base::LogDebug( "not enough clients to autobalance" );
|
scripts\_integration_base::LogDebug( "not enough clients to autobalance" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !IsDefined( GetSmallerTeam( 1 ) ) )
|
if ( !IsDefined( GetSmallerTeam( 1 ) ) )
|
||||||
{
|
{
|
||||||
scripts\_integration_base::LogDebug( "teams are not unbalanced enough to auto balance" );
|
scripts\_integration_base::LogDebug( "teams are not unbalanced enough to auto balance" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
toSwap = FindClientToSwap();
|
toSwap = FindClientToSwap();
|
||||||
curentTeam = toSwap [[level.overrideMethods[level.commonFunctions.getClientTeam]]]();
|
curentTeam = toSwap [[level.overrideMethods[level.commonFunctions.getClientTeam]]]();
|
||||||
|
Loading…
Reference in New Issue
Block a user