Cleaned up

This commit is contained in:
ChocoTaco1 2022-07-09 17:38:47 -04:00
parent 297053afdc
commit 164bdd3dcc
2 changed files with 75 additions and 80 deletions

View file

@ -18,10 +18,10 @@ $AntiPackIncludeShield = 0;
function CheckAntiPack(%game)
{
//CTF only
if( $Host::AntiPackEnable )
if($Host::AntiPackEnable && $CurrentMissionType $= "DM" || $CurrentMissionType $= "CTF")
{
//echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount);
//echo("AntiPackPlayerCount " @ $AntiPackPlayerCount);
//echo("AntiPackPlayerCount " @ $Host::AntiPackPlayerCount);
if($TotalTeamPlayerCount < $Host::AntiPackPlayerCount)
{

View file

@ -37,9 +37,8 @@ if (!isActivePackage(StartTeamCounts))
function GetTeamCounts(%game)
{
switch$($GetCountsStatus)
if($GetCountsStatus)
{
case UPDATE:
if($countdownStarted && $MatchStarted)
{
//Variables
@ -55,22 +54,19 @@ function GetTeamCounts(%game)
if(!$Host::TournamentMode)
{
if($CurrentMissionType $= "CTF")
{
NBRStatusNotify(%game);
CheckAntiPack(%game);
}
else if($CurrentMissionType $= "DM")
CheckAntiPack(%game);
if($CurrentMissionType $= "CTF") //No SCtF
NBRStatusNotify(%game); //Base Rape
TeamBalanceNotify(%game); //Has check for # teams
if($CurrentMissionType $= "CTF" || $CurrentMissionType $= "DM")
CheckAntiPack(%game); //Limit certain packs with low numbers
if(Game.numTeams > 1)
TeamBalanceNotify(%game); //Team Balance
}
//Set so counter wont run when it doesnt need to.
$GetCountsStatus = "IDLE";
$GetCountsStatus = 0;
}
case IDLE:
//Do Nothing
}
if(isEventPending($GetCountsSchedule))
@ -81,12 +77,6 @@ function GetTeamCounts(%game)
}
// Triggers a Full run
function ResetGetCountsStatus()
{
$GetCountsStatus = "UPDATE";
}
// Proper Overrides
// Events that determine a TeamGetCounts update
package TeamCountsTriggers
@ -97,7 +87,7 @@ function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn )
Parent::clientJoinTeam( %game, %client, %team, %respawn );
//Trigger GetCounts
ResetGetCountsStatus();
$GetCountsStatus = 1;
}
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned)
@ -105,7 +95,7 @@ function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawn
Parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned);
//Trigger GetCounts
ResetGetCountsStatus();
$GetCountsStatus = 1;
}
function DefaultGame::assignClientTeam(%game, %client, %respawn )
@ -113,7 +103,7 @@ function DefaultGame::assignClientTeam(%game, %client, %respawn )
Parent::assignClientTeam(%game, %client, %respawn );
//Trigger GetCounts
ResetGetCountsStatus();
$GetCountsStatus = 1;
}
function DefaultGame::onClientEnterObserverMode( %game, %client )
@ -121,7 +111,7 @@ function DefaultGame::onClientEnterObserverMode( %game, %client )
Parent::onClientEnterObserverMode( %game, %client );
//Trigger GetCounts
ResetGetCountsStatus();
$GetCountsStatus = 1;
}
function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
@ -129,7 +119,7 @@ function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
Parent::AIChangeTeam(%game, %client, %newTeam);
//Trigger GetCounts
ResetGetCountsStatus();
$GetCountsStatus = 1;
}
function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch)
@ -137,7 +127,7 @@ function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %
Parent::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch);
//Reset GetCounts
ResetGetCountsStatus();
$GetCountsStatus = 1;
}
function DefaultGame::gameOver(%game)
@ -145,7 +135,7 @@ function DefaultGame::gameOver(%game)
Parent::gameOver(%game);
//Reset GetCounts
ResetGetCountsStatus();
$GetCountsStatus = 1;
}
function GameConnection::onDrop(%client, %reason)
@ -153,11 +143,18 @@ function GameConnection::onDrop(%client, %reason)
Parent::onDrop(%client, %reason);
//Reset GetCounts
ResetGetCountsStatus();
$GetCountsStatus = 1;
}
};
//Reset GetCounts thru function
function ResetGetCountsStatus()
{
//Reset GetCounts
$GetCountsStatus = 1;
}
// Team Balance Notify Script
//
@ -178,10 +175,9 @@ function TeamBalanceNotify(%game)
if(!$Host::EnableTeamBalanceNotify && !$Host::EnableAutobalance)
return;
if( Game.numTeams > 1 && $TotalTeamPlayerCount !$= 0 )
if($TotalTeamPlayerCount !$= 0)
{
//Uneven
if($TeamRank[1, count] !$= $TeamRank[2, count])
if($TeamRank[1, count] !$= $TeamRank[2, count]) //Uneven
{
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
@ -198,8 +194,7 @@ function TeamBalanceNotify(%game)
//Man down. 6vs7, 4vs3 etc
$TBNStatus = "UNEVEN";
}
//Teams are even
else if($TeamRank[1, count] == $TeamRank[2, count] && $TBNStatus !$= "PLAYEDEVEN" )
else if($TeamRank[1, count] == $TeamRank[2, count] && $TBNStatus !$= "PLAYEDEVEN") //Teams are even
$TBNStatus = "EVEN";
switch$($TBNStatus)