Proper Overrides

Moved some things around so its easier to find using proper overrides instead of inserting code in random places.

Works the same way.
This commit is contained in:
ChocoTaco 2019-10-06 16:30:41 -04:00
parent d10d3cb1e9
commit 083af158ae
7 changed files with 153 additions and 35 deletions

View file

@ -10,7 +10,7 @@
// //
// Called in GetCounts.cs // Called in GetCounts.cs
function ActivateAntiCloak( %game ) function CheckAntiCloak( %game )
{ {
//CTF only //CTF only
if( $Host::AntiCloakEnable && $CurrentMissionType $= "CTF" ) if( $Host::AntiCloakEnable && $CurrentMissionType $= "CTF" )

View file

@ -146,3 +146,21 @@ function SetNextMapGetRandoms( %client )
$SetNextMissionMapSlot8 = "ShrineDM"; $SetNextMissionMapSlot8 = "ShrineDM";
} }
} }
// Reset SetNextMission every map change
package ResetSetNextMission
{
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset SetNextMission Restore
$SetNextMissionRestore = "";
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(ResetSetNextMission))
activatePackage(ResetSetNextMission);

View file

@ -65,10 +65,7 @@ function GetTeamCounts( %game, %client, %respawn )
//Start Team Balance Notify //Start Team Balance Notify
schedule(1000, 0, "TeamBalanceNotify", %game, %team1difference, %team2difference); schedule(1000, 0, "TeamBalanceNotify", %game, %team1difference, %team2difference);
//Start AntiCloak //Start AntiCloak
schedule(1500, 0, "ActivateAntiCloak", %game); schedule(1500, 0, "CheckAntiCloak", %game);
//Start MapRepetitionChecker
schedule(2000, 0, "MapRepetitionChecker", %game);
//Set so counter wont run when it doesnt need to. //Set so counter wont run when it doesnt need to.
$GetCountsClientTeamChange = false; $GetCountsClientTeamChange = false;
@ -79,10 +76,91 @@ function GetTeamCounts( %game, %client, %respawn )
} }
// Run at DefaultGame::clientJoinTeam, DefaultGame::clientChangeTeam, DefaultGame::assignClientTeam in evo defaultgame.ovl // Triggers a Full run
// 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() function ResetClientChangedTeams()
{ {
$GetCountsClientTeamChange = true; $GetCountsClientTeamChange = true;
} }
// Proper Overrides
// Events that determine a TeamGetCounts update
package TeamCountsTriggers
{
function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn )
{
Parent::clientJoinTeam( %game, %client, %team, %respawn );
//Trigger GetCounts
ResetClientChangedTeams();
}
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned)
{
Parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned);
//Trigger GetCounts
ResetClientChangedTeams();
}
function DefaultGame::assignClientTeam(%game, %client, %respawn )
{
Parent::assignClientTeam(%game, %client, %respawn );
//Trigger GetCounts
ResetClientChangedTeams();
}
function DefaultGame::onClientEnterObserverMode( %game, %client )
{
Parent::onClientEnterObserverMode( %game, %client );
//Trigger GetCounts
ResetClientChangedTeams();
}
function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
{
Parent::AIChangeTeam(%game, %client, %newTeam);
//Trigger GetCounts
ResetClientChangedTeams();
}
function DefaultGame::onClientLeaveGame(%game, %client)
{
Parent::onClientLeaveGame(%game, %client);
//Trigger GetCounts
ResetClientChangedTeams();
}
function DefaultGame::forceObserver(%game, %client, %reason)
{
Parent::forceObserver(%game, %client, %reason);
//Trigger GetCounts
ResetClientChangedTeams();
}
function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch)
{
Parent::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch);
//Reset GetCounts
ResetClientChangedTeams();
}
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset GetCounts
ResetClientChangedTeams();
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(TeamCountsTriggers))
activatePackage(TeamCountsTriggers);

View file

@ -32,13 +32,6 @@ function NBRStatusNotify( %game )
} }
} }
// This function is at DefaultGame::gameOver(%game) CTFGame.cs
// Resets the client NotifyCount when the mission ends
function ResetNBRNotify()
{
$NoBaseRapeNotifyCount = -1;
}
// This function is at StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType) // This function is at StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
// In the staticshape.ovl in evoClassic.vl2 // In the staticshape.ovl in evoClassic.vl2
// Plays a sound when a player hits a protected asset // Plays a sound when a player hits a protected asset
@ -61,4 +54,22 @@ function ResetNBRAssetSound( %client )
%client.NBRAssetSoundMsgPlayed = false; %client.NBRAssetSoundMsgPlayed = false;
} }
// Reset every map change
package ResetNoBaseRapeNotify
{
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset NoBaseRapeNotify
$NoBaseRapeNotifyCount = -1;
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(ResetNoBaseRapeNotify))
activatePackage(ResetNoBaseRapeNotify);

View file

@ -98,10 +98,28 @@ function UnbalancedSound( %game )
} }
//Reset Notify at defaultgame::gameOver in evo defaultgame.ovl // Reset Notify
function ResetTeamBalanceNotifyGameOver() function ResetTeamBalanceNotifyGameOver()
{ {
//Reset All TeamBalance Variables //Reset All TeamBalance Variables
$BalancedMsgPlayed = -1; $BalancedMsgPlayed = -1;
$UnbalancedMsgPlayed = -1; $UnbalancedMsgPlayed = -1;
} }
// Reset every map change
package ResetTeamBalanceNotify
{
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset All TeamBalance Variables
ResetTeamBalanceNotifyGameOver();
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(ResetTeamBalanceNotify))
activatePackage(ResetTeamBalanceNotify);

View file

@ -56,6 +56,15 @@ function DefaultGame::checkTimeLimit(%game, %forced)
} }
} }
// Reset every map change
function DefaultGame::gameOver(%game)
{
Parent::gameOver(%game);
//Reset everything to do with Vote Overtime
ResetVOall(%game);
}
}; };
function RestartcheckTimeLimit(%game, %forced) function RestartcheckTimeLimit(%game, %forced)

View file

@ -1428,9 +1428,6 @@ function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn )
updateCanListenState( %client ); updateCanListenState( %client );
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,9 +1480,6 @@ 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
@ -1561,9 +1555,6 @@ 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
@ -1646,9 +1637,6 @@ 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)
@ -1780,10 +1768,6 @@ 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'