mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-01-19 16:14:44 +00:00
Bug fixes and updates
Fixed a bug where gameOver was being overridden twice. The bulk of GetCounts only runs during teamchange events.
This commit is contained in:
parent
26586036bf
commit
330d4e4b51
|
|
@ -10,6 +10,7 @@ function CreateServer(%mission, %missionType)
|
||||||
parent::CreateServer(%mission, %missionType);
|
parent::CreateServer(%mission, %missionType);
|
||||||
//Start
|
//Start
|
||||||
//Call for a GetTeamCount update
|
//Call for a GetTeamCount update
|
||||||
|
ResetClientChangedTeams();
|
||||||
GetTeamCounts( %game, %client, %respawn );
|
GetTeamCounts( %game, %client, %respawn );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -26,16 +27,11 @@ function GetTeamCounts( %game, %client, %respawn )
|
||||||
deactivatePackage(StartTeamCounts);
|
deactivatePackage(StartTeamCounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
//echo ("Clientgroup " @ ClientGroup.getCount());
|
if($GetCountsClientTeamChange && $countdownStarted && $MatchStarted) {
|
||||||
//echo ("$PlayerCount[0] " @ $PlayerCount[0]);
|
//Team Count code by Keen
|
||||||
//echo ("$PlayerCount[1] " @ $PlayerCount[1]);
|
$PlayerCount[0] = 0;
|
||||||
//echo ("$PlayerCount[2] " @ $PlayerCount[2]);
|
$PlayerCount[1] = 0;
|
||||||
//echo ("client.team " @ %client.team);
|
$PlayerCount[2] = 0;
|
||||||
|
|
||||||
//Team Count code by Keen
|
|
||||||
$PlayerCount[0] = 0;
|
|
||||||
$PlayerCount[1] = 0;
|
|
||||||
$PlayerCount[2] = 0;
|
|
||||||
|
|
||||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||||
{
|
{
|
||||||
|
|
@ -45,48 +41,53 @@ function GetTeamCounts( %game, %client, %respawn )
|
||||||
$PlayerCount[%client.team]++;
|
$PlayerCount[%client.team]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//echo ("Clientgroup " @ ClientGroup.getCount());
|
||||||
|
//echo ("$PlayerCount[0] " @ $PlayerCount[0]);
|
||||||
|
//echo ("$PlayerCount[1] " @ $PlayerCount[1]);
|
||||||
|
//echo ("$PlayerCount[2] " @ $PlayerCount[2]);
|
||||||
|
//echo ("client.team " @ %client.team);
|
||||||
|
|
||||||
//Other variables
|
//Other variables
|
||||||
//Amount of players on teams
|
//Amount of players on teams
|
||||||
$TotalTeamPlayerCount = $PlayerCount[1] + $PlayerCount[2];
|
$TotalTeamPlayerCount = $PlayerCount[1] + $PlayerCount[2];
|
||||||
//Amount of all players including observers
|
//Amount of all players including observers
|
||||||
$AllPlayerCount = $PlayerCount[1] + $PlayerCount[2] + $PlayerCount[0];
|
$AllPlayerCount = $PlayerCount[1] + $PlayerCount[2] + $PlayerCount[0];
|
||||||
|
|
||||||
//Call Team Balance Notify
|
|
||||||
//Make sure it's CTF Mode
|
//Start Base Rape Notify
|
||||||
if($CurrentMissionType $= "CTF" && $TotalTeamPlayerCount !$= 0 && $countdownStarted $= true && $MatchStarted $= true) {
|
//Make sure it's CTF Mode
|
||||||
TeamBalanceNotify::AtSpawn( %game, %client, %respawn );
|
if($CurrentMissionType $= "CTF") {
|
||||||
|
PlayerNotify::AtSpawn( %game, %client, %respawn );
|
||||||
|
}
|
||||||
|
//Call Team Balance Notify
|
||||||
|
//Make sure it's CTF Mode
|
||||||
|
if($CurrentMissionType $= "CTF" && $TotalTeamPlayerCount !$= 0) {
|
||||||
|
TeamBalanceNotify::AtSpawn( %game, %client, %respawn );
|
||||||
|
}
|
||||||
|
if($CurrentMissionType $= "sctf" && $TotalTeamPlayerCount !$= 0) {
|
||||||
|
TeamBalanceNotify::AtSpawn( %game, %client, %respawn );
|
||||||
|
}
|
||||||
|
//AntiCloak Start
|
||||||
|
//if($CurrentMissionType $= "CTF") {
|
||||||
|
//ActivateAntiCloak ();
|
||||||
|
//}
|
||||||
|
|
||||||
|
$GetCountsClientTeamChange = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
if($CurrentMissionType $= "sctf" && $TotalTeamPlayerCount !$= 0 && $countdownStarted $= true && $MatchStarted $= true) {
|
|
||||||
TeamBalanceNotify::AtSpawn( %game, %client, %respawn );
|
|
||||||
}
|
|
||||||
//Start Base Rape Notify
|
|
||||||
//Make sure it's CTF Mode
|
|
||||||
if($CurrentMissionType $= "CTF" && $countdownStarted $= true && $MatchStarted $= true) {
|
|
||||||
PlayerNotify::AtSpawn( %game, %client, %respawn );
|
|
||||||
}
|
|
||||||
//AntiCloak Start
|
|
||||||
//if($CurrentMissionType $= "CTF") {
|
|
||||||
//ActivateAntiCloak ();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//Call itself again. Every 5 seconds.
|
//Call itself again. Every 5 seconds.
|
||||||
schedule(5000, 0, "GetTeamCounts");
|
schedule(5000, 0, "GetTeamCounts");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//For instant Calls for an update
|
//Run at DefaultGame::clientJoinTeam, DefaultGame::clientChangeTeam, DefaultGame::assignClientTeam in evo defaultgame.ovl
|
||||||
//function QuickTeamCounts( %game, %client, %respawn )
|
//Also Run at DefaultGame::onClientEnterObserverMode, DefaultGame::AIChangeTeam, DefaultGame::onClientLeaveGame, DefaultGame::forceObserver in evo defaultgame.ovl
|
||||||
//{
|
//And finally GameConnection::onConnect in evo server.ovl
|
||||||
//Team Count code by Keen
|
//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.
|
||||||
//$PlayerCount[0] = 0;
|
//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.
|
||||||
//$PlayerCount[1] = 0;
|
function ResetClientChangedTeams() {
|
||||||
//$PlayerCount[2] = 0;
|
//Let GetTeamCounts run if there is a Teamchange.
|
||||||
|
$GetCountsClientTeamChange = true;
|
||||||
//for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
}
|
||||||
//{
|
|
||||||
//%client = ClientGroup.getObject(%i);
|
|
||||||
|
|
||||||
//if(!%client.isAIControlled())
|
|
||||||
//$PlayerCount[%client.team]++;
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
|
|
|
||||||
|
|
@ -59,29 +59,19 @@ function TeamBalanceNotify::AtSpawn( %game, %client, %respawn )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Called in evo in CTFGame.ovl
|
//Called in CTFGame::flagCap in evo CTFGame.ovl
|
||||||
|
//Allows for another unbalanced notification everytime the flag is capped.
|
||||||
function ResetUnbalancedNotifyPerCap()
|
function ResetUnbalancedNotifyPerCap()
|
||||||
{
|
{
|
||||||
$TeamBalanceNotifyCount = 0;
|
$TeamBalanceNotifyCount = 0;
|
||||||
$StatsBalanceCount = 0;
|
$StatsBalanceCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Start and Reset Notify
|
//Reset Notify at defaultgame::gameOver in evo defaultgame.ovl
|
||||||
package TeamCountNotify {
|
function ResetTeamBalanceNotifyGameOver( %game ) {
|
||||||
|
|
||||||
//Reset Notify
|
|
||||||
function DefaultGame::gameOver( %game ) {
|
|
||||||
//Call default function
|
|
||||||
parent::gameOver( %game );
|
|
||||||
//Reset TeamBalance Variables
|
//Reset TeamBalance Variables
|
||||||
$BalancedCount = -1;
|
$BalancedCount = -1;
|
||||||
$TeamBalanceNotifyCount = -1;
|
$TeamBalanceNotifyCount = -1;
|
||||||
$StatsBalanceCount = -1;
|
$StatsBalanceCount = -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// Prevent package from being activated if it is already
|
|
||||||
if (!isActivePackage(TeamCountNotify))
|
|
||||||
activatePackage(TeamCountNotify);
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
//$MissionName is the file name of the mission
|
//$MissionName is the file name of the mission
|
||||||
//$MapName is the displayed name(no underscore,spaces)
|
//$MapName is the displayed name(no underscore,spaces)
|
||||||
//$GameType (CTF,Hunters)
|
|
||||||
|
|
||||||
|
|
||||||
function DefaultGame::activatePackages(%game)
|
function DefaultGame::activatePackages(%game)
|
||||||
{
|
{
|
||||||
|
|
@ -152,7 +150,7 @@ function FlipFlop::playerTouch(%data, %flipflop, %player)
|
||||||
|
|
||||||
function DefaultGame::initGameVars(%game)
|
function DefaultGame::initGameVars(%game)
|
||||||
{
|
{
|
||||||
%game.SCORE_PER_SUICIDE = 0;
|
%game.SCORE_PER_SUICIDE = 0;
|
||||||
%game.SCORE_PER_TEAMKILL = 0;
|
%game.SCORE_PER_TEAMKILL = 0;
|
||||||
%game.SCORE_PER_DEATH = 0;
|
%game.SCORE_PER_DEATH = 0;
|
||||||
|
|
||||||
|
|
@ -618,7 +616,7 @@ function DefaultGame::gameOver( %game )
|
||||||
|
|
||||||
// Default game does nothing... except lets the AI know the mission is over
|
// Default game does nothing... except lets the AI know the mission is over
|
||||||
AIMissionEnd();
|
AIMissionEnd();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
@ -1153,6 +1151,7 @@ function DefaultGame::forceObserver( %game, %client, %reason )
|
||||||
|
|
||||||
// call the onEvent for this game type
|
// call the onEvent for this game type
|
||||||
%game.onClientEnterObserverMode(%client); //Bounty uses this to remove this client from others' hit lists
|
%game.onClientEnterObserverMode(%client); //Bounty uses this to remove this client from others' hit lists
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DefaultGame::displayDeathMessages(%game, %clVictim, %clKiller, %damageType, %implement)
|
function DefaultGame::displayDeathMessages(%game, %clVictim, %clKiller, %damageType, %implement)
|
||||||
|
|
@ -1430,6 +1429,8 @@ function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn )
|
||||||
|
|
||||||
logEcho(%client.nameBase@" (cl "@%client@") joined team "@%client.team);
|
logEcho(%client.nameBase@" (cl "@%client@") joined team "@%client.team);
|
||||||
|
|
||||||
|
//Trigger GetCounts
|
||||||
|
ResetClientChangedTeams();
|
||||||
}
|
}
|
||||||
|
|
||||||
function DefaultGame::AIHasJoined(%game, %client)
|
function DefaultGame::AIHasJoined(%game, %client)
|
||||||
|
|
@ -1483,6 +1484,8 @@ function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
|
||||||
|
|
||||||
messageAllExcept( %client, -1, 'MsgClientJoinTeam', '\c1bot %1 has switched to team %2.', %client.name, %game.getTeamName(%client.team), %client, %client.team );
|
messageAllExcept( %client, -1, 'MsgClientJoinTeam', '\c1bot %1 has switched to team %2.', %client.name, %game.getTeamName(%client.team), %client, %client.team );
|
||||||
|
|
||||||
|
//Trigger GetCounts
|
||||||
|
ResetClientChangedTeams();
|
||||||
}
|
}
|
||||||
|
|
||||||
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned) // z0dd - ZOD, 6/06/02. Don't send a message if player used respawn feature. Added %respawned
|
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned) // z0dd - ZOD, 6/06/02. Don't send a message if player used respawn feature. Added %respawned
|
||||||
|
|
@ -1558,6 +1561,9 @@ function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawn
|
||||||
// MES - switch objective hud lines when client switches teams
|
// MES - switch objective hud lines when client switches teams
|
||||||
messageClient(%client, 'MsgCheckTeamLines', "", %client.team);
|
messageClient(%client, 'MsgCheckTeamLines', "", %client.team);
|
||||||
logEcho(%client.nameBase@" (cl "@%client@") switched to team "@%client.team);
|
logEcho(%client.nameBase@" (cl "@%client@") switched to team "@%client.team);
|
||||||
|
|
||||||
|
//Trigger GetCounts
|
||||||
|
ResetClientChangedTeams();
|
||||||
}
|
}
|
||||||
|
|
||||||
// missioncleanup and missiongroup are checked prior to entering game code
|
// missioncleanup and missiongroup are checked prior to entering game code
|
||||||
|
|
@ -1640,6 +1646,9 @@ function DefaultGame::onClientLeaveGame(%game, %client)
|
||||||
//remove them from the team rank arrays
|
//remove them from the team rank arrays
|
||||||
%game.removeFromTeamRankArray(%client);
|
%game.removeFromTeamRankArray(%client);
|
||||||
logEcho(%client.nameBase@" (cl "@%client@") dropped");
|
logEcho(%client.nameBase@" (cl "@%client@") dropped");
|
||||||
|
|
||||||
|
//Trigger GetCounts
|
||||||
|
ResetClientChangedTeams();
|
||||||
}
|
}
|
||||||
|
|
||||||
function DefaultGame::clientMissionDropReady(%game, %client)
|
function DefaultGame::clientMissionDropReady(%game, %client)
|
||||||
|
|
@ -1771,6 +1780,10 @@ function DefaultGame::testDrop( %game, %client )
|
||||||
function DefaultGame::onClientEnterObserverMode( %game, %client )
|
function DefaultGame::onClientEnterObserverMode( %game, %client )
|
||||||
{
|
{
|
||||||
// Default game doesn't care...
|
// Default game doesn't care...
|
||||||
|
|
||||||
|
//Trigger GetCounts
|
||||||
|
ResetClientChangedTeams();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// from 'item.cs'
|
// from 'item.cs'
|
||||||
|
|
@ -3178,7 +3191,7 @@ function DefaultGame::voteChangeTimeLimit( %game, %admin, %newLimit )
|
||||||
%cause = "(vote)";
|
%cause = "(vote)";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
messageAll('MsgVoteFailed', '\c2The vote to change the mission time limit did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
messageAll('MsgVoteFailed', '\c2The vote to change the mission time limit did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
//if the time limit was actually changed...
|
//if the time limit was actually changed...
|
||||||
|
|
@ -3755,7 +3768,7 @@ function notifyMatchEnd(%time)
|
||||||
if (%seconds > 1) {
|
if (%seconds > 1) {
|
||||||
MessageAll('MsgMissionEnd', '\c2Match ends in %1 seconds.~wfx/misc/hunters_%1.wav', %seconds);
|
MessageAll('MsgMissionEnd', '\c2Match ends in %1 seconds.~wfx/misc/hunters_%1.wav', %seconds);
|
||||||
if (%seconds == 60) {
|
if (%seconds == 60) {
|
||||||
MessageAll('MsgNotifyEvoNextMission', '\c2Next Mission: \c3%1', $EvoCachedNextMission);
|
MessageAll('MsgNotifyEvoNextMission', '\c2Next Mission: \c1%1', $EvoCachedNextMission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (%seconds == 1)
|
else if (%seconds == 1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue