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
5aaa8ee7d0
4 changed files with 179 additions and 28 deletions
|
|
@ -33,6 +33,7 @@ function Autobalance( %game )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$Autobalance::UseAllMode = 0;
|
$Autobalance::UseAllMode = 0;
|
||||||
|
$Autobalance::FallbackTime = "";
|
||||||
%otherTeam = $BigTeam == 1 ? 2 : 1;
|
%otherTeam = $BigTeam == 1 ? 2 : 1;
|
||||||
$Autobalance::AMThreshold = mCeil(MissionGroup.CTF_scoreLimit/3) * 100;
|
$Autobalance::AMThreshold = mCeil(MissionGroup.CTF_scoreLimit/3) * 100;
|
||||||
|
|
||||||
|
|
@ -60,11 +61,14 @@ function Autobalance( %game )
|
||||||
//Select lower half of team rank as canidates for team change
|
//Select lower half of team rank as canidates for team change
|
||||||
if(!$Autobalance::UseAllMode)
|
if(!$Autobalance::UseAllMode)
|
||||||
{
|
{
|
||||||
|
//Reset clients canidate var
|
||||||
|
ResetABClients();
|
||||||
|
|
||||||
$Autobalance::Max = mFloor($TeamRank[$BigTeam, count]/2);
|
$Autobalance::Max = mFloor($TeamRank[$BigTeam, count]/2);
|
||||||
for(%i = $Autobalance::Max; %i < $TeamRank[$BigTeam, count]; %i++)
|
for(%i = $Autobalance::Max; %i < $TeamRank[$BigTeam, count]; %i++)
|
||||||
{
|
{
|
||||||
//echo("[Autobalance]: Selected" SPC $TeamRank[$BigTeam, %i].nameBase @ ", " @ %i);
|
//echo("[Autobalance]: Selected" SPC $TeamRank[$BigTeam, %i].nameBase @ ", " @ %i);
|
||||||
$Autobalance::Canidate[%i] = $TeamRank[$BigTeam, %i];
|
$TeamRank[$BigTeam, %i].abCanidate = true;
|
||||||
}
|
}
|
||||||
%a = " selected";
|
%a = " selected";
|
||||||
}
|
}
|
||||||
|
|
@ -76,18 +80,12 @@ function Autobalance( %game )
|
||||||
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance will switch the next%3 respawning player%2 on Team %1.', $TeamName[$BigTeam], %s, %a);
|
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance will switch the next%3 respawning player%2 on Team %1.', $TeamName[$BigTeam], %s, %a);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if client is a canidate
|
function ResetABClients()
|
||||||
function CheckCanidate(%client)
|
|
||||||
{
|
{
|
||||||
if(!$Autobalance::UseAllMode)
|
for(%i = 0; %i < $TeamRank[$BigTeam, count]; %i++)
|
||||||
{
|
{
|
||||||
for(%i = $Autobalance::Max; %i < $TeamRank[$BigTeam, count]; %i++)
|
$TeamRank[$BigTeam, %i].abCanidate = false;
|
||||||
{
|
|
||||||
if(%client $= $Autobalance::Canidate[%i])
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package Autobalance
|
package Autobalance
|
||||||
|
|
@ -103,13 +101,13 @@ function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %
|
||||||
if($TeamRank[$BigTeam, count] - $TeamRank[%otherTeam, count] >= 2)
|
if($TeamRank[$BigTeam, count] - $TeamRank[%otherTeam, count] >= 2)
|
||||||
{
|
{
|
||||||
%fallback = 0;
|
%fallback = 0;
|
||||||
if($Autobalance::CanidateFallbackTime $= "")
|
if($Autobalance::FallbackTime $= "")
|
||||||
$Autobalance::CanidateFallbackTime = getSimTime();
|
$Autobalance::FallbackTime = getSimTime();
|
||||||
else if((getSimTime() - $Autobalance::CanidateFallbackTime) < $Autobalance::Fallback)
|
else if((getSimTime() - $Autobalance::FallbackTime) < $Autobalance::Fallback)
|
||||||
%fallback = 1;
|
%fallback = 1;
|
||||||
|
|
||||||
//damageType 0: If someone switches to observer or disconnects
|
//damageType 0: If someone switches to observer or disconnects
|
||||||
if(%damageType !$= 0 && (CheckCanidate(%clVictim) || $Autobalance::UseAllMode || %fallback))
|
if(%damageType !$= 0 && (%clVictim.abCanidate || $Autobalance::UseAllMode || %fallback))
|
||||||
{
|
{
|
||||||
echo("[Autobalance]" SPC %clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing. [AM:" @ $Autobalance::UseAllMode SPC "#BT:" @ ($TeamRank[$BigTeam, count]-1) SPC "#OT:" @ ($TeamRank[%otherTeam, count]+1) SPC "FB:" @ %fallback @ "]");
|
echo("[Autobalance]" SPC %clVictim.nameBase @ " has been moved to Team " @ %otherTeam @ " for balancing. [AM:" @ $Autobalance::UseAllMode SPC "#BT:" @ ($TeamRank[$BigTeam, count]-1) SPC "#OT:" @ ($TeamRank[%otherTeam, count]+1) SPC "FB:" @ %fallback @ "]");
|
||||||
messageClient(%clVictim, 'MsgTeamBalanceNotify', '\c0You were switched to Team %1 for balancing.~wfx/powered/vehicle_screen_on.wav', $TeamName[%otherTeam]);
|
messageClient(%clVictim, 'MsgTeamBalanceNotify', '\c0You were switched to Team %1 for balancing.~wfx/powered/vehicle_screen_on.wav', $TeamName[%otherTeam]);
|
||||||
|
|
@ -120,9 +118,9 @@ function DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$BigTeam = "";
|
ResetABClients();
|
||||||
ResetTBNStatus();
|
ResetTBNStatus();
|
||||||
deleteVariables("$Autobalace::Canidate*");
|
$BigTeam = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +131,13 @@ function DefaultGame::gameOver(%game)
|
||||||
|
|
||||||
//Reset Autobalance
|
//Reset Autobalance
|
||||||
$BigTeam = "";
|
$BigTeam = "";
|
||||||
deleteVariables("$Autobalace::Canidate*");
|
|
||||||
|
//Reset all clients canidate var
|
||||||
|
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||||
|
{
|
||||||
|
%client = ClientGroup.getObject(%i);
|
||||||
|
%client.abCanidate = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,35 @@ function suppressTraversalRootPatch()
|
||||||
memPatch("56D114", "90909090909090909090909090909090909090909090");
|
memPatch("56D114", "90909090909090909090909090909090909090909090");
|
||||||
$tvpatched = 1;
|
$tvpatched = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$CmdArmor::Patched)
|
||||||
|
{
|
||||||
|
$CmdArmor::Patched = true;
|
||||||
|
//memPatch("6FC746", "66B8000090906683FE017408ACAA84C075FA89D05F5EC3");
|
||||||
|
memPatch("6FC746", "83FE017408ACAA84C075FA89D05F5EC3");
|
||||||
|
//Removed register size override (cmp si, 1 -> cmp esi, 1) and got rid of
|
||||||
|
//weird NASM garbage code at the beginning. Had a mov ax, 0 which did nothing
|
||||||
|
//and wasn't necessary anyways because of xor eax, eax in the original. It also
|
||||||
|
//generated several NOPs after that for no reason.
|
||||||
|
}
|
||||||
|
|
||||||
|
function serverCmd(%client)
|
||||||
|
{
|
||||||
|
// Stick your own administrative action code here
|
||||||
|
messageAll('msgAll',"\c3" @ %client.namebase SPC "is attempting to crash the server!");
|
||||||
|
|
||||||
|
messageClient(%client, 'onClientBanned', "");
|
||||||
|
messageAllExcept( %client, -1, 'MsgClientDrop', "", %client.name, %client );
|
||||||
|
|
||||||
|
// kill and delete this client
|
||||||
|
if( isObject(%client.player) )
|
||||||
|
%client.player.scriptKill(0);
|
||||||
|
|
||||||
|
if ( isObject( %client ) )
|
||||||
|
{
|
||||||
|
%client.setDisconnectReason("You have been banned for attempting to crash the server.");
|
||||||
|
%client.schedule(700, "delete");
|
||||||
|
}
|
||||||
|
|
||||||
|
BanList::add(%client.guid, %client.getAddress(), $Host::BanTime);
|
||||||
|
}
|
||||||
111
Classic/scripts/autoexec/NoFlagZone.cs
Normal file
111
Classic/scripts/autoexec/NoFlagZone.cs
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
//exec("scripts/autoexec/NoFlagZone.cs");
|
||||||
|
$TurleCampTime = 10000; //10secs
|
||||||
|
|
||||||
|
//Trigger Zone Collision Patch
|
||||||
|
//MemPatch so mines, grenades, and flags
|
||||||
|
//Dont interact with the trigger zone
|
||||||
|
memPatch("604358","0C");
|
||||||
|
|
||||||
|
function CTFGame::onEnterTrigger(%game, %triggerName, %data, %obj, %colobj)
|
||||||
|
{
|
||||||
|
%client = %colobj.client;
|
||||||
|
switch$(%obj.type)
|
||||||
|
{
|
||||||
|
case NOFLAGZONE:
|
||||||
|
if(%client.player.holdingFlag !$= "" && $Host::NoBaseRapePlayerCount > $TotalTeamPlayerCount && %obj.team == %client.team)
|
||||||
|
{
|
||||||
|
//%colobj.throwObject(%colobj.holdingFlag);
|
||||||
|
CTFGame::zoneTossFlag(%game, %colobj, %obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Has issues
|
||||||
|
case TURTLEDAMAGE:
|
||||||
|
if(%client.player.holdingFlag !$= "")
|
||||||
|
{
|
||||||
|
//schedule a warning in 10 seconds
|
||||||
|
%client = %colobj.client;
|
||||||
|
%client.turtledamage = 1;
|
||||||
|
%client.campingThread = %game.schedule($TurleCampTime, "CampingDamage", %client, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function CTFGame::zoneTossFlag(%game, %player, %obj)
|
||||||
|
{
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// z0dd - ZOD - SquirrelOfDeath, 9/27/02. Delay on grabbing flag after tossing it
|
||||||
|
%player.flagTossWait = true;
|
||||||
|
%player.schedule(1000, resetFlagTossWait);
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%client = %player.client;
|
||||||
|
%flag = %player.holdingFlag;
|
||||||
|
%flag.setVelocity("0 0 0");
|
||||||
|
%flag.setTransform(%player.getWorldBoxCenter());
|
||||||
|
%flag.setCollisionTimeout(%player);
|
||||||
|
|
||||||
|
%held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag?
|
||||||
|
|
||||||
|
if($Host::ClassicEvoStats)
|
||||||
|
%game.totalFlagHeldTime[%flag] = 0;
|
||||||
|
|
||||||
|
%game.playerDroppedFlag(%player);
|
||||||
|
|
||||||
|
//Need home to be away from the trigger box location
|
||||||
|
%vec = vectorNormalize(vectorSub(%player.getWorldBoxCenter(),%obj.getWorldBoxCenter()));
|
||||||
|
|
||||||
|
// normalize the vector, scale it, and add an extra "upwards" component
|
||||||
|
%vecNorm = VectorNormalize(%vec);
|
||||||
|
%vec = VectorScale(%vecNorm, 1000);
|
||||||
|
%vec = vectorAdd(%vec, "0 0 300");
|
||||||
|
|
||||||
|
// z0dd - ZOD, 6/09/02. Remove anti-hover so flag can be thrown properly
|
||||||
|
%flag.static = false;
|
||||||
|
|
||||||
|
// z0dd - ZOD, 10/02/02. Hack for flag collision bug.
|
||||||
|
%flag.searchSchedule = %game.schedule(10, "startFlagCollisionSearch", %flag);
|
||||||
|
|
||||||
|
// apply the impulse to the flag object
|
||||||
|
%flag.applyImpulse(%obj.getWorldBoxCenter(), %vec);
|
||||||
|
|
||||||
|
// z0dd - ZOD 3/30/02. Above message was sending the wrong varible to objective hud.
|
||||||
|
messageClient(%player.client, 'MsgCTFFlagDropped', '\c1You are not allowed to have the flag in this area. (Held: %4)~wfx/misc/flag_drop.wav', %client.name, 0, %flag.team, %held); // Yogi, 8/18/02. 3rd param changed 0 -> %client.name
|
||||||
|
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") lost flag (No flag zone)"@" (Held: "@%held@")");
|
||||||
|
}
|
||||||
|
|
||||||
|
function CTFGame::onLeaveTrigger(%game, %triggerName, %data, %obj, %colobj)
|
||||||
|
{
|
||||||
|
%client.turtledamage = 0;
|
||||||
|
%client = %colobj.client;
|
||||||
|
cancel(%client.campingThread);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CTFGame::CampingDamage(%game, %client, %firstWarning)
|
||||||
|
{
|
||||||
|
%player = %client.player;
|
||||||
|
|
||||||
|
if(isEventPending(%client.campingThread))
|
||||||
|
cancel(%client.campingThread);
|
||||||
|
|
||||||
|
//make sure we're still alive...
|
||||||
|
if (!isObject(%player) || %player.getState() $= "Dead")
|
||||||
|
return;
|
||||||
|
|
||||||
|
//if the match hasn't yet started, don't warn or apply damage yet...
|
||||||
|
if (!$MatchStarted)
|
||||||
|
{
|
||||||
|
%client.campingThread = %game.schedule($TurleCampTime / 2, "CampingDamage", %client, true);
|
||||||
|
}
|
||||||
|
else if (%firstWarning)
|
||||||
|
{
|
||||||
|
messageClient(%client, 'MsgHuntersNoCampZone', '\c2No turtling inside the base.', 1);
|
||||||
|
%client.campingThread = %game.schedule($TurleCampTime / 2, "CampingDamage", %client, false);
|
||||||
|
}
|
||||||
|
else if(%client.turtledamage)
|
||||||
|
{
|
||||||
|
%player.setDamageFlash(0.1);
|
||||||
|
%player.damage(0, %player.position, 0.05, $DamageType::NexusCamping);
|
||||||
|
%client.campingThread = %game.schedule(1000, "CampingDamage", %client, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1824,18 +1824,22 @@ function DefaultGame::clientMissionDropReady(%game, %client)
|
||||||
for(%i = 1; %i <= 13; %i++)
|
for(%i = 1; %i <= 13; %i++)
|
||||||
$stats::weapon_damage[%client, %i] = "";
|
$stats::weapon_damage[%client, %i] = "";
|
||||||
|
|
||||||
if(!%client.isAdmin && !$Host::TournamentMode && $Host::KickObserverTimeout)
|
if(%client.team $=0) //Observer only
|
||||||
{
|
{
|
||||||
if(isEventPending(%client.okschedule))
|
if(!%client.isAdmin && !$Host::TournamentMode && $Host::KickObserverTimeout)
|
||||||
cancel(%client.okschedule);
|
{
|
||||||
|
if(isEventPending(%client.okschedule))
|
||||||
|
cancel(%client.okschedule);
|
||||||
|
|
||||||
%minutes = $Host::KickObserverTimeout / 60;
|
%time = ($Host::KickObserverTimeout) + ($Host::KickObserverTimeout/2);
|
||||||
//messageClient(%client, 'MsgNoObservers', '\c2You have %1 minutes to join the game or you will be kicked.', %minutes);
|
//%minutes = %time / 60;
|
||||||
|
//messageClient(%client, 'MsgNoObservers', '\c2You have %1 minutes to join the game or you will be kicked.', %minutes);
|
||||||
|
|
||||||
%key = mFloor(getRandom() * 1000);
|
%key = mFloor(getRandom() * 1000);
|
||||||
%client.okkey = %key;
|
%client.okkey = %key;
|
||||||
|
|
||||||
%client.okschedule = schedule(($Host::KickObserverTimeout * 1000), 0, "cmdAutoKickObserver", %client, %key);
|
%client.okschedule = schedule((%time * 1000), 0, "cmdAutoKickObserver", %client, %key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue