mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-04-21 11:35:20 +00:00
AutoBalance/TeamBalance notify update
This commit is contained in:
parent
f3934b28c7
commit
a515a0d900
3 changed files with 207 additions and 171 deletions
|
|
@ -1,14 +1,18 @@
|
|||
// GetCounts was made to accurately keep track of how many players
|
||||
// are on teams, on the server, on each team, spectator, etc.
|
||||
// It runs every 5 seconds.
|
||||
// It has since evolved into the place to inject other services
|
||||
// and aspects within the server.
|
||||
//
|
||||
// GetTeamCounts Script
|
||||
//
|
||||
// GetTeamCounts was made to accurately keep track of how many players
|
||||
// are on teams, on the server, on each team, observer, etc.
|
||||
// AntiTurrets, Team Balance Notify, AntiCloak, AutoBalance, Base Rape and Base Rape Notify all rely on this.
|
||||
// It runs every 5 seconds.
|
||||
//
|
||||
// Whether or not a portion of the script is run or not depends on
|
||||
// if a player has switched teams or not. Or if a team changing event has occurred.
|
||||
// This is triggered via various event functions throughout the game.
|
||||
// All included in EvoClassicTaco.vl2
|
||||
|
||||
// Set reset string
|
||||
$GetCountsClientTeamChange = true;
|
||||
|
||||
|
||||
package StartTeamCounts
|
||||
{
|
||||
|
||||
|
|
@ -35,28 +39,15 @@ function GetTeamCounts( %game, %client, %respawn )
|
|||
$PlayerCount[1] = 0;
|
||||
$PlayerCount[2] = 0;
|
||||
|
||||
//For autobalance
|
||||
%lastclient1 = "";
|
||||
%lastclient2 = "";
|
||||
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
|
||||
//Pick a client for autobalance
|
||||
%team = %client.team;
|
||||
if(%client.score < %lastclient[%team].score || %lastclient[%team] $= "") {
|
||||
%teamcanidate[%team] = %client;
|
||||
}
|
||||
%lastclient[%team] = %client;
|
||||
|
||||
//if(!%client.isAIControlled())
|
||||
$PlayerCount[%client.team]++;
|
||||
}
|
||||
|
||||
$team1canidate = %teamcanidate1;
|
||||
$team2canidate = %teamcanidate2;
|
||||
|
||||
//echo ("$PlayerCount[0] " @ $PlayerCount[0]);
|
||||
//echo ("$PlayerCount[1] " @ $PlayerCount[1]);
|
||||
//echo ("$PlayerCount[2] " @ $PlayerCount[2]);
|
||||
|
|
@ -66,13 +57,13 @@ function GetTeamCounts( %game, %client, %respawn )
|
|||
//Amount of all players including observers
|
||||
$AllPlayerCount = $PlayerCount[1] + $PlayerCount[2] + $PlayerCount[0];
|
||||
//Difference Variables
|
||||
$Team1Difference = $PlayerCount[1] - $PlayerCount[2];
|
||||
$Team2Difference = $PlayerCount[2] - $PlayerCount[1];
|
||||
%team1difference = $PlayerCount[1] - $PlayerCount[2];
|
||||
%team2difference = $PlayerCount[2] - $PlayerCount[1];
|
||||
|
||||
//Start Base Rape Notify
|
||||
schedule(500, 0, "NBRStatusNotify", %game);
|
||||
//Start Team Balance Notify
|
||||
schedule(1000, 0, "TeamBalanceNotify", %game );
|
||||
schedule(1000, 0, "TeamBalanceNotify", %game, %team1difference, %team2difference);
|
||||
//Start AntiCloak
|
||||
schedule(1500, 0, "ActivateAntiCloak", %game);
|
||||
//Start MapRepetitionChecker
|
||||
|
|
@ -87,13 +78,10 @@ function GetTeamCounts( %game, %client, %respawn )
|
|||
schedule(5000, 0, "GetTeamCounts");
|
||||
}
|
||||
|
||||
//Run at DefaultGame::clientJoinTeam, DefaultGame::clientChangeTeam, DefaultGame::assignClientTeam in evo defaultgame.ovl
|
||||
//Also Run at DefaultGame::onClientEnterObserverMode, DefaultGame::AIChangeTeam, DefaultGame::onClientLeaveGame, DefaultGame::forceObserver in evo defaultgame.ovl
|
||||
//And finally GameConnection::onConnect in evo server.ovl
|
||||
//Added so the bulk of GetCounts doesnt run when it doesnt need to causing unnecessary latency that may or may not have existed, but probably is good practice.
|
||||
//GetCounts still runs every 5 seconds as it did, but whether or not someone has changed teams, joined obs, left, etc etc will decide whether or not the bulk of it runs.
|
||||
|
||||
//Let GetTeamCounts run if there is a Teamchange.
|
||||
// Run at DefaultGame::clientJoinTeam, DefaultGame::clientChangeTeam, DefaultGame::assignClientTeam in evo defaultgame.ovl
|
||||
// Also Run at DefaultGame::onClientEnterObserverMode, DefaultGame::AIChangeTeam, DefaultGame::onClientLeaveGame, DefaultGame::forceObserver in evo defaultgame.ovl
|
||||
// And finally GameConnection::onConnect in evo server.ovl
|
||||
function ResetClientChangedTeams()
|
||||
{
|
||||
$GetCountsClientTeamChange = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue