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) function CheckAntiPack(%game)
{ {
//CTF only //CTF only
if( $Host::AntiPackEnable ) if($Host::AntiPackEnable && $CurrentMissionType $= "DM" || $CurrentMissionType $= "CTF")
{ {
//echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount); //echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount);
//echo("AntiPackPlayerCount " @ $AntiPackPlayerCount); //echo("AntiPackPlayerCount " @ $Host::AntiPackPlayerCount);
if($TotalTeamPlayerCount < $Host::AntiPackPlayerCount) if($TotalTeamPlayerCount < $Host::AntiPackPlayerCount)
{ {

View file

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