mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-03-06 21:20:22 +00:00
Server Core Rework
More use of Switch cases and Scheduling tracking
This commit is contained in:
parent
c95483c322
commit
4a7325a74d
5 changed files with 187 additions and 178 deletions
|
|
@ -13,51 +13,47 @@
|
|||
function CheckAntiCloak( %game )
|
||||
{
|
||||
//CTF only
|
||||
if( $Host::AntiCloakEnable && $CurrentMissionType $= "CTF" )
|
||||
if( $Host::AntiCloakEnable && $CurrentMissionType $= "CTF" && !$Host::TournamentMode )
|
||||
{
|
||||
//echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount);
|
||||
//echo("AntiCloakPlayerCount " @ $AntiCloakPlayerCount);
|
||||
|
||||
//If server is in Tourny mode and the team population is lower than the AntiCloakPlayerCount cloak is not selectable.
|
||||
if( !$Host::TournamentMode && $TotalTeamPlayerCount < $Host::AntiCloakPlayerCount )
|
||||
if( $TotalTeamPlayerCount < $Host::AntiCloakPlayerCount )
|
||||
{
|
||||
if( $AntiCloakRunOnce !$= 0 )
|
||||
{
|
||||
$InvBanList[CTF, "CloakingPack"] = 1;
|
||||
|
||||
if(!isActivePackage(DisableCloakPack))
|
||||
activatePackage(DisableCloakPack);
|
||||
|
||||
$AntiCloakRunOnce = 0;
|
||||
}
|
||||
if( $AntiCloakStatus !$= "ACTIVEON" )
|
||||
$AntiCloakStatus = "ON";
|
||||
}
|
||||
//Off
|
||||
else
|
||||
{
|
||||
if( $AntiCloakRunOnce !$= 1 )
|
||||
{
|
||||
$InvBanList[CTF, "CloakingPack"] = 0;
|
||||
|
||||
if(isActivePackage(DisableCloakPack))
|
||||
deactivatePackage(DisableCloakPack);
|
||||
|
||||
$AntiCloakRunOnce = 1;
|
||||
}
|
||||
if( $AntiCloakStatus !$= "ACTIVEOFF" )
|
||||
$AntiCloakStatus = "OFF";
|
||||
}
|
||||
}
|
||||
//All other cases outside of CTF.
|
||||
//All other cases outside of CTF
|
||||
else
|
||||
{
|
||||
if( $AntiCloakRunOnce !$= 1 )
|
||||
{
|
||||
if( $AntiCloakStatus !$= "ACTIVEOFF" )
|
||||
$AntiCloakStatus = "OFF";
|
||||
}
|
||||
|
||||
switch$($AntiCloakStatus)
|
||||
{
|
||||
case ON:
|
||||
$InvBanList[CTF, "CloakingPack"] = 1;
|
||||
if(!isActivePackage(DisableCloakPack))
|
||||
activatePackage(DisableCloakPack);
|
||||
$AntiCloakStatus = "ACTIVEON";
|
||||
case OFF:
|
||||
$InvBanList[CTF, "CloakingPack"] = 0;
|
||||
|
||||
if(isActivePackage(DisableCloakPack))
|
||||
deactivatePackage(DisableCloakPack);
|
||||
|
||||
$AntiCloakRunOnce = 1;
|
||||
}
|
||||
}
|
||||
$AntiCloakStatus = "ACTIVEOFF";
|
||||
case ACTIVEON:
|
||||
//Do Nothing
|
||||
case ACTIVEOFF:
|
||||
//Do Nothing
|
||||
}
|
||||
}
|
||||
|
||||
// So if the player is able to get a cloakpack, he cant use it
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@ $AllModeThreshold = 400;
|
|||
// Run from TeamBalanceNotify.cs via UnbalancedSound( %game )
|
||||
function Autobalance( %game, %AutobalanceSafetynetTrys )
|
||||
{
|
||||
if(isEventPending($AutoBalanceSchedule))
|
||||
cancel($AutoBalanceSchedule);
|
||||
|
||||
if( $TBNStatus !$= "NOTIFY" ) //If Status has changed to EVEN or anything else (GameOver reset).
|
||||
return;
|
||||
|
||||
//Debug: Uncomment to enable
|
||||
//%AutobalanceDebug = true;
|
||||
|
||||
|
|
@ -43,7 +49,8 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
|
|||
//If even, stop.
|
||||
if( %team1difference == 1 || %team2difference == 1 || $PlayerCount[1] == $PlayerCount[2] )
|
||||
{
|
||||
$StatsMsgPlayed = 0;
|
||||
//Reset TBN
|
||||
ResetTBNStatus();
|
||||
return;
|
||||
}
|
||||
//Determine bigTeam
|
||||
|
|
@ -95,21 +102,14 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
|
|||
%team = %teamcanidate[%bigTeam].team;
|
||||
%otherTeam = ( %team == 1 ) ? 2 : 1;
|
||||
|
||||
if( %teamcanidate[%bigTeam].team $= %bigTeam )
|
||||
{
|
||||
// Fire Autobalance
|
||||
Game.clientChangeTeam( %client, %otherTeam, 0 );
|
||||
messageAll('MsgTeamBalanceNotify', '~wfx/powered/vehicle_screen_on.wav');
|
||||
}
|
||||
else
|
||||
messageAll('MsgTeamBalanceNotify', '\c0Autobalance error: Team %1 mismatch.', %bigTeam );
|
||||
|
||||
// Fire Autobalance
|
||||
Game.clientChangeTeam( %client, %otherTeam, 0 );
|
||||
messageAll('MsgTeamBalanceNotify', '~wfx/powered/vehicle_screen_on.wav');
|
||||
|
||||
//Trigger GetCounts
|
||||
ResetClientChangedTeams();
|
||||
//Reset Unbalanced
|
||||
$UnbalancedMsgPlayed = 0;
|
||||
return;
|
||||
ResetGetCountsStatus();
|
||||
//Reset TBN
|
||||
ResetTBNStatus();
|
||||
}
|
||||
|
||||
function AutobalanceDebug(%teamcanidate1, %teamcanidate2, %team1difference, %team2difference, %bigTeam, %AutobalanceSafetynetTrys, %UseAllMode)
|
||||
|
|
@ -129,7 +129,7 @@ function AutobalanceDebug(%teamcanidate1, %teamcanidate2, %team1difference, %tea
|
|||
messageAll('MsgTeamBalanceNotify', '\c0Autobalance error: %1', %error );
|
||||
|
||||
//Trigger GetCounts
|
||||
ResetClientChangedTeams();
|
||||
ResetGetCountsStatus();
|
||||
//Rerun in 10 secs
|
||||
schedule(10000, 0, "Autobalance", %game, %AutobalanceSafetynetTrys );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
//
|
||||
|
||||
// Set reset string
|
||||
$GetCountsClientTeamChange = true;
|
||||
$GetCountsStatus = "UPDATE";
|
||||
|
||||
package StartTeamCounts
|
||||
{
|
||||
|
|
@ -35,55 +35,63 @@ if (!isActivePackage(StartTeamCounts))
|
|||
|
||||
function GetTeamCounts( %game, %client, %respawn )
|
||||
{
|
||||
//Get teamcounts
|
||||
if( $GetCountsClientTeamChange && $countdownStarted && $MatchStarted )
|
||||
{
|
||||
//Team Count code by Keen
|
||||
$PlayerCount[0] = 0;
|
||||
$PlayerCount[1] = 0;
|
||||
$PlayerCount[2] = 0;
|
||||
|
||||
switch$($GetCountsStatus)
|
||||
{
|
||||
case UPDATE:
|
||||
//Get teamcounts
|
||||
if($countdownStarted && $MatchStarted )
|
||||
{
|
||||
//Team Count code by Keen
|
||||
$PlayerCount[0] = 0;
|
||||
$PlayerCount[1] = 0;
|
||||
$PlayerCount[2] = 0;
|
||||
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
|
||||
//if(!%client.isAIControlled())
|
||||
$PlayerCount[%client.team]++;
|
||||
}
|
||||
|
||||
//if(!%client.isAIControlled())
|
||||
$PlayerCount[%client.team]++;
|
||||
}
|
||||
|
||||
//echo ("$PlayerCount[0] " @ $PlayerCount[0]);
|
||||
//echo ("$PlayerCount[1] " @ $PlayerCount[1]);
|
||||
//echo ("$PlayerCount[2] " @ $PlayerCount[2]);
|
||||
//echo ("$PlayerCount[0] " @ $PlayerCount[0]);
|
||||
//echo ("$PlayerCount[1] " @ $PlayerCount[1]);
|
||||
//echo ("$PlayerCount[2] " @ $PlayerCount[2]);
|
||||
|
||||
//Amount of players on teams
|
||||
$TotalTeamPlayerCount = $PlayerCount[1] + $PlayerCount[2];
|
||||
//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];
|
||||
|
||||
//Start Base Rape Notify
|
||||
schedule(500, 0, "NBRStatusNotify", %game);
|
||||
//Start Team Balance Notify
|
||||
schedule(1000, 0, "TeamBalanceNotify", %game, %team1difference, %team2difference);
|
||||
//Start AntiCloak
|
||||
schedule(1500, 0, "CheckAntiCloak", %game);
|
||||
|
||||
//Set so counter wont run when it doesnt need to.
|
||||
$GetCountsClientTeamChange = false;
|
||||
//Amount of players on teams
|
||||
$TotalTeamPlayerCount = $PlayerCount[1] + $PlayerCount[2];
|
||||
//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];
|
||||
|
||||
//Start Base Rape Notify
|
||||
schedule(500, 0, "NBRStatusNotify", %game);
|
||||
//Start Team Balance Notify
|
||||
schedule(1000, 0, "TeamBalanceNotify", %game, %team1difference, %team2difference);
|
||||
//Start AntiCloak
|
||||
schedule(1500, 0, "CheckAntiCloak", %game);
|
||||
|
||||
//Set so counter wont run when it doesnt need to.
|
||||
$GetCountsStatus = "IDLE";
|
||||
}
|
||||
case IDLE:
|
||||
//Do Nothing
|
||||
}
|
||||
|
||||
if(isEventPending($GetCountsSchedule))
|
||||
cancel($GetCountsSchedule);
|
||||
|
||||
//Call itself again. Every 5 seconds.
|
||||
schedule(5000, 0, "GetTeamCounts");
|
||||
$GetCountsSchedule = schedule(5000, 0, "GetTeamCounts");
|
||||
}
|
||||
|
||||
|
||||
// Triggers a Full run
|
||||
function ResetClientChangedTeams()
|
||||
function ResetGetCountsStatus()
|
||||
{
|
||||
$GetCountsClientTeamChange = true;
|
||||
$GetCountsStatus = "UPDATE";
|
||||
}
|
||||
|
||||
// Proper Overrides
|
||||
|
|
@ -96,7 +104,7 @@ function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn )
|
|||
Parent::clientJoinTeam( %game, %client, %team, %respawn );
|
||||
|
||||
//Trigger GetCounts
|
||||
ResetClientChangedTeams();
|
||||
ResetGetCountsStatus();
|
||||
}
|
||||
|
||||
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned)
|
||||
|
|
@ -104,7 +112,7 @@ function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawn
|
|||
Parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned);
|
||||
|
||||
//Trigger GetCounts
|
||||
ResetClientChangedTeams();
|
||||
ResetGetCountsStatus();
|
||||
}
|
||||
|
||||
function DefaultGame::assignClientTeam(%game, %client, %respawn )
|
||||
|
|
@ -112,7 +120,7 @@ function DefaultGame::assignClientTeam(%game, %client, %respawn )
|
|||
Parent::assignClientTeam(%game, %client, %respawn );
|
||||
|
||||
//Trigger GetCounts
|
||||
ResetClientChangedTeams();
|
||||
ResetGetCountsStatus();
|
||||
}
|
||||
|
||||
function DefaultGame::onClientEnterObserverMode( %game, %client )
|
||||
|
|
@ -120,7 +128,7 @@ function DefaultGame::onClientEnterObserverMode( %game, %client )
|
|||
Parent::onClientEnterObserverMode( %game, %client );
|
||||
|
||||
//Trigger GetCounts
|
||||
ResetClientChangedTeams();
|
||||
ResetGetCountsStatus();
|
||||
}
|
||||
|
||||
function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
|
||||
|
|
@ -128,15 +136,7 @@ function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
|
|||
Parent::AIChangeTeam(%game, %client, %newTeam);
|
||||
|
||||
//Trigger GetCounts
|
||||
ResetClientChangedTeams();
|
||||
}
|
||||
|
||||
function DefaultGame::forceObserver(%game, %client, %reason)
|
||||
{
|
||||
Parent::forceObserver(%game, %client, %reason);
|
||||
|
||||
//Trigger GetCounts
|
||||
ResetClientChangedTeams();
|
||||
ResetGetCountsStatus();
|
||||
}
|
||||
|
||||
function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch)
|
||||
|
|
@ -144,7 +144,7 @@ function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %
|
|||
Parent::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch);
|
||||
|
||||
//Reset GetCounts
|
||||
ResetClientChangedTeams();
|
||||
ResetGetCountsStatus();
|
||||
}
|
||||
|
||||
function DefaultGame::gameOver(%game)
|
||||
|
|
@ -152,7 +152,7 @@ function DefaultGame::gameOver(%game)
|
|||
Parent::gameOver(%game);
|
||||
|
||||
//Reset GetCounts
|
||||
ResetClientChangedTeams();
|
||||
ResetGetCountsStatus();
|
||||
}
|
||||
|
||||
function GameConnection::onDrop(%client, %reason)
|
||||
|
|
@ -160,7 +160,7 @@ function GameConnection::onDrop(%client, %reason)
|
|||
Parent::onDrop(%client, %reason);
|
||||
|
||||
//Reset GetCounts
|
||||
ResetClientChangedTeams();
|
||||
ResetGetCountsStatus();
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -10,52 +10,38 @@
|
|||
function NBRStatusNotify( %game )
|
||||
{
|
||||
if( $CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify && !$Host::TournamentMode && $Host::EvoNoBaseRapeEnabled )
|
||||
{
|
||||
//echo ("%client " @ %client);
|
||||
//echo ("$TeamBalanceClient " @ $TeamBalanceClient);
|
||||
|
||||
{
|
||||
//On
|
||||
if( $Host::EvoNoBaseRapeClassicPlayerCount > $TotalTeamPlayerCount )
|
||||
if( $Host::EvoNoBaseRapeClassicPlayerCount > $TotalTeamPlayerCount )
|
||||
{
|
||||
if( $NoBaseRapeNotifyCount !$= 0 )
|
||||
{
|
||||
messageAll('MsgNoBaseRapeNotify', '\c1No Base Rape: \c0Enabled.');
|
||||
$NoBaseRapeNotifyCount = 0;
|
||||
}
|
||||
if( $NBRStatus !$= "PLAYEDON" )
|
||||
$NBRStatus = "ON";
|
||||
}
|
||||
//Off
|
||||
else if( $NoBaseRapeNotifyCount !$= 1 )
|
||||
else
|
||||
{
|
||||
messageAll('MsgNoBaseRapeNotify', '\c1No Base Rape: \c0Disabled.~wfx/misc/diagnostic_on.wav');
|
||||
$NoBaseRapeNotifyCount = 1;
|
||||
if( $NBRStatus !$= "PLAYEDOFF" )
|
||||
$NBRStatus = "OFF";
|
||||
}
|
||||
|
||||
switch$($NBRStatus)
|
||||
{
|
||||
case ON:
|
||||
messageAll('MsgNoBaseRapeNotify', '\c1No Base Rape: \c0Enabled.');
|
||||
$NBRStatus = "PLAYEDON";
|
||||
case OFF:
|
||||
messageAll('MsgNoBaseRapeNotify', '\c1No Base Rape: \c0Disabled.~wfx/misc/diagnostic_on.wav');
|
||||
$NBRStatus = "PLAYEDOFF";
|
||||
case PLAYEDON:
|
||||
//Do Nothing
|
||||
case PLAYEDOFF:
|
||||
//Do Nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This function is at StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
||||
// In the staticshape.ovl in evoClassic.vl2
|
||||
// Plays a sound when a player hits a protected asset
|
||||
function NBRAssetSound( %game, %sourceObject )
|
||||
{
|
||||
%client = %sourceObject;
|
||||
|
||||
if( !%client.NBRAssetSoundMsgPlayed && $CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify && !$Host::TournamentMode && $Host::EvoNoBaseRapeEnabled )
|
||||
{
|
||||
messageClient(%sourceObject.client, 'MsgNoBaseRapeNotify', '\c2No Base Rape is enabled until %1 players.', $Host::EvoNoBaseRapeClassicPlayerCount );
|
||||
|
||||
%client.NBRAssetSoundMsgPlayed = true;
|
||||
schedule(10000, 0, "ResetNBRAssetSound", %client );
|
||||
}
|
||||
}
|
||||
|
||||
// Cool down between messages
|
||||
function ResetNBRAssetSound( %client )
|
||||
{
|
||||
%client.NBRAssetSoundMsgPlayed = false;
|
||||
}
|
||||
|
||||
// Reset every map change
|
||||
package ResetNoBaseRapeNotify
|
||||
// Reset gameover
|
||||
package ResetNBRNotify
|
||||
{
|
||||
|
||||
function DefaultGame::gameOver(%game)
|
||||
|
|
@ -63,13 +49,32 @@ function DefaultGame::gameOver(%game)
|
|||
Parent::gameOver(%game);
|
||||
|
||||
//Reset NoBaseRapeNotify
|
||||
$NoBaseRapeNotifyCount = -1;
|
||||
$NBRStatus = "IDLE";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Prevent package from being activated if it is already
|
||||
if (!isActivePackage(ResetNoBaseRapeNotify))
|
||||
activatePackage(ResetNoBaseRapeNotify);
|
||||
if (!isActivePackage(ResetNBRNotify))
|
||||
activatePackage(ResetNBRNotify);
|
||||
|
||||
|
||||
// This function is at StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType) in the staticshape.ovl in evoClassic.vl2
|
||||
// Plays a sound when a player hits a protected enemy asset
|
||||
function NBRAssetSound( %game, %sourceObject )
|
||||
{
|
||||
//Wont play again until the schedule is done
|
||||
if(!isEventPending(%sourceObject.NBRAssetSoundSchedule) && $CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify && !$Host::TournamentMode && $Host::EvoNoBaseRapeEnabled )
|
||||
{
|
||||
messageClient(%sourceObject.client, 'MsgNoBaseRapeNotify', '\c2No Base Rape is enabled until %1 players.', $Host::EvoNoBaseRapeClassicPlayerCount );
|
||||
%sourceObject.NBRAssetSoundSchedule = schedule(10000, 0, "ResetNBRAssetSound", %sourceObject );
|
||||
}
|
||||
}
|
||||
// Reset
|
||||
function ResetNBRAssetSound( %sourceObject )
|
||||
{
|
||||
if(isEventPending(%sourceObject.NBRAssetSoundSchedule))
|
||||
cancel(%sourceObject.NBRAssetSoundSchedule);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,48 +11,60 @@
|
|||
//
|
||||
|
||||
|
||||
// This function is called in GetTeamCounts.cs
|
||||
// Called in GetTeamCounts.cs
|
||||
function TeamBalanceNotify( %game, %team1difference, %team2difference )
|
||||
{
|
||||
if( $CurrentMissionType !$= "LakRabbit" && $TotalTeamPlayerCount !$= 0 && !$Host::TournamentMode )
|
||||
if( ($CurrentMissionType $= "CTF" || $CurrentMissionType $= "sctf") && $TotalTeamPlayerCount !$= 0 && !$Host::TournamentMode )
|
||||
{
|
||||
//echo ("%Team1Difference " @ %Team1Difference);
|
||||
//echo ("%Team2Difference " @ %Team2Difference);
|
||||
|
||||
//Uneven
|
||||
if( $PlayerCount[1] !$= $PlayerCount[2] )
|
||||
{
|
||||
//Reset Balanced.
|
||||
$BalancedMsgPlayed = 0;
|
||||
|
||||
if( %team1difference >= 2 || %team2difference >= 2 )
|
||||
{
|
||||
if( %team1difference >= 2 || %team2difference >= 2 ) //Teams are unbalanced
|
||||
{
|
||||
if( $UnbalancedMsgPlayed !$= 1)
|
||||
{
|
||||
//Run once.
|
||||
$UnbalancedMsgPlayed = 1;
|
||||
//Start Sound Schedule
|
||||
schedule(15000, 0, "UnbalancedSound", %game );
|
||||
}
|
||||
if( $TBNStatus !$= "NOTIFY" ) //Stops any new schedules
|
||||
$TBNStatus = "UNBALANCED";
|
||||
}
|
||||
else
|
||||
//Means teams arnt even, but arnt so uneven to do anything about. Meaning a team is a man down. 6vs7, 4vs3 etc
|
||||
$TBNStatus = "UNEVEN";
|
||||
}
|
||||
//If teams are balanced
|
||||
else if( $PlayerCount[1] == $PlayerCount[2] && $TotalTeamPlayerCount !$= 0 && $BalancedMsgPlayed !$= 1 )
|
||||
//Teams are even
|
||||
else if( $PlayerCount[1] == $PlayerCount[2] && $TBNStatus !$= "PLAYEDEVEN" )
|
||||
$TBNStatus = "EVEN";
|
||||
|
||||
switch$($TBNStatus)
|
||||
{
|
||||
//messageAll('MsgTeamBalanceNotify', '\c1Teams are balanced.');
|
||||
//Once per cycle.
|
||||
$BalancedMsgPlayed = 1;
|
||||
//Reset Unbalanced.
|
||||
$UnbalancedMsgPlayed = 0;
|
||||
case IDLE:
|
||||
//Do Nothing
|
||||
case UNEVEN:
|
||||
//Do Nothing
|
||||
case UNBALANCED:
|
||||
//Start Schedule to Notify
|
||||
$NotifySchedule = schedule(15000, 0, "NotifyUnbalanced", %game );
|
||||
$TBNStatus = "NOTIFY";
|
||||
case EVEN:
|
||||
//messageAll('MsgTeamBalanceNotify', '\c1Teams are balanced.');
|
||||
$TBNStatus = "PLAYEDEVEN";
|
||||
case PLAYEDEVEN:
|
||||
//Do Nothing
|
||||
case NOTIFY:
|
||||
//Do Nothing
|
||||
}
|
||||
}
|
||||
//echo($TBNStatus);
|
||||
}
|
||||
|
||||
//Check to see if teams are still unbalanced
|
||||
//Fire AutoBalance in 30 sec if enabled
|
||||
function UnbalancedSound( %game )
|
||||
function NotifyUnbalanced( %game )
|
||||
{
|
||||
if( $UnbalancedMsgPlayed $= 1 )
|
||||
if(isEventPending($NotifySchedule))
|
||||
cancel($NotifySchedule);
|
||||
|
||||
if( $TBNStatus $= "NOTIFY" ) //If Status has changed to EVEN or anything else.
|
||||
{
|
||||
//Team Count code by Keen
|
||||
$PlayerCount[0] = 0;
|
||||
|
|
@ -73,8 +85,7 @@ function UnbalancedSound( %game )
|
|||
|
||||
if( %team1difference == 1 || %team2difference == 1 || $PlayerCount[1] == $PlayerCount[2] )
|
||||
{
|
||||
//Reset
|
||||
$UnbalancedMsgPlayed = 0;
|
||||
ResetTBNStatus();
|
||||
return;
|
||||
}
|
||||
//Continue
|
||||
|
|
@ -84,42 +95,39 @@ function UnbalancedSound( %game )
|
|||
if( $Host::EnableAutobalance )
|
||||
{
|
||||
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance Initializing.~wgui/vote_nopass.wav');
|
||||
schedule(30000, 0, "Autobalance", %game );
|
||||
$AutoBalanceSchedule = schedule(30000, 0, "Autobalance", %game );
|
||||
}
|
||||
//If Autobalance is disabled, message only.
|
||||
else if( $Host::EnableTeamBalanceNotify )
|
||||
{
|
||||
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0%1 vs %2 with %3 observers.~wgui/vote_nopass.wav', $PlayerCount[1], $PlayerCount[2], $PlayerCount[0] );
|
||||
schedule(13000, 0, "ResetTeamBalanceNotifyGameOver");
|
||||
schedule(15000, 0, "ResetClientChangedTeams");
|
||||
schedule(13000, 0, "ResetTBNStatus");
|
||||
schedule(15000, 0, "ResetGetCountsStatus");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Reset Notify
|
||||
function ResetTeamBalanceNotifyGameOver()
|
||||
// Reset TBNStatus
|
||||
function ResetTBNStatus()
|
||||
{
|
||||
//Reset All TeamBalance Variables
|
||||
$BalancedMsgPlayed = -1;
|
||||
$UnbalancedMsgPlayed = -1;
|
||||
$TBNStatus = "IDLE";
|
||||
}
|
||||
|
||||
// Reset every map change
|
||||
package ResetTeamBalanceNotify
|
||||
package ResetTBNGameOver
|
||||
{
|
||||
|
||||
function DefaultGame::gameOver(%game)
|
||||
{
|
||||
Parent::gameOver(%game);
|
||||
|
||||
//Reset All TeamBalance Variables
|
||||
ResetTeamBalanceNotifyGameOver();
|
||||
//Reset TBNStatus
|
||||
ResetTBNStatus();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Prevent package from being activated if it is already
|
||||
if (!isActivePackage(ResetTeamBalanceNotify))
|
||||
activatePackage(ResetTeamBalanceNotify);
|
||||
if (!isActivePackage(ResetTBNGameOver))
|
||||
activatePackage(ResetTBNGameOver);
|
||||
Loading…
Add table
Add a link
Reference in a new issue