mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-07-13 15:14:34 +00:00
Merge branch 'NoEvo'
This commit is contained in:
commit
bd955124f1
12 changed files with 951 additions and 139 deletions
|
|
@ -367,6 +367,13 @@ function DeactivatePackage(%this)
|
|||
parent::DeactivatePackage(%this);
|
||||
}
|
||||
|
||||
// Prevents clients from being vulnerable to crashing via NULL voice exploit
|
||||
function alxGetWaveLen(%wavFile) {
|
||||
if ( strstr( %wavFile , ".wav" ) == -1 ) return $MaxMessageWavLength + 1;
|
||||
echo("Length check: " @ %wavFile);
|
||||
parent::alxGetWaveLen(%wavFile);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ $AntiPackIncludeShield = 0;
|
|||
function CheckAntiPack( %game )
|
||||
{
|
||||
//CTF only
|
||||
if( $Host::AntiPackEnable && $CurrentMissionType $= "CTF" && !$Host::TournamentMode )
|
||||
if( $Host::AntiPackEnable )
|
||||
{
|
||||
//echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount);
|
||||
//echo("AntiPackPlayerCount " @ $AntiPackPlayerCount);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// How far behind littleTeam must be to use All Mode.
|
||||
// Meaning picking from a pool of all players on the bigTeam instead of just the lowest scoring player.
|
||||
// 400 equals 400 points. 4 caps behind.
|
||||
$AllModeThreshold = 400;
|
||||
$AllModeThreshold = 300;
|
||||
|
||||
|
||||
// Run from TeamBalanceNotify.cs via UnbalancedSound( %game )
|
||||
|
|
@ -28,18 +28,13 @@ function Autobalance( %game, %AutobalanceSafetynetTrys )
|
|||
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
|
||||
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
|
||||
|
||||
//If even, stop.
|
||||
if( %team1difference == 1 || %team2difference == 1 || $TeamRank[1, count] == $TeamRank[2, count] )
|
||||
{
|
||||
//Reset TBN
|
||||
ResetTBNStatus();
|
||||
return;
|
||||
}
|
||||
//Determine bigTeam
|
||||
else if( %team1difference >= 2 )
|
||||
if( %team1difference >= 2 )
|
||||
%bigTeam = 1;
|
||||
else if( %team2difference >= 2 )
|
||||
%bigTeam = 2;
|
||||
else
|
||||
return;
|
||||
|
||||
%littleTeam = ( %bigTeam == 1 ) ? 2 : 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ function CreateServer( %mission, %missionType )
|
|||
{
|
||||
parent::CreateServer( %mission, %missionType );
|
||||
//Call for a GetTeamCount update
|
||||
GetTeamCounts( %game, %client, %respawn );
|
||||
GetTeamCounts(%game);
|
||||
|
||||
// Set when server starts
|
||||
// Used to reset timelimit (if voted) when map changes
|
||||
|
|
@ -37,46 +37,31 @@ function CreateServer( %mission, %missionType )
|
|||
if (!isActivePackage(StartTeamCounts))
|
||||
activatePackage(StartTeamCounts);
|
||||
|
||||
function GetTeamCounts( %game, %client, %respawn )
|
||||
function GetTeamCounts(%game)
|
||||
{
|
||||
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++)
|
||||
//Variables
|
||||
$TotalTeamPlayerCount = $TeamRank[1, count] + $TeamRank[2, count];
|
||||
$AllPlayerCount = $HostGamePlayerCount;
|
||||
|
||||
//echo("$PlayerCount[0] " @ $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]));
|
||||
//echo("$PlayerCount[1] " @ $TeamRank[1, count]);
|
||||
//echo("$PlayerCount[2] " @ $TeamRank[2, count]);
|
||||
|
||||
if( !$Host::TournamentMode )
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
|
||||
//if(!%client.isAIControlled())
|
||||
$PlayerCount[%client.team]++;
|
||||
if( $CurrentMissionType $= "CTF" )
|
||||
{
|
||||
NBRStatusNotify(%game);
|
||||
CheckAntiPack(%game);
|
||||
}
|
||||
TeamBalanceNotify(%game);
|
||||
}
|
||||
|
||||
//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, "CheckAntiPack", %game);
|
||||
|
||||
//Set so counter wont run when it doesnt need to.
|
||||
$GetCountsStatus = "IDLE";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,18 +24,4 @@ function suppressTraversalRootPatch()
|
|||
memPatch("56AD8A", "90909090909090909090909090909090909090909090");
|
||||
memPatch("56D114", "90909090909090909090909090909090909090909090");
|
||||
$tvpatched = 1;
|
||||
}
|
||||
|
||||
// Netrate patch by bahke
|
||||
// 32 packets per second
|
||||
|
||||
$pref::Net::PacketSize = $Host::ClassicPacketSize;
|
||||
|
||||
memPatch("A3A100","5052BA00000000B8000000005150526800000000E8C7D6B4FF5A585981C20100000039C27CE65A58E95F8CB8FF");
|
||||
memPatch("A3A200","5052BA00000000B8000000005150526800000000E8C7D5B4FF5A585981C20100000039C27CE65A58E9FC8AB8FF");
|
||||
memPatch("5C2D22","E9D97447009090");
|
||||
memPatch("5C2D85","E9767347009090");
|
||||
memPatch("0058665C","9090909090909090");
|
||||
memPatch("00586682","90909090909090909090");
|
||||
memPatch("005866AB","90909090909090909090");
|
||||
memPatch("58781A","EB0C");
|
||||
}
|
||||
|
|
@ -1,27 +1,26 @@
|
|||
package NoBaseRape
|
||||
{
|
||||
|
||||
//From Evolution MOD
|
||||
//Modified for our needs
|
||||
// From Evolution MOD
|
||||
// Modified for our needs
|
||||
function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
||||
{
|
||||
//echo( %targetObject.getDataBlock().getClassName() );
|
||||
//echo( %targetObject.getDataBlock().getName() );
|
||||
|
||||
|
||||
%targetname = %targetObject.getDataBlock().getName();
|
||||
|
||||
|
||||
//Used on some maps to make invs invincible
|
||||
if( %targetObject.invincible && %targetname $= "StationInventory" )
|
||||
return;
|
||||
|
||||
|
||||
if(!$Host::TournamentMode && $Host::NoBaseRapeEnabled && $Host::NoBaseRapePlayerCount > $TotalTeamPlayerCount)
|
||||
{
|
||||
{
|
||||
if( %targetname $= "GeneratorLarge" || %targetname $= "StationInventory" || %targetname $= "SolarPanel" )
|
||||
{
|
||||
//Notify only if asset is on other team
|
||||
if( %targetObject.team !$= %sourceObject.team )
|
||||
NBRAssetSound( %game, %sourceObject );
|
||||
|
||||
NBRAssetMessage(%sourceObject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,4 +32,19 @@ function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %pos
|
|||
|
||||
// Prevent package from being activated if it is already
|
||||
if (!isActivePackage(NoBaseRape))
|
||||
activatePackage(NoBaseRape);
|
||||
activatePackage(NoBaseRape);
|
||||
|
||||
|
||||
// Message when a player hits a protected enemy asset
|
||||
function NBRAssetMessage(%sourceObject)
|
||||
{
|
||||
if($CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify )
|
||||
{
|
||||
%timeDif = getSimTime() - %sourceObject.NBRTime;
|
||||
if(%timeDif > 10000 || !%sourceObject.NBRTime)
|
||||
{
|
||||
messageClient(%sourceObject.client, 'MsgNoBaseRapeNotify', '\c2No Base Rape is enabled until %1 players.', $Host::NoBaseRapePlayerCount );
|
||||
%sourceObject.NBRTime = getSimTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// Called in GetTeamCounts.cs
|
||||
function NBRStatusNotify( %game )
|
||||
{
|
||||
if( $CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify && !$Host::TournamentMode && $Host::NoBaseRapeEnabled )
|
||||
if( $Host::EnableNoBaseRapeNotify && $Host::NoBaseRapeEnabled )
|
||||
{
|
||||
//On
|
||||
if( $Host::NoBaseRapePlayerCount > $TotalTeamPlayerCount )
|
||||
|
|
@ -59,22 +59,3 @@ 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::NoBaseRapeEnabled )
|
||||
{
|
||||
messageClient(%sourceObject.client, 'MsgNoBaseRapeNotify', '\c2No Base Rape is enabled until %1 players.', $Host::NoBaseRapePlayerCount );
|
||||
%sourceObject.NBRAssetSoundSchedule = schedule(10000, 0, "ResetNBRAssetSound", %sourceObject );
|
||||
}
|
||||
}
|
||||
// Reset
|
||||
function ResetNBRAssetSound( %sourceObject )
|
||||
{
|
||||
if(isEventPending(%sourceObject.NBRAssetSoundSchedule))
|
||||
cancel(%sourceObject.NBRAssetSoundSchedule);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,27 +12,30 @@
|
|||
|
||||
|
||||
// Called in GetTeamCounts.cs
|
||||
function TeamBalanceNotify( %game, %team1difference, %team2difference )
|
||||
function TeamBalanceNotify(%game)
|
||||
{
|
||||
if( Game.numTeams > 1 && $TotalTeamPlayerCount !$= 0 && !$Host::TournamentMode )
|
||||
if( Game.numTeams > 1 && $TotalTeamPlayerCount !$= 0 )
|
||||
{
|
||||
//echo ("%Team1Difference " @ %Team1Difference);
|
||||
//echo ("%Team2Difference " @ %Team2Difference);
|
||||
|
||||
//Uneven
|
||||
if( $PlayerCount[1] !$= $PlayerCount[2] )
|
||||
if($TeamRank[1, count] !$= $TeamRank[2, count])
|
||||
{
|
||||
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
|
||||
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
|
||||
|
||||
//echo("%Team1Difference " @ %team1difference);
|
||||
//echo("%Team2Difference " @ %team2difference);
|
||||
|
||||
if( %team1difference >= 2 || %team2difference >= 2 ) //Teams are unbalanced
|
||||
{
|
||||
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
|
||||
//Man down. 6vs7, 4vs3 etc
|
||||
$TBNStatus = "UNEVEN";
|
||||
}
|
||||
//Teams are even
|
||||
else if( $PlayerCount[1] == $PlayerCount[2] && $TBNStatus !$= "PLAYEDEVEN" )
|
||||
else if($TeamRank[1, count] == $TeamRank[2, count] && $TBNStatus !$= "PLAYEDEVEN" )
|
||||
$TBNStatus = "EVEN";
|
||||
|
||||
switch$($TBNStatus)
|
||||
|
|
@ -63,49 +66,33 @@ function NotifyUnbalanced( %game )
|
|||
{
|
||||
if(isEventPending($NotifySchedule))
|
||||
cancel($NotifySchedule);
|
||||
|
||||
if( $TBNStatus !$= "NOTIFY" ) //If Status has changed to EVEN or anything else (GameOver reset).
|
||||
return;
|
||||
|
||||
//Difference Variables
|
||||
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
|
||||
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
|
||||
|
||||
if( $TBNStatus $= "NOTIFY" ) //If Status has changed to EVEN or anything else.
|
||||
{
|
||||
//Team Count code by Keen
|
||||
$PlayerCount[0] = 0;
|
||||
$PlayerCount[1] = 0;
|
||||
$PlayerCount[2] = 0;
|
||||
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
if( %team1difference >= 2 || %team2difference >= 2 )
|
||||
{
|
||||
//Autobalance Warning
|
||||
if( $Host::EnableAutobalance )
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
|
||||
//if(!%client.isAIControlled())
|
||||
$PlayerCount[%client.team]++;
|
||||
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance Initializing.~wgui/vote_nopass.wav');
|
||||
$AutoBalanceSchedule = schedule(30000, 0, "Autobalance", %game );
|
||||
}
|
||||
|
||||
//Difference Variables
|
||||
%team1difference = $PlayerCount[1] - $PlayerCount[2];
|
||||
%team2difference = $PlayerCount[2] - $PlayerCount[1];
|
||||
|
||||
if( %team1difference == 1 || %team2difference == 1 || $PlayerCount[1] == $PlayerCount[2] )
|
||||
{
|
||||
ResetTBNStatus();
|
||||
return;
|
||||
}
|
||||
//Continue
|
||||
else if( %team1difference >= 2 || %team2difference >= 2 )
|
||||
{
|
||||
//Autobalance Warning
|
||||
if( $Host::EnableAutobalance )
|
||||
{
|
||||
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance Initializing.~wgui/vote_nopass.wav');
|
||||
$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, "ResetTBNStatus");
|
||||
schedule(15000, 0, "ResetGetCountsStatus");
|
||||
}
|
||||
//If Autobalance is disabled, message only.
|
||||
else if( $Host::EnableTeamBalanceNotify )
|
||||
{
|
||||
%observers = $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]);
|
||||
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0%1 vs %2 with %3 observers.~wgui/vote_nopass.wav', $TeamRank[1, count], $TeamRank[2, count], %observers );
|
||||
schedule(13000, 0, "ResetTBNStatus");
|
||||
schedule(15000, 0, "ResetGetCountsStatus");
|
||||
}
|
||||
}
|
||||
else
|
||||
ResetTBNStatus();
|
||||
}
|
||||
|
||||
// Reset TBNStatus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue