mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-07-14 15:44:34 +00:00
Cleaned up code
This commit is contained in:
parent
f6f82b71a4
commit
9a0ae70e21
2 changed files with 63 additions and 78 deletions
|
|
@ -1,44 +1,40 @@
|
||||||
//Enable or Disable
|
//Enable or Disable
|
||||||
//$Host::EnableNoBaseRapeNotify = 1;
|
//$Host::EnableNoBaseRapeNotify = 1;
|
||||||
//
|
//
|
||||||
//This function is at DefaultGame::spawnPlayer( %game, %client, %respawn ) defaultGame.cs
|
//Notifys the user if NoBase rape is on or off.
|
||||||
//Notifys the user if NoBase rape is on or off. Has a Counter so it is only run once and doesnt spam the client. It is triggered at spawn.
|
function NBRStatusNotify( %game, %client, %respawn )
|
||||||
function PlayerNotify::AtSpawn( %game, %client, %respawn )
|
|
||||||
{
|
{
|
||||||
if( $CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify )
|
if( $CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify )
|
||||||
{
|
{
|
||||||
//echo ("%client " @ %client);
|
//echo ("%client " @ %client);
|
||||||
//echo ("$TeamBalanceClient " @ $TeamBalanceClient);
|
//echo ("$TeamBalanceClient " @ $TeamBalanceClient);
|
||||||
|
|
||||||
//Is NoBaseRape On or off
|
//On
|
||||||
if( !$Host::TournamentMode && $Host::EvoNoBaseRapeEnabled && $Host::EvoNoBaseRapeClassicPlayerCount > $TotalTeamPlayerCount ) {
|
if( !$Host::TournamentMode && $Host::EvoNoBaseRapeEnabled && $Host::EvoNoBaseRapeClassicPlayerCount > $TotalTeamPlayerCount && $NoBaseRapeNotifyCount !$= 0 )
|
||||||
//If on, has the client gotten the notification already
|
{
|
||||||
if($NoBaseRapeNotifyCount !$= 0) {
|
messageAll('MsgNoBaseRapeNotify', 'No Base Rape is \c1Enabled.~wfx/misc/nexus_cap.wav');
|
||||||
messageAll('MsgNoBaseRapeNotify', 'No Base Rape is \c1Enabled.~wfx/misc/nexus_cap.wav');
|
$NoBaseRapeNotifyCount = 0;
|
||||||
$NoBaseRapeNotifyCount = 0;
|
}
|
||||||
}
|
//Off
|
||||||
|
else if( $NoBaseRapeNotifyCount !$= 1 )
|
||||||
|
{
|
||||||
|
messageAll('MsgNoBaseRapeNotify', 'No Base Rape is \c1Disabled.~wfx/misc/diagnostic_on.wav');
|
||||||
|
$NoBaseRapeNotifyCount = 1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
//NoBaseRape is off
|
|
||||||
//Has the client gotten the notification already
|
|
||||||
if($NoBaseRapeNotifyCount !$= 1) {
|
|
||||||
messageAll('MsgNoBaseRapeNotify', 'No Base Rape is \c1Disabled.~wfx/misc/diagnostic_on.wav');
|
|
||||||
$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 evopackage.cs or 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
|
||||||
function PlayerNotifyEnabled::OnDamage( %game, %sourceObject )
|
function NBRAssetSound( %game, %sourceObject )
|
||||||
{
|
{
|
||||||
messageClient(%sourceObject.client, 'MsgNoBaseRapeNotify', '~wfx/misc/diagnostic_beep.wav');
|
messageClient(%sourceObject.client, 'MsgNoBaseRapeNotify', '~wfx/misc/diagnostic_beep.wav');
|
||||||
}
|
}
|
||||||
|
|
||||||
//This function is at DefaultGame::gameOver(%game) CTFGame.cs
|
//This function is at DefaultGame::gameOver(%game) CTFGame.cs
|
||||||
//Resets the client NotifyCount when the mission ends
|
//Resets the client NotifyCount when the mission ends
|
||||||
function ResetNotify::MissionEnd( %game, %client )
|
function ResetNBRNotify()
|
||||||
{
|
{
|
||||||
$NoBaseRapeNotifyCount = -1;
|
$NoBaseRapeNotifyCount = -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,65 +2,53 @@
|
||||||
//$Host::EnableTeamBalanceNotify = 1;
|
//$Host::EnableTeamBalanceNotify = 1;
|
||||||
//
|
//
|
||||||
//Give the client a notification on the current state of balancing.
|
//Give the client a notification on the current state of balancing.
|
||||||
//This function is in GetTeamCounts( %game, %client, %respawn ) GetTeamCounts.cs
|
//This function is in GetTeamCounts.cs
|
||||||
function TeamBalanceNotify::AtSpawn( %game, %client, %respawn )
|
function TeamBalanceNotify::AtSpawn( %game, %client, %respawn )
|
||||||
{
|
{
|
||||||
if( $CurrentMissionType !$= "LakRabbit" && $TotalTeamPlayerCount !$= 0 && $Host::EnableTeamBalanceNotify )
|
if( $CurrentMissionType !$= "LakRabbit" && $TotalTeamPlayerCount !$= 0 && $Host::EnableTeamBalanceNotify )
|
||||||
{
|
{
|
||||||
//Call for a GetTeamCount update
|
//variables
|
||||||
//GetTeamCounts( %game, %client, %respawn );
|
|
||||||
|
|
||||||
//evoplayercount does not count yourself
|
%Team1Difference = $PlayerCount[1] - $PlayerCount[2];
|
||||||
|
%Team2Difference = $PlayerCount[2] - $PlayerCount[1];
|
||||||
//variables
|
|
||||||
//%balancedifference = 2; //player difference you want to allow before sending notifications between teams.
|
|
||||||
//%Team1Difference = $PlayerCount[1] - $PlayerCount[2];
|
|
||||||
//%Team2Difference = $PlayerCount[2] - $PlayerCount[1];
|
|
||||||
|
|
||||||
|
|
||||||
//echo ("%Team1Difference " @ %Team1Difference);
|
//echo ("%Team1Difference " @ %Team1Difference);
|
||||||
//echo ("%Team2Difference " @ %Team2Difference);
|
//echo ("%Team2Difference " @ %Team2Difference);
|
||||||
|
|
||||||
|
if( $PlayerCount[1] !$= $PlayerCount[2] )
|
||||||
|
{
|
||||||
|
//Uneven. Reset Balanced.
|
||||||
|
$BalancedMsgPlayed = 0;
|
||||||
|
|
||||||
//Are teams unbalanced?
|
if( %Team1Difference >= 2 || %Team2Difference >= 2 )
|
||||||
if( $PlayerCount[1] !$= $PlayerCount[2] ) {
|
{
|
||||||
//Reset Balanced
|
if( $UnbalancedMsgPlayed !$= 1 && %Team2Difference == 2 || %Team1Difference == 2 )
|
||||||
$BalancedCount = 0;
|
{
|
||||||
if( ($PlayerCount[1] - $PlayerCount[2]) >= 2 || ($PlayerCount[2] - $PlayerCount[1]) >= 2 ) {
|
|
||||||
//Has the client gotten the notification already
|
|
||||||
if($TeamBalanceNotifyCount !$= 1) {
|
|
||||||
//If unbalanced, send a notification. Will continue to send notifications until teams are balanced.
|
|
||||||
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced.');
|
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced.');
|
||||||
//Only get the notification once per spawn.
|
//Once per cycle
|
||||||
$TeamBalanceNotifyCount = 1;
|
$UnbalancedMsgPlayed = 1;
|
||||||
//Reset Stat
|
//Reset Stats.
|
||||||
$StatsBalanceCount = 0;
|
$StatsMsgPlayed = 0;
|
||||||
|
}
|
||||||
|
//Stats Aspect. 3 or more difference gets a stats notify.
|
||||||
|
else if( $StatsMsgPlayed !$= 1 )
|
||||||
|
{
|
||||||
|
messageAll('MsgTeamBalanceNotify', '\c1It is currently %1 vs %2 with %3 observers.', $PlayerCount[1], $PlayerCount[2], $PlayerCount[0] );
|
||||||
|
$StatsMsgPlayed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
//If teams are balanced and teams dont equal 0.
|
||||||
//If teams are balanced and teams dont equal 0.
|
else if( $PlayerCount[1] == $PlayerCount[2] && $TotalTeamPlayerCount !$= 0 && $BalancedMsgPlayed !$= 1 )
|
||||||
if( $PlayerCount[1] == $PlayerCount[2] && $TotalTeamPlayerCount !$= 0 ) {
|
{
|
||||||
//Has the client gotten the notification already
|
messageAll('MsgTeamBalanceNotify', '\c1Teams are balanced.');
|
||||||
if($BalancedCount !$= 1) {
|
//Once per cycle.
|
||||||
//If balanced, send a notification.
|
$BalancedMsgPlayed = 1;
|
||||||
messageAll('MsgTeamBalanceNotify', '\c1Teams are balanced.');
|
//Reset unbalanced.
|
||||||
//Only get the balance notification once.
|
$UnbalancedMsgPlayed = 0;
|
||||||
$BalancedCount = 1;
|
//Reset Stats.
|
||||||
//Reset Unbalanced
|
$StatsMsgPlayed = 0;
|
||||||
$TeamBalanceNotifyCount = 0;
|
|
||||||
//Reset Stat
|
|
||||||
$StatsBalanceCount = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//3 or more difference gets a count notify
|
|
||||||
if( ($PlayerCount[1] - $PlayerCount[2]) >= 3 || ($PlayerCount[2] - $PlayerCount[1]) >= 3 ) {
|
|
||||||
//Run it once
|
|
||||||
if($StatsBalanceCount !$= 1) {
|
|
||||||
messageAll('MsgTeamBalanceNotify', '\c1It is currently %1 vs %2 with %3 observers.', $PlayerCount[1], $PlayerCount[2], $PlayerCount[0] );
|
|
||||||
$StatsBalanceCount = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -69,15 +57,16 @@ function TeamBalanceNotify::AtSpawn( %game, %client, %respawn )
|
||||||
//Allows for another unbalanced notification everytime the flag is capped.
|
//Allows for another unbalanced notification everytime the flag is capped.
|
||||||
function ResetUnbalancedNotifyPerCap()
|
function ResetUnbalancedNotifyPerCap()
|
||||||
{
|
{
|
||||||
$TeamBalanceNotifyCount = 0;
|
$UnbalancedMsgPlayed = 0;
|
||||||
$StatsBalanceCount = 0;
|
$StatsMsgPlayed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reset Notify at defaultgame::gameOver in evo defaultgame.ovl
|
//Reset Notify at defaultgame::gameOver in evo defaultgame.ovl
|
||||||
function ResetTeamBalanceNotifyGameOver( %game ) {
|
function ResetTeamBalanceNotifyGameOver( %game )
|
||||||
//Reset TeamBalance Variables
|
{
|
||||||
$BalancedCount = -1;
|
//Reset All TeamBalance Variables
|
||||||
$TeamBalanceNotifyCount = -1;
|
$BalancedMsgPlayed = -1;
|
||||||
$StatsBalanceCount = -1;
|
$UnbalancedMsgPlayed = -1;
|
||||||
|
$StatsMsgPlayed = -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue