mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-07-15 08:04:39 +00:00
Update Autobalance.cs
This commit is contained in:
parent
7f17432071
commit
1daa583f41
1 changed files with 6 additions and 44 deletions
|
|
@ -7,11 +7,6 @@
|
||||||
// $Host::EnableAutobalance = 1;
|
// $Host::EnableAutobalance = 1;
|
||||||
//
|
//
|
||||||
|
|
||||||
// How far behind littleTeam must be to use All Mode.
|
|
||||||
// Meaning picking from a pool of all players on the bigTeam instead of just the lowest scoring player.
|
|
||||||
// 400 equals 400 points. 4 caps behind.
|
|
||||||
$AllModeThreshold = 400;
|
|
||||||
|
|
||||||
|
|
||||||
// Run from TeamBalanceNotify.cs via UnbalancedSound( %game )
|
// Run from TeamBalanceNotify.cs via UnbalancedSound( %game )
|
||||||
function Autobalance( %game, %AutobalanceSafetynetTrys )
|
function Autobalance( %game, %AutobalanceSafetynetTrys )
|
||||||
|
|
@ -33,6 +28,12 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
|
||||||
{
|
{
|
||||||
%client = ClientGroup.getObject(%i);
|
%client = ClientGroup.getObject(%i);
|
||||||
|
|
||||||
|
//Pick a client for autobalance
|
||||||
|
//Try to pick a low scoring player
|
||||||
|
%team = %client.team;
|
||||||
|
if(%client.score < %lastclient[%team].score || %lastclient[%team] $= "")
|
||||||
|
%teamcanidate[%team] = %client;
|
||||||
|
|
||||||
%lastclient[%team] = %client;
|
%lastclient[%team] = %client;
|
||||||
|
|
||||||
//if(!%client.isAIControlled())
|
//if(!%client.isAIControlled())
|
||||||
|
|
@ -55,44 +56,6 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
|
||||||
else if( %team2difference >= 2 )
|
else if( %team2difference >= 2 )
|
||||||
%bigTeam = 2;
|
%bigTeam = 2;
|
||||||
|
|
||||||
%littleTeam = ( %bigTeam == 1 ) ? 2 : 1;
|
|
||||||
|
|
||||||
//Toggle for All Mode
|
|
||||||
//If a team is behind pick anyone, not just a low scoring player
|
|
||||||
if( $TeamScore[%bigTeam] > ($TeamScore[%littleTeam] + $AllModeThreshold) )
|
|
||||||
%UseAllMode = 1;
|
|
||||||
|
|
||||||
//Pick a client for autobalance
|
|
||||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
|
||||||
{
|
|
||||||
%client = ClientGroup.getObject(%i);
|
|
||||||
|
|
||||||
if(%UseAllMode)
|
|
||||||
{
|
|
||||||
//Try to pick any player
|
|
||||||
%team = %client.team;
|
|
||||||
%autobalanceRandom = getRandom(1,($PlayerCount[%bigTeam] - 1));
|
|
||||||
if(%autobalanceRandom == %autobalanceLoop || %lastclient[%team] $= "")
|
|
||||||
%teamcanidate[%team] = %client;
|
|
||||||
|
|
||||||
%autobalanceLoop++;
|
|
||||||
|
|
||||||
//echo("All Mode");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Normal circumstances
|
|
||||||
//Try to pick a low scoring player
|
|
||||||
%team = %client.team;
|
|
||||||
if(%client.score < %lastclient[%team].score || %lastclient[%team] $= "")
|
|
||||||
%teamcanidate[%team] = %client;
|
|
||||||
|
|
||||||
//echo("Low Mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
%lastclient[%team] = %client;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Debug
|
//Debug
|
||||||
if( %AutobalanceDebug )
|
if( %AutobalanceDebug )
|
||||||
AutobalanceDebug(%teamcanidate1, %teamcanidate2, %team1difference, %team2difference, %bigTeam, %AutobalanceSafetynetTrys);
|
AutobalanceDebug(%teamcanidate1, %teamcanidate2, %team1difference, %team2difference, %bigTeam, %AutobalanceSafetynetTrys);
|
||||||
|
|
@ -110,7 +73,6 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
|
||||||
else
|
else
|
||||||
messageAll('MsgTeamBalanceNotify', '\c0Autobalance error: Team %1 mismatch.', %bigTeam );
|
messageAll('MsgTeamBalanceNotify', '\c0Autobalance error: Team %1 mismatch.', %bigTeam );
|
||||||
|
|
||||||
|
|
||||||
//Trigger GetCounts
|
//Trigger GetCounts
|
||||||
ResetClientChangedTeams();
|
ResetClientChangedTeams();
|
||||||
//Reset Unbalanced
|
//Reset Unbalanced
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue