mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-01-20 00:24:49 +00:00
Merge branch 'Dev' into Stable
This commit is contained in:
commit
5e5abc17ab
|
|
@ -495,6 +495,7 @@ function CTFGame::playerTouchEnemyFlag(%game, %player, %flag)
|
||||||
%flag.hide(true);
|
%flag.hide(true);
|
||||||
%flag.startFade(0, 0, false);
|
%flag.startFade(0, 0, false);
|
||||||
%flag.isHome = false;
|
%flag.isHome = false;
|
||||||
|
%flag.setVelocity("0 0 0");
|
||||||
if(%flag.stand)
|
if(%flag.stand)
|
||||||
%flag.stand.getDataBlock().onFlagTaken(%flag.stand);//animate, if exterior stand
|
%flag.stand.getDataBlock().onFlagTaken(%flag.stand);//animate, if exterior stand
|
||||||
|
|
||||||
|
|
@ -1311,7 +1312,7 @@ function CTFGame::awardScoreFlagTouch(%game, %cl, %flag)
|
||||||
//tinman - needed to remove all game calls to "eval" for the PURE server...
|
//tinman - needed to remove all game calls to "eval" for the PURE server...
|
||||||
%game.schedule(%game.TOUCH_DELAY_MS, resetDontScoreTimer, %team);
|
%game.schedule(%game.TOUCH_DELAY_MS, resetDontScoreTimer, %team);
|
||||||
//schedule(%game.TOUCH_DELAY_MS, 0, eval, "$dontScoreTimer["@%team@"] = false;");
|
//schedule(%game.TOUCH_DELAY_MS, 0, eval, "$dontScoreTimer["@%team@"] = false;");
|
||||||
schedule(%game.TOUCH_DELAY_MS, 0, eval, "$dontScoreTimer["@%team@"] = false;");
|
//schedule(%game.TOUCH_DELAY_MS, 0, eval, "$dontScoreTimer["@%team@"] = false;");
|
||||||
$TeamScore[%team] += %game.SCORE_PER_TEAM_FLAG_TOUCH;
|
$TeamScore[%team] += %game.SCORE_PER_TEAM_FLAG_TOUCH;
|
||||||
messageAll('MsgTeamScoreIs', "", %team, $TeamScore[%team]);
|
messageAll('MsgTeamScoreIs', "", %team, $TeamScore[%team]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1915,6 +1915,7 @@ function LakRabbitGame::playerTouchFlag(%game, %player, %flag)
|
||||||
setTargetAlwaysVisMask(%target, 0x7);
|
setTargetAlwaysVisMask(%target, 0x7);
|
||||||
}
|
}
|
||||||
%flag.isHome = false;
|
%flag.isHome = false;
|
||||||
|
%flag.setVelocity("0 0 0");
|
||||||
$flagStatus = %client.name;
|
$flagStatus = %client.name;
|
||||||
|
|
||||||
// borlak -- points for MA flag grabs
|
// borlak -- points for MA flag grabs
|
||||||
|
|
|
||||||
|
|
@ -722,6 +722,7 @@ function SCtFGame::playerTouchEnemyFlag(%game, %player, %flag)
|
||||||
%flag.hide(true);
|
%flag.hide(true);
|
||||||
%flag.startFade(0, 0, false);
|
%flag.startFade(0, 0, false);
|
||||||
%flag.isHome = false;
|
%flag.isHome = false;
|
||||||
|
%flag.setVelocity("0 0 0");
|
||||||
if(%flag.stand)
|
if(%flag.stand)
|
||||||
%flag.stand.getDataBlock().onFlagTaken(%flag.stand);//animate, if exterior stand
|
%flag.stand.getDataBlock().onFlagTaken(%flag.stand);//animate, if exterior stand
|
||||||
|
|
||||||
|
|
@ -1433,7 +1434,7 @@ function SCtFGame::awardScoreFlagTouch(%game, %cl, %flag)
|
||||||
//tinman - needed to remove all game calls to "eval" for the PURE server...
|
//tinman - needed to remove all game calls to "eval" for the PURE server...
|
||||||
%game.schedule(%game.TOUCH_DELAY_MS, resetDontScoreTimer, %team);
|
%game.schedule(%game.TOUCH_DELAY_MS, resetDontScoreTimer, %team);
|
||||||
//schedule(%game.TOUCH_DELAY_MS, 0, eval, "$dontScoreTimer["@%team@"] = false;");
|
//schedule(%game.TOUCH_DELAY_MS, 0, eval, "$dontScoreTimer["@%team@"] = false;");
|
||||||
schedule(%game.TOUCH_DELAY_MS, 0, eval, "$dontScoreTimer["@%team@"] = false;");
|
//schedule(%game.TOUCH_DELAY_MS, 0, eval, "$dontScoreTimer["@%team@"] = false;");
|
||||||
$TeamScore[%team] += %game.SCORE_PER_TEAM_FLAG_TOUCH;
|
$TeamScore[%team] += %game.SCORE_PER_TEAM_FLAG_TOUCH;
|
||||||
messageAll('MsgTeamScoreIs', "", %team, $TeamScore[%team]);
|
messageAll('MsgTeamScoreIs', "", %team, $TeamScore[%team]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
//removed alot of things that were already included in the classic code
|
//removed alot of things that were already included in the classic code
|
||||||
//and checked if evo wasnt double overriding functions
|
//and checked if evo wasnt double overriding functions
|
||||||
|
|
||||||
package AntiLouExploitFixes
|
package AntiLouExploitFixes
|
||||||
{
|
{
|
||||||
|
|
||||||
// MPB INSTANT ENERGY FIX
|
// MPB INSTANT ENERGY FIX
|
||||||
|
|
@ -13,7 +13,7 @@ function VehicleData::onRemove(%this, %obj)
|
||||||
{
|
{
|
||||||
if(%obj.station.isDestroyed)
|
if(%obj.station.isDestroyed)
|
||||||
%obj.station.isDestroyed = 0;
|
%obj.station.isDestroyed = 0;
|
||||||
|
|
||||||
parent::onRemove(%this, %obj);
|
parent::onRemove(%this, %obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ function serverCmdBuyVehicle(%client, %blockName)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
%team = %client.getSensorGroup();
|
%team = %client.getSensorGroup();
|
||||||
if(vehicleCheck(%blockName, %team))
|
if(vehicleCheck(%blockName, %team))
|
||||||
{
|
{
|
||||||
%station = %client.player.station.pad;
|
%station = %client.player.station.pad;
|
||||||
if((%station.ready) && (%station.station.vehicle[%blockName]))
|
if((%station.ready) && (%station.station.vehicle[%blockName]))
|
||||||
|
|
@ -48,7 +48,7 @@ function serverCmdBuyVehicle(%client, %blockName)
|
||||||
InitContainerRadiusSearch(%p, %blockName.checkRadius, %mask);
|
InitContainerRadiusSearch(%p, %blockName.checkRadius, %mask);
|
||||||
|
|
||||||
%clear = 1;
|
%clear = 1;
|
||||||
for(%x = 0; (%obj = containerSearchNext()) != 0; %x++)
|
for(%x = 0; (%obj = containerSearchNext()) != 0; %x++)
|
||||||
{
|
{
|
||||||
if((%obj.getType() & $TypeMasks::VehicleObjectType) && (%obj.getDataBlock().checkIfPlayersMounted(%obj)))
|
if((%obj.getType() & $TypeMasks::VehicleObjectType) && (%obj.getDataBlock().checkIfPlayersMounted(%obj)))
|
||||||
{
|
{
|
||||||
|
|
@ -84,7 +84,7 @@ function serverCmdBuyVehicle(%client, %blockName)
|
||||||
schedule(6500, 0, "resetBuyVehicle", %client);
|
schedule(6500, 0, "resetBuyVehicle", %client);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
MessageClient(%client, "", 'Can\'t create vehicle. A player is on the creation pad.');
|
MessageClient(%client, "", 'Can\'t create vehicle. A player is on the creation pad.');
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
@ -105,87 +105,6 @@ function resetBuyVehicle(%client)
|
||||||
// END VEHICLE STATION SPAM FIX
|
// END VEHICLE STATION SPAM FIX
|
||||||
|
|
||||||
|
|
||||||
// ShapeBase::throwObject(%this,%obj)
|
|
||||||
// Info: Delay on calculating flag stats
|
|
||||||
function ShapeBase::throwObject(%this,%obj)
|
|
||||||
{
|
|
||||||
//------------------------------------------------------------------
|
|
||||||
// z0dd - ZOD, 4/15/02. Allow respawn switching during tourney wait.
|
|
||||||
if(!$MatchStarted && $Host::TournamentMode) //Added Tourney check
|
|
||||||
return;
|
|
||||||
//------------------------------------------------------------------
|
|
||||||
|
|
||||||
// z0dd - ZOD, 5/26/02. Remove anti-hover so flag can be thrown properly
|
|
||||||
if(%obj.getDataBlock().getName() $= "Flag")
|
|
||||||
{
|
|
||||||
%obj.static = false;
|
|
||||||
// z0dd - ZOD - SquirrelOfDeath, 10/02/02. Hack for flag collision bug.
|
|
||||||
if(Game.Class $= CTFGame || Game.Class $= PracticeCTFGame || Game.Class $= SCtFGame)
|
|
||||||
%obj.searchSchedule = Game.schedule(10, "startFlagCollisionSearch", %obj);
|
|
||||||
}
|
|
||||||
//------------------------------------------------------------------
|
|
||||||
|
|
||||||
%srcCorpse = (%this.getState() $= "Dead"); // z0dd - ZOD, 4/14/02. Flag tossed from corpse
|
|
||||||
//if the object is being thrown by a corpse, use a random vector
|
|
||||||
if (%srcCorpse && %obj.getDataBlock().getName() !$= "Flag") // z0dd - ZOD, 4/14/02. Except for flags..
|
|
||||||
{
|
|
||||||
%vec = (-1.0 + getRandom() * 2.0) SPC (-1.0 + getRandom() * 2.0) SPC getRandom();
|
|
||||||
%vec = vectorScale(%vec, 10);
|
|
||||||
}
|
|
||||||
else // else Initial vel based on the dir the player is looking
|
|
||||||
{
|
|
||||||
%eye = %this.getEyeVector();
|
|
||||||
%vec = vectorScale(%eye, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a vertical component to give the item a better arc
|
|
||||||
%dot = vectorDot("0 0 1",%eye);
|
|
||||||
if (%dot < 0)
|
|
||||||
%dot = -%dot;
|
|
||||||
%vec = vectorAdd(%vec,vectorScale("0 0 12",1 - %dot)); // z0dd - ZOD, 9/10/02. 10 was 8
|
|
||||||
|
|
||||||
// Add player's velocity
|
|
||||||
%vec = vectorAdd(%vec,%this.getVelocity());
|
|
||||||
%pos = getBoxCenter(%this.getWorldBox());
|
|
||||||
|
|
||||||
//since flags have a huge mass (so when you shoot them, they don't bounce too far)
|
|
||||||
//we need to up the %vec so that you can still throw them...
|
|
||||||
if (%obj.getDataBlock().getName() $= "Flag")
|
|
||||||
{
|
|
||||||
%vec = vectorScale(%vec, (%srcCorpse ? 40 : 75)); // z0dd - ZOD, 4/14/02. Throw flag force. Value was 40
|
|
||||||
// ------------------------------------------------------------
|
|
||||||
// z0dd - ZOD, 9/27/02. Delay on grabbing flag after tossing it
|
|
||||||
%this.flagTossWait = true;
|
|
||||||
%this.schedule(1000, resetFlagTossWait);
|
|
||||||
// ------------------------------------------------------------
|
|
||||||
|
|
||||||
// Delay on calculating stats
|
|
||||||
%this.flagStatsWait = true;
|
|
||||||
%this.schedule(5000, resetFlagStatsWait);
|
|
||||||
// ------------------------------------------------------------
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
%obj.setTransform(%pos);
|
|
||||||
%obj.applyImpulse(%pos,%vec);
|
|
||||||
%obj.setCollisionTimeout(%this);
|
|
||||||
%data = %obj.getDatablock();
|
|
||||||
|
|
||||||
%data.onThrow(%obj,%this);
|
|
||||||
|
|
||||||
//call the AI hook
|
|
||||||
AIThrowObject(%obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Player::resetFlagStatsWait(%this)
|
|
||||||
// Info: Delay on calculating the stats
|
|
||||||
function Player::resetFlagStatsWait(%this)
|
|
||||||
{
|
|
||||||
%this.flagStatsWait = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Fix for observer vehicle bug, where observers are drawn to
|
// Fix for observer vehicle bug, where observers are drawn to
|
||||||
// a vehicle no matter whether they are observing the client or not
|
// a vehicle no matter whether they are observing the client or not
|
||||||
// Thanks to MT for pointing out.
|
// Thanks to MT for pointing out.
|
||||||
|
|
@ -225,7 +144,7 @@ function resetObserveFollow( %client, %dismount )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
%client.observers[%i].camera.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 ));
|
%client.observers[%i].camera.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -329,7 +248,7 @@ function Armor::onMount(%this,%obj,%vehicle,%node)
|
||||||
%vehicle.lastPilot = %obj;
|
%vehicle.lastPilot = %obj;
|
||||||
%obj.lastVehicle = %vehicle;
|
%obj.lastVehicle = %vehicle;
|
||||||
if((%vehicle.getTarget() != -1) && %vehicle.getDatablock().cantTeamSwitch $= "")
|
if((%vehicle.getTarget() != -1) && %vehicle.getDatablock().cantTeamSwitch $= "")
|
||||||
{
|
{
|
||||||
setTargetSensorGroup(%vehicle.getTarget(), %obj.client.getSensorGroup());
|
setTargetSensorGroup(%vehicle.getTarget(), %obj.client.getSensorGroup());
|
||||||
if( %vehicle.turretObject > 0 ) setTargetSensorGroup(%vehicle.turretObject.getTarget(), %obj.client.getSensorGroup());
|
if( %vehicle.turretObject > 0 ) setTargetSensorGroup(%vehicle.turretObject.getTarget(), %obj.client.getSensorGroup());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,30 +15,28 @@ $AntiPackIncludeShield = 0;
|
||||||
|
|
||||||
|
|
||||||
// Called in GetCounts.cs
|
// Called in GetCounts.cs
|
||||||
function CheckAntiPack( %game )
|
function CheckAntiPack(%game)
|
||||||
{
|
{
|
||||||
//CTF only
|
if($Host::AntiPackEnable)
|
||||||
if( $Host::AntiPackEnable )
|
|
||||||
{
|
{
|
||||||
//echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount);
|
//echo("TotalTeamPlayerCount " @ $TotalTeamPlayerCount);
|
||||||
//echo("AntiPackPlayerCount " @ $AntiPackPlayerCount);
|
//echo("AntiPackPlayerCount " @ $Host::AntiPackPlayerCount);
|
||||||
|
|
||||||
if( $TotalTeamPlayerCount < $Host::AntiPackPlayerCount )
|
if($TotalTeamPlayerCount < $Host::AntiPackPlayerCount)
|
||||||
{
|
{
|
||||||
if( $AntiPackStatus !$= "ACTIVEON" )
|
if($AntiPackStatus !$= "ACTIVEON")
|
||||||
$AntiPackStatus = "ON";
|
$AntiPackStatus = "ON";
|
||||||
}
|
}
|
||||||
//Off
|
//Off
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( $AntiPackStatus !$= "ACTIVEOFF" )
|
if($AntiPackStatus !$= "ACTIVEOFF")
|
||||||
$AntiPackStatus = "OFF";
|
$AntiPackStatus = "OFF";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//All other cases outside of CTF
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( $AntiPackStatus !$= "ACTIVEOFF" )
|
if($AntiPackStatus !$= "ACTIVEOFF")
|
||||||
$AntiPackStatus = "OFF";
|
$AntiPackStatus = "OFF";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,9 +64,9 @@ function CheckAntiPack( %game )
|
||||||
if(isActivePackage(AntiPackShield))
|
if(isActivePackage(AntiPackShield))
|
||||||
deactivatePackage(AntiPackShield);
|
deactivatePackage(AntiPackShield);
|
||||||
$AntiPackStatus = "ACTIVEOFF";
|
$AntiPackStatus = "ACTIVEOFF";
|
||||||
case ACTIVEON:
|
case ACTIVEON:
|
||||||
//Do Nothing
|
//Do Nothing
|
||||||
case ACTIVEOFF:
|
case ACTIVEOFF:
|
||||||
//Do Nothing
|
//Do Nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -80,12 +78,12 @@ package AntiPackCloak
|
||||||
function CloakingPackImage::onActivate(%data, %obj, %slot)
|
function CloakingPackImage::onActivate(%data, %obj, %slot)
|
||||||
{
|
{
|
||||||
if(%obj.reCloak !$= "")
|
if(%obj.reCloak !$= "")
|
||||||
{
|
{
|
||||||
Cancel(%obj.reCloak);
|
Cancel(%obj.reCloak);
|
||||||
%obj.reCloak = "";
|
%obj.reCloak = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(%obj.client.armor $= "Light")
|
if(%obj.client.armor $= "Light")
|
||||||
{
|
{
|
||||||
// can the player currently cloak (function returns "true" or reason for failure)?
|
// can the player currently cloak (function returns "true" or reason for failure)?
|
||||||
if(%obj.canCloak() $= "true")
|
if(%obj.canCloak() $= "true")
|
||||||
|
|
@ -94,7 +92,7 @@ function CloakingPackImage::onActivate(%data, %obj, %slot)
|
||||||
{
|
{
|
||||||
// cancel recloak thread
|
// cancel recloak thread
|
||||||
if(%obj.reCloak !$= "")
|
if(%obj.reCloak !$= "")
|
||||||
{
|
{
|
||||||
Cancel(%obj.reCloak);
|
Cancel(%obj.reCloak);
|
||||||
%obj.reCloak = "";
|
%obj.reCloak = "";
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +109,7 @@ function CloakingPackImage::onActivate(%data, %obj, %slot)
|
||||||
%obj.setImageTrigger(%slot, false);
|
%obj.setImageTrigger(%slot, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// hopefully avoid some loopholes
|
// hopefully avoid some loopholes
|
||||||
messageClient(%obj.client, 'MsgCloakingPackInvalid', '\c2Cloaking available for light armors only.');
|
messageClient(%obj.client, 'MsgCloakingPackInvalid', '\c2Cloaking available for light armors only.');
|
||||||
|
|
@ -146,20 +144,17 @@ function DefaultGame::gameOver(%game)
|
||||||
{
|
{
|
||||||
Parent::gameOver(%game);
|
Parent::gameOver(%game);
|
||||||
|
|
||||||
if( $Host::AntiPackEnable )
|
if($InvBanList[CTF, "CloakingPack"])
|
||||||
{
|
$InvBanList[CTF, "CloakingPack"] = 0;
|
||||||
if($InvBanList[CTF, "CloakingPack"])
|
if(isActivePackage(AntiPackCloak))
|
||||||
$InvBanList[CTF, "CloakingPack"] = 0;
|
deactivatePackage(AntiPackCloak);
|
||||||
if(isActivePackage(AntiPackCloak))
|
|
||||||
deactivatePackage(AntiPackCloak);
|
|
||||||
|
|
||||||
if($InvBanList[CTF, "ShieldPack"])
|
if($InvBanList[CTF, "ShieldPack"])
|
||||||
$InvBanList[CTF, "ShieldPack"] = 0;
|
$InvBanList[CTF, "ShieldPack"] = 0;
|
||||||
if(isActivePackage(AntiPackShield))
|
if(isActivePackage(AntiPackShield))
|
||||||
deactivatePackage(AntiPackShield);
|
deactivatePackage(AntiPackShield);
|
||||||
|
|
||||||
$AntiPackStatus = "OFF";
|
$AntiPackStatus = "OFF";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -55,3 +55,6 @@ function serverCmd(%client)
|
||||||
|
|
||||||
//Show Linux Icon in server list
|
//Show Linux Icon in server list
|
||||||
//memPatch("5C9628","80CB05");
|
//memPatch("5C9628","80CB05");
|
||||||
|
|
||||||
|
//Bahke MPB stability fix
|
||||||
|
memPatch("614120","9090");
|
||||||
|
|
@ -16,51 +16,53 @@
|
||||||
// Message Content
|
// Message Content
|
||||||
// $Host::MapChangeMSGContent = "<color:3cb4b4><font:Sui Generis:22>Pickup Night\n<color:3cb4b4><font:Univers:18>Saturday, March 5th\n<color:3cb4b4><font:Univers:16>Join discord for details";
|
// $Host::MapChangeMSGContent = "<color:3cb4b4><font:Sui Generis:22>Pickup Night\n<color:3cb4b4><font:Univers:18>Saturday, March 5th\n<color:3cb4b4><font:Univers:16>Join discord for details";
|
||||||
|
|
||||||
|
//exec("scripts/autoexec/missiontypeoptions.cs");
|
||||||
package MissionTypeOptions
|
package MissionTypeOptions
|
||||||
{
|
{
|
||||||
|
|
||||||
function loadMissionStage2()
|
function loadMissionStage2()
|
||||||
{
|
{
|
||||||
switch$($Host::PUGpasswordAlwaysOn)
|
//Disable Tournament Mode for Lak
|
||||||
|
if($CurrentMissionType $= "Lakrabbit" || $CurrentMissionType $= "DM" || $CurrentMissionType $= "PracticeCTF")
|
||||||
{
|
{
|
||||||
case 0:
|
if($Host::TournamentMode)
|
||||||
if($CurrentMissionType !$= "LakRabbit")
|
$Host::TournamentMode = 0;
|
||||||
{
|
|
||||||
if($Host::TournamentMode && $Host::PUGautoPassword)
|
|
||||||
$Host::Password = $Host::PUGPassword;
|
|
||||||
|
|
||||||
//Set server mode to SPEED
|
|
||||||
$Host::HiVisibility = 0;
|
|
||||||
}
|
|
||||||
else if($CurrentMissionType $= "LakRabbit")
|
|
||||||
{
|
|
||||||
if($Host::TournamentMode)
|
|
||||||
$Host::TournamentMode = 0;
|
|
||||||
|
|
||||||
//Set server mode to DISTANCE
|
|
||||||
$Host::HiVisibility = 1;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
$Host::Password = $Host::PUGPassword;
|
|
||||||
$Host::HiVisibility = 0; //always SPEED
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//PUGpassword
|
||||||
|
if($Host::PUGpasswordAlwaysOn) //ON
|
||||||
|
$Host::Password = $Host::PUGPassword;
|
||||||
|
|
||||||
|
//Set Visibility
|
||||||
|
if($CurrentMissionType $= "Lakrabbit")
|
||||||
|
{
|
||||||
|
//Set server mode to DISTANCE
|
||||||
|
$Host::HiVisibility = 1; //Lakrabbit
|
||||||
|
}
|
||||||
|
else //Set server mode to SPEED for CTF/SCTF/Anything Else
|
||||||
|
$Host::HiVisibility = 0;
|
||||||
|
|
||||||
|
//Tournament Mode specifics
|
||||||
if($Host::TournamentMode)
|
if($Host::TournamentMode)
|
||||||
$Host::TimeLimit = 30; //TimeLimit Always 30 minutes in Tourney Mode
|
$Host::TimeLimit = 30; //TimeLimit Always 30 minutes in Tourney Mode
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Disable everything
|
//Disable if active
|
||||||
if($Host::Password !$= "")
|
|
||||||
$Host::Password = "";
|
|
||||||
if($LockedTeams)
|
if($LockedTeams)
|
||||||
$LockedTeams = 0;
|
$LockedTeams = 0;
|
||||||
|
if(isActivePackage(LockedTeams) && !$LockedTeams)
|
||||||
|
deactivatePackage(LockedTeams);
|
||||||
|
|
||||||
|
//Disable if active
|
||||||
|
if($Host::Password !$= "" && !$Host::PUGpasswordAlwaysOn) //No Password
|
||||||
|
$Host::Password = "";
|
||||||
|
|
||||||
|
//Disable if active
|
||||||
if($RestrictedVoting)
|
if($RestrictedVoting)
|
||||||
$RestrictedVoting = 0;
|
$RestrictedVoting = 0;
|
||||||
if($Host::AllowAdmin2Admin)
|
if($Host::AllowAdmin2Admin)
|
||||||
$Host::AllowAdmin2Admin = 0;
|
$Host::AllowAdmin2Admin = 0;
|
||||||
}
|
}
|
||||||
if(isActivePackage(LockedTeams) && !$LockedTeams)
|
|
||||||
deactivatePackage(LockedTeams);
|
|
||||||
|
|
||||||
//Siege NoBaseRape Fix
|
//Siege NoBaseRape Fix
|
||||||
if($CurrentMissionType $= "Siege")
|
if($CurrentMissionType $= "Siege")
|
||||||
|
|
@ -75,7 +77,7 @@ function loadMissionStage2()
|
||||||
centerPrintAll($Host::MapChangeMSGContent, 12, 3);
|
centerPrintAll($Host::MapChangeMSGContent, 12, 3);
|
||||||
|
|
||||||
//Set random seed
|
//Set random seed
|
||||||
setRandomSeed(getrandom(1,200000));
|
setRandomSeed(getrandom(1,1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -339,3 +339,14 @@ function ShapeBase::throwWeapon(%this)
|
||||||
// Prevent package from being activated if it is already
|
// Prevent package from being activated if it is already
|
||||||
if (!isActivePackage(TacoOverrides))
|
if (!isActivePackage(TacoOverrides))
|
||||||
activatePackage(TacoOverrides);
|
activatePackage(TacoOverrides);
|
||||||
|
|
||||||
|
//Flag explosion fix
|
||||||
|
// function Item::applyImpulse(%this, %position, %impulseVec)
|
||||||
|
// {
|
||||||
|
// %data = %this.getDatablock();
|
||||||
|
// %x = getWord(%impulseVec, 0) / %data.mass;
|
||||||
|
// %y = getWord(%impulseVec, 1) / %data.mass;
|
||||||
|
// %z = getWord(%impulseVec, 2) / %data.mass;
|
||||||
|
// %vel = %x SPC %y SPC %z;
|
||||||
|
// %this.setVelocity(vectorAdd(%this.getVelocity(), %vel));
|
||||||
|
// }
|
||||||
|
|
@ -18,9 +18,9 @@ $GetCountsStatus = "UPDATE";
|
||||||
package StartTeamCounts
|
package StartTeamCounts
|
||||||
{
|
{
|
||||||
|
|
||||||
function CreateServer( %mission, %missionType )
|
function CreateServer(%mission, %missionType)
|
||||||
{
|
{
|
||||||
parent::CreateServer( %mission, %missionType );
|
parent::CreateServer(%mission, %missionType);
|
||||||
//Call for a GetTeamCount update
|
//Call for a GetTeamCount update
|
||||||
GetTeamCounts(%game);
|
GetTeamCounts(%game);
|
||||||
|
|
||||||
|
|
@ -37,40 +37,36 @@ if (!isActivePackage(StartTeamCounts))
|
||||||
|
|
||||||
function GetTeamCounts(%game)
|
function GetTeamCounts(%game)
|
||||||
{
|
{
|
||||||
switch$($GetCountsStatus)
|
if($GetCountsStatus)
|
||||||
{
|
{
|
||||||
case UPDATE:
|
if($countdownStarted && $MatchStarted)
|
||||||
if($countdownStarted && $MatchStarted )
|
{
|
||||||
|
//Variables
|
||||||
|
$TotalTeamPlayerCount = $TeamRank[1, count] + $TeamRank[2, count];
|
||||||
|
$AllPlayerCount = $HostGamePlayerCount;
|
||||||
|
|
||||||
|
//Observers
|
||||||
|
$Observers = $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]);
|
||||||
|
|
||||||
|
//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)
|
||||||
{
|
{
|
||||||
//Variables
|
if($CurrentMissionType $= "CTF") //No SCtF
|
||||||
$TotalTeamPlayerCount = $TeamRank[1, count] + $TeamRank[2, count];
|
NBRStatusNotify(%game); //Base Rape
|
||||||
$AllPlayerCount = $HostGamePlayerCount;
|
|
||||||
|
|
||||||
//Observers
|
if($CurrentMissionType $= "CTF" || $CurrentMissionType $= "DM")
|
||||||
$Observers = $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]);
|
CheckAntiPack(%game); //Limit certain packs with low numbers
|
||||||
|
|
||||||
//echo("$PlayerCount[0] " @ $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]));
|
if(Game.numTeams > 1)
|
||||||
//echo("$PlayerCount[1] " @ $TeamRank[1, count]);
|
TeamBalanceNotify(%game); //Team Balance
|
||||||
//echo("$PlayerCount[2] " @ $TeamRank[2, count]);
|
|
||||||
|
|
||||||
if( !$Host::TournamentMode )
|
|
||||||
{
|
|
||||||
if($CurrentMissionType $= "CTF")
|
|
||||||
{
|
|
||||||
NBRStatusNotify(%game);
|
|
||||||
CheckAntiPack(%game);
|
|
||||||
}
|
|
||||||
else if($CurrentMissionType $= "DM")
|
|
||||||
CheckAntiPack(%game);
|
|
||||||
|
|
||||||
TeamBalanceNotify(%game); //Has check for # teams
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set so counter wont run when it doesnt need to.
|
|
||||||
$GetCountsStatus = "IDLE";
|
|
||||||
}
|
}
|
||||||
case IDLE:
|
|
||||||
//Do Nothing
|
//Set so counter wont run when it doesnt need to.
|
||||||
|
$GetCountsStatus = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isEventPending($GetCountsSchedule))
|
if(isEventPending($GetCountsSchedule))
|
||||||
|
|
@ -81,12 +77,6 @@ function GetTeamCounts(%game)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Triggers a Full run
|
|
||||||
function ResetGetCountsStatus()
|
|
||||||
{
|
|
||||||
$GetCountsStatus = "UPDATE";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Proper Overrides
|
// Proper Overrides
|
||||||
// Events that determine a TeamGetCounts update
|
// Events that determine a TeamGetCounts update
|
||||||
package TeamCountsTriggers
|
package TeamCountsTriggers
|
||||||
|
|
@ -97,7 +87,7 @@ function DefaultGame::clientJoinTeam( %game, %client, %team, %respawn )
|
||||||
Parent::clientJoinTeam( %game, %client, %team, %respawn );
|
Parent::clientJoinTeam( %game, %client, %team, %respawn );
|
||||||
|
|
||||||
//Trigger GetCounts
|
//Trigger GetCounts
|
||||||
ResetGetCountsStatus();
|
$GetCountsStatus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned)
|
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned)
|
||||||
|
|
@ -105,7 +95,7 @@ function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawn
|
||||||
Parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned);
|
Parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned);
|
||||||
|
|
||||||
//Trigger GetCounts
|
//Trigger GetCounts
|
||||||
ResetGetCountsStatus();
|
$GetCountsStatus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DefaultGame::assignClientTeam(%game, %client, %respawn )
|
function DefaultGame::assignClientTeam(%game, %client, %respawn )
|
||||||
|
|
@ -113,7 +103,7 @@ function DefaultGame::assignClientTeam(%game, %client, %respawn )
|
||||||
Parent::assignClientTeam(%game, %client, %respawn );
|
Parent::assignClientTeam(%game, %client, %respawn );
|
||||||
|
|
||||||
//Trigger GetCounts
|
//Trigger GetCounts
|
||||||
ResetGetCountsStatus();
|
$GetCountsStatus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DefaultGame::onClientEnterObserverMode( %game, %client )
|
function DefaultGame::onClientEnterObserverMode( %game, %client )
|
||||||
|
|
@ -121,7 +111,7 @@ function DefaultGame::onClientEnterObserverMode( %game, %client )
|
||||||
Parent::onClientEnterObserverMode( %game, %client );
|
Parent::onClientEnterObserverMode( %game, %client );
|
||||||
|
|
||||||
//Trigger GetCounts
|
//Trigger GetCounts
|
||||||
ResetGetCountsStatus();
|
$GetCountsStatus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
|
function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
|
||||||
|
|
@ -129,7 +119,7 @@ function DefaultGame::AIChangeTeam(%game, %client, %newTeam)
|
||||||
Parent::AIChangeTeam(%game, %client, %newTeam);
|
Parent::AIChangeTeam(%game, %client, %newTeam);
|
||||||
|
|
||||||
//Trigger GetCounts
|
//Trigger GetCounts
|
||||||
ResetGetCountsStatus();
|
$GetCountsStatus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch)
|
function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch)
|
||||||
|
|
@ -137,7 +127,7 @@ function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %
|
||||||
Parent::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch);
|
Parent::onConnect(%client, %name, %raceGender, %skin, %voice, %voicePitch);
|
||||||
|
|
||||||
//Reset GetCounts
|
//Reset GetCounts
|
||||||
ResetGetCountsStatus();
|
$GetCountsStatus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DefaultGame::gameOver(%game)
|
function DefaultGame::gameOver(%game)
|
||||||
|
|
@ -145,7 +135,7 @@ function DefaultGame::gameOver(%game)
|
||||||
Parent::gameOver(%game);
|
Parent::gameOver(%game);
|
||||||
|
|
||||||
//Reset GetCounts
|
//Reset GetCounts
|
||||||
ResetGetCountsStatus();
|
$GetCountsStatus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function GameConnection::onDrop(%client, %reason)
|
function GameConnection::onDrop(%client, %reason)
|
||||||
|
|
@ -153,11 +143,18 @@ function GameConnection::onDrop(%client, %reason)
|
||||||
Parent::onDrop(%client, %reason);
|
Parent::onDrop(%client, %reason);
|
||||||
|
|
||||||
//Reset GetCounts
|
//Reset GetCounts
|
||||||
ResetGetCountsStatus();
|
$GetCountsStatus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Reset GetCounts thru function
|
||||||
|
function ResetGetCountsStatus()
|
||||||
|
{
|
||||||
|
//Reset GetCounts
|
||||||
|
$GetCountsStatus = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Team Balance Notify Script
|
// Team Balance Notify Script
|
||||||
//
|
//
|
||||||
|
|
@ -178,10 +175,9 @@ function TeamBalanceNotify(%game)
|
||||||
if(!$Host::EnableTeamBalanceNotify && !$Host::EnableAutobalance)
|
if(!$Host::EnableTeamBalanceNotify && !$Host::EnableAutobalance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( Game.numTeams > 1 && $TotalTeamPlayerCount !$= 0 )
|
if($TotalTeamPlayerCount !$= 0)
|
||||||
{
|
{
|
||||||
//Uneven
|
if($TeamRank[1, count] !$= $TeamRank[2, count]) //Uneven
|
||||||
if($TeamRank[1, count] !$= $TeamRank[2, count])
|
|
||||||
{
|
{
|
||||||
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
|
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
|
||||||
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
|
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
|
||||||
|
|
@ -198,8 +194,7 @@ function TeamBalanceNotify(%game)
|
||||||
//Man down. 6vs7, 4vs3 etc
|
//Man down. 6vs7, 4vs3 etc
|
||||||
$TBNStatus = "UNEVEN";
|
$TBNStatus = "UNEVEN";
|
||||||
}
|
}
|
||||||
//Teams are even
|
else if($TeamRank[1, count] == $TeamRank[2, count] && $TBNStatus !$= "PLAYEDEVEN") //Teams are even
|
||||||
else if($TeamRank[1, count] == $TeamRank[2, count] && $TBNStatus !$= "PLAYEDEVEN" )
|
|
||||||
$TBNStatus = "EVEN";
|
$TBNStatus = "EVEN";
|
||||||
|
|
||||||
switch$($TBNStatus)
|
switch$($TBNStatus)
|
||||||
|
|
@ -226,7 +221,7 @@ function TeamBalanceNotify(%game)
|
||||||
|
|
||||||
//Check to see if teams are still unbalanced
|
//Check to see if teams are still unbalanced
|
||||||
//Fire AutoBalance in 30 sec if enabled
|
//Fire AutoBalance in 30 sec if enabled
|
||||||
function NotifyUnbalanced( %game )
|
function NotifyUnbalanced(%game)
|
||||||
{
|
{
|
||||||
if(isEventPending($NotifySchedule))
|
if(isEventPending($NotifySchedule))
|
||||||
cancel($NotifySchedule);
|
cancel($NotifySchedule);
|
||||||
|
|
@ -234,23 +229,23 @@ function NotifyUnbalanced( %game )
|
||||||
if(!$Host::EnableTeamBalanceNotify && !$Host::EnableAutobalance)
|
if(!$Host::EnableTeamBalanceNotify && !$Host::EnableAutobalance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( $TBNStatus !$= "NOTIFY" ) //If Status has changed to EVEN or anything else (GameOver reset).
|
if($TBNStatus !$= "NOTIFY") //If Status has changed to EVEN or anything else (GameOver reset).
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Difference Variables
|
//Difference Variables
|
||||||
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
|
%team1difference = $TeamRank[1, count] - $TeamRank[2, count];
|
||||||
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
|
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
|
||||||
|
|
||||||
if( %team1difference >= 2 || %team2difference >= 2 )
|
if(%team1difference >= 2 || %team2difference >= 2)
|
||||||
{
|
{
|
||||||
//Autobalance Warning
|
//Autobalance Warning
|
||||||
if( $Host::EnableAutobalance )
|
if($Host::EnableAutobalance)
|
||||||
{
|
{
|
||||||
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance Initializing.~wgui/vote_nopass.wav');
|
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0Autobalance Initializing.~wgui/vote_nopass.wav');
|
||||||
$AutoBalanceSchedule = schedule(30000, 0, "Autobalance", %game );
|
$AutoBalanceSchedule = schedule(30000, 0, "Autobalance", %game );
|
||||||
}
|
}
|
||||||
//If Autobalance is disabled, message only.
|
//If Autobalance is disabled, message only.
|
||||||
else if( $Host::EnableTeamBalanceNotify )
|
else if($Host::EnableTeamBalanceNotify)
|
||||||
{
|
{
|
||||||
%observers = $HostGamePlayerCount - ($TeamRank[1, count] + $TeamRank[2, count]);
|
%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 );
|
messageAll('MsgTeamBalanceNotify', '\c1Teams are unbalanced: \c0%1 vs %2 with %3 observers.~wgui/vote_nopass.wav', $TeamRank[1, count], $TeamRank[2, count], %observers );
|
||||||
|
|
@ -296,20 +291,20 @@ if (!isActivePackage(ResetTBNGameOver))
|
||||||
//
|
//
|
||||||
|
|
||||||
// Called in GetTeamCounts.cs
|
// Called in GetTeamCounts.cs
|
||||||
function NBRStatusNotify( %game )
|
function NBRStatusNotify(%game)
|
||||||
{
|
{
|
||||||
if( $Host::EnableNoBaseRapeNotify && $Host::NoBaseRapeEnabled )
|
if($Host::EnableNoBaseRapeNotify && $Host::NoBaseRapeEnabled)
|
||||||
{
|
{
|
||||||
//On
|
//On
|
||||||
if( $Host::NoBaseRapePlayerCount > $TotalTeamPlayerCount )
|
if($Host::NoBaseRapePlayerCount > $TotalTeamPlayerCount)
|
||||||
{
|
{
|
||||||
if( $NBRStatus !$= "PLAYEDON" )
|
if($NBRStatus !$= "PLAYEDON")
|
||||||
$NBRStatus = "ON";
|
$NBRStatus = "ON";
|
||||||
}
|
}
|
||||||
//Off
|
//Off
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( $NBRStatus !$= "PLAYEDOFF" )
|
if($NBRStatus !$= "PLAYEDOFF")
|
||||||
$NBRStatus = "OFF";
|
$NBRStatus = "OFF";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -361,7 +356,7 @@ if (!isActivePackage(ResetNBRNotify))
|
||||||
//
|
//
|
||||||
|
|
||||||
// Run from TeamBalanceNotify via NotifyUnbalanced
|
// Run from TeamBalanceNotify via NotifyUnbalanced
|
||||||
function Autobalance( %game )
|
function Autobalance(%game)
|
||||||
{
|
{
|
||||||
if(isEventPending($AutoBalanceSchedule))
|
if(isEventPending($AutoBalanceSchedule))
|
||||||
cancel($AutoBalanceSchedule);
|
cancel($AutoBalanceSchedule);
|
||||||
|
|
@ -377,9 +372,9 @@ function Autobalance( %game )
|
||||||
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
|
%team2difference = $TeamRank[2, count] - $TeamRank[1, count];
|
||||||
|
|
||||||
//Determine BigTeam
|
//Determine BigTeam
|
||||||
if( %team1difference >= 2 )
|
if(%team1difference >= 2)
|
||||||
$BigTeam = 1;
|
$BigTeam = 1;
|
||||||
else if( %team2difference >= 2 )
|
else if(%team2difference >= 2)
|
||||||
$BigTeam = 2;
|
$BigTeam = 2;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -198,10 +198,13 @@ function DefaultGame::sendGameVoteMenu(%game, %client, %key)
|
||||||
//PUG Password
|
//PUG Password
|
||||||
if(%client.isAdmin && $Host::TournamentMode)
|
if(%client.isAdmin && $Host::TournamentMode)
|
||||||
{
|
{
|
||||||
if($Host::Password !$= "")
|
if(!$Host::PUGpasswordAlwaysOn) //Password is already set
|
||||||
messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Disable PUG Password', 'Disable PUG Password');
|
{
|
||||||
else
|
if($Host::Password !$= "")
|
||||||
messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Enable PUG Password', 'Enable PUG Password');
|
messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Disable PUG Password', 'Disable PUG Password');
|
||||||
|
else
|
||||||
|
messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Enable PUG Password', 'Enable PUG Password');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Locked Teams
|
//Locked Teams
|
||||||
if(%client.isAdmin && $Host::TournamentMode)
|
if(%client.isAdmin && $Host::TournamentMode)
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ package flagFix{
|
||||||
|
|
||||||
function CTFGame::startMatch(%game){
|
function CTFGame::startMatch(%game){
|
||||||
parent::startMatch(%game);
|
parent::startMatch(%game);
|
||||||
%game.setupFlagTrig();
|
|
||||||
if(!isEventPending(Game.flagLoop)){
|
if(!isEventPending(Game.flagLoop)){
|
||||||
%game.atHomeFlagLoop();
|
%game.atHomeFlagLoop();
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +39,6 @@ package flagFix{
|
||||||
|
|
||||||
function SCtFGame::startMatch(%game){
|
function SCtFGame::startMatch(%game){
|
||||||
parent::startMatch(%game);
|
parent::startMatch(%game);
|
||||||
%game.setupFlagTrig();
|
|
||||||
if(!isEventPending(Game.flagLoop)){
|
if(!isEventPending(Game.flagLoop)){
|
||||||
%game.atHomeFlagLoop();
|
%game.atHomeFlagLoop();
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +47,6 @@ package flagFix{
|
||||||
|
|
||||||
function PracticeCTFGame::startMatch(%game){
|
function PracticeCTFGame::startMatch(%game){
|
||||||
parent::startMatch(%game);
|
parent::startMatch(%game);
|
||||||
%game.setupFlagTrig();
|
|
||||||
if(!isEventPending(Game.flagLoop)){
|
if(!isEventPending(Game.flagLoop)){
|
||||||
%game.atHomeFlagLoop();
|
%game.atHomeFlagLoop();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2514,6 +2514,11 @@ package dtStatsGame{
|
||||||
}
|
}
|
||||||
parent::playerTouchOwnFlag(%game, %player, %flag);
|
parent::playerTouchOwnFlag(%game, %player, %flag);
|
||||||
}
|
}
|
||||||
|
function CTFGame::awardScoreStalemateReturn(%game, %cl){
|
||||||
|
if($dtStats::Enable)
|
||||||
|
%cl.flagReturns++;
|
||||||
|
parent::awardScoreStalemateReturn(%game, %cl);
|
||||||
|
}
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
function SCtFGame::playerDroppedFlag(%game, %player){
|
function SCtFGame::playerDroppedFlag(%game, %player){
|
||||||
if($dtStats::Enable){
|
if($dtStats::Enable){
|
||||||
|
|
@ -2631,6 +2636,11 @@ package dtStatsGame{
|
||||||
}
|
}
|
||||||
parent::playerTouchOwnFlag(%game, %player, %flag);
|
parent::playerTouchOwnFlag(%game, %player, %flag);
|
||||||
}
|
}
|
||||||
|
function SCtFGame::awardScoreStalemateReturn(%game, %cl){
|
||||||
|
if($dtStats::Enable)
|
||||||
|
%cl.flagReturns++;
|
||||||
|
parent::awardScoreStalemateReturn(%game, %cl);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function chkGrounded(%player){
|
function chkGrounded(%player){
|
||||||
|
|
|
||||||
647
Classic/scripts/inventory.cs
Normal file
647
Classic/scripts/inventory.cs
Normal file
|
|
@ -0,0 +1,647 @@
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Item Datablocks
|
||||||
|
// image = Name of mounted image datablock
|
||||||
|
// onUse(%this,%object)
|
||||||
|
|
||||||
|
// Item Image Datablocks
|
||||||
|
// item = Name of item inventory datablock
|
||||||
|
|
||||||
|
// ShapeBase Datablocks
|
||||||
|
// max[Item] = Maximum amount that can be caried
|
||||||
|
|
||||||
|
// ShapeBase Objects
|
||||||
|
// inv[Item] = Count of item in inventory
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$TestCheats = 0;
|
||||||
|
|
||||||
|
function serverCmdUse(%client,%data)
|
||||||
|
{
|
||||||
|
// Item names from the client must converted
|
||||||
|
// into DataBlocks
|
||||||
|
// %data = ItemDataBlock[%item];
|
||||||
|
if(isObject(%client.player)) // z0dd - ZOD, 5/18/03. Console spam fix
|
||||||
|
%client.getControlObject().use(%data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function serverCmdThrow(%client,%data)
|
||||||
|
{
|
||||||
|
// Item names from the client must converted
|
||||||
|
// into DataBlocks
|
||||||
|
// %data = ItemDataBlock[%item];
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// z0dd - ZOD, 4/18/02. Let one keybind handle all grenade types.
|
||||||
|
if(isObject(%client.player)) // z0dd - ZOD, 5/18/03. Console spam fix
|
||||||
|
{
|
||||||
|
if(%data $= Grenade)
|
||||||
|
{
|
||||||
|
// figure out which grenade type you're using
|
||||||
|
for(%x = 0; $InvGrenade[%x] !$= ""; %x++)
|
||||||
|
{
|
||||||
|
if(%client.getControlObject().inv[$NameToInv[$InvGrenade[%x]]] > 0)
|
||||||
|
{
|
||||||
|
%data = $NameToInv[$InvGrenade[%x]];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%client.getControlObject().throw(%data);
|
||||||
|
}
|
||||||
|
else if(%data $= Mine)
|
||||||
|
{
|
||||||
|
for(%x = 0; $InvMine[%x] !$= ""; %x++)
|
||||||
|
{
|
||||||
|
if(%client.getControlObject().inv[$NameToInv[$InvMine[%x]]] > 0)
|
||||||
|
{
|
||||||
|
%data = $NameToInv[$InvMine[%x]];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%client.getControlObject().throw(%data);
|
||||||
|
}
|
||||||
|
else if(%data $= "Ammo")
|
||||||
|
{
|
||||||
|
%weapon = %client.getControlObject().getMountedImage($WeaponSlot);
|
||||||
|
if(%weapon !$= "")
|
||||||
|
{
|
||||||
|
if(%weapon.ammo !$= "")
|
||||||
|
%client.getControlObject().throw(%weapon.ammo);
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
%client.getControlObject().throw(%data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function serverCmdThrowWeapon(%client,%data)
|
||||||
|
{
|
||||||
|
// Item names from the client must converted
|
||||||
|
// into DataBlocks
|
||||||
|
// %data = ItemDataBlock[%item];
|
||||||
|
if(isObject(%client.player)) // z0dd - ZOD, 5/18/03. Console spam fix
|
||||||
|
%client.getControlObject().throwWeapon();
|
||||||
|
}
|
||||||
|
|
||||||
|
function serverCmdThrowPack(%client,%data)
|
||||||
|
{
|
||||||
|
if(isObject(%client.player)) // z0dd - ZOD, 5/18/03. Console spam fix
|
||||||
|
%client.getControlObject().throwPack();
|
||||||
|
}
|
||||||
|
|
||||||
|
function serverCmdTogglePack(%client,%data)
|
||||||
|
{
|
||||||
|
// this function is apparently never called
|
||||||
|
%client.getControlObject().togglePack();
|
||||||
|
}
|
||||||
|
|
||||||
|
function serverCmdThrowFlag(%client)
|
||||||
|
{
|
||||||
|
//Game.playerDroppedFlag(%client.player);
|
||||||
|
Game.dropFlag(%client.player);
|
||||||
|
}
|
||||||
|
|
||||||
|
function serverCmdSelectWeaponSlot( %client, %data )
|
||||||
|
{
|
||||||
|
if(isObject(%client.player)) // z0dd - ZOD, 5/18/03. Console spam fix
|
||||||
|
%client.getControlObject().selectWeaponSlot( %data );
|
||||||
|
}
|
||||||
|
|
||||||
|
function serverCmdCycleWeapon( %client, %data )
|
||||||
|
{
|
||||||
|
if(isObject(%client.player)) // z0dd - ZOD, 5/18/03. Console spam fix
|
||||||
|
%client.getControlObject().cycleWeapon( %data );
|
||||||
|
}
|
||||||
|
|
||||||
|
function serverCmdStartThrowCount(%client, %data)
|
||||||
|
{
|
||||||
|
%client.player.throwStart = getSimTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
$maxThrowStr = 2.2; // z0dd - ZOD, 8/6/02. New throw str features
|
||||||
|
|
||||||
|
function serverCmdEndThrowCount(%client, %data)
|
||||||
|
{
|
||||||
|
if(%client.player.throwStart == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
// z0dd - ZOD, 8/6/02. New throw str features
|
||||||
|
%throwStrength = (getSimTime() - %client.player.throwStart) / 150;
|
||||||
|
if(%throwStrength > $maxThrowStr)
|
||||||
|
%throwStrength = $maxThrowStr;
|
||||||
|
else if(%throwStrength < 0.5)
|
||||||
|
%throwStrength = 0.5;
|
||||||
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
|
%throwScale = %throwStrength / 2;
|
||||||
|
%client.player.throwStrength = %throwScale;
|
||||||
|
|
||||||
|
%client.player.throwStart = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// z0dd - ZOD, 9/27/02. No buildup power. Rewrote function
|
||||||
|
function serverCmdthrowMaxEnd(%client, %data)
|
||||||
|
{
|
||||||
|
%client.player.throwStrength = $maxThrowStr / 2;
|
||||||
|
}
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
function ShapeBase::throwWeapon(%this)
|
||||||
|
{
|
||||||
|
if(Game.shapeThrowWeapon(%this)) {
|
||||||
|
%image = %this.getMountedImage($WeaponSlot);
|
||||||
|
%this.throw(%image.item);
|
||||||
|
%this.client.setWeaponsHudItem(%image.item, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::throwPack(%this)
|
||||||
|
{
|
||||||
|
if(isObject(%this)) // z0dd - ZOD, 5/18/03. Console spam fix
|
||||||
|
{
|
||||||
|
%image = %this.getMountedImage($BackpackSlot);
|
||||||
|
%this.throw(%image.item);
|
||||||
|
%this.client.setBackpackHudItem(%image.item, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::throw(%this,%data)
|
||||||
|
{
|
||||||
|
if(!isObject(%data))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (%this.inv[%data.getName()] > 0) {
|
||||||
|
|
||||||
|
// save off the ammo count on this item
|
||||||
|
if( %this.getInventory( %data ) < $AmmoIncrement[%data.getName()] )
|
||||||
|
%data.ammoStore = %this.getInventory( %data );
|
||||||
|
else
|
||||||
|
%data.ammoStore = $AmmoIncrement[%data.getName()];
|
||||||
|
|
||||||
|
// Throw item first...
|
||||||
|
%this.throwItem(%data);
|
||||||
|
if($AmmoIncrement[%data.getName()] !$= "")
|
||||||
|
%this.decInventory(%data,$AmmoIncrement[%data.getName()]);
|
||||||
|
else
|
||||||
|
%this.decInventory(%data,1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::use(%this, %data)
|
||||||
|
{
|
||||||
|
//if(%data.class $= "Weapon") {
|
||||||
|
// error("ShapeBase::use " @ %data);
|
||||||
|
//}
|
||||||
|
if(isObject(%this) && %data !$= "") // z0dd - ZOD, 5/18/03. Console spam fix
|
||||||
|
{
|
||||||
|
if(%data $= Grenade)
|
||||||
|
{
|
||||||
|
// figure out which grenade type you're using
|
||||||
|
for(%x = 0; $InvGrenade[%x] !$= ""; %x++) {
|
||||||
|
if(%this.inv[$NameToInv[$InvGrenade[%x]]] > 0)
|
||||||
|
{
|
||||||
|
%data = $NameToInv[$InvGrenade[%x]];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(%data $= Mine) // z0dd - ZOD, 5/18/03. For more mine types
|
||||||
|
{
|
||||||
|
// figure out which mine type you're using
|
||||||
|
for(%m = 0; $InvMine[%m] !$= ""; %m++) {
|
||||||
|
if(%this.inv[$NameToInv[$InvMine[%m]]] > 0)
|
||||||
|
{
|
||||||
|
%data = $NameToInv[$InvMine[%m]];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(%data $= "Backpack") {
|
||||||
|
%pack = %this.getMountedImage($BackpackSlot);
|
||||||
|
// if you don't have a pack but have placed a satchel charge, detonate it
|
||||||
|
if(!%pack && (%this.thrownChargeId > 0) && %this.thrownChargeId.armed )
|
||||||
|
{
|
||||||
|
%this.playAudio( 0, SatchelChargeExplosionSound );
|
||||||
|
schedule( 600, %this, "detonateSatchelCharge", %this ); // z0dd - ZOD, 8/24/02. Time after pressing fire that satchel blows. Was 800
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(%data $= Beacon)
|
||||||
|
{
|
||||||
|
%data.onUse(%this);
|
||||||
|
if (%this.inv[%data.getName()] > 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// default case
|
||||||
|
if (%this.inv[%data.getName()] > 0) {
|
||||||
|
%data.onUse(%this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::pickup(%this,%obj,%amount)
|
||||||
|
{
|
||||||
|
%data = %obj.getDatablock();
|
||||||
|
%delta = %this.incInventory(%data,%amount);
|
||||||
|
|
||||||
|
if (%delta)
|
||||||
|
%data.onPickup(%obj,%this,%delta);
|
||||||
|
return %delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::hasInventory(%this, %data)
|
||||||
|
{
|
||||||
|
// changed because it was preventing weapons cycling correctly (MES)
|
||||||
|
return (%this.inv[%data] > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::maxInventory(%this, %data)
|
||||||
|
{
|
||||||
|
//error("ShapeBase::maxInventory( " @ %this.client.nameBase @ ", " @ %data @ " )");
|
||||||
|
if(isObject(%data)) // z0dd - ZOD, 5/18/03. Console spam fix
|
||||||
|
{
|
||||||
|
if($TestCheats)
|
||||||
|
return 999;
|
||||||
|
else
|
||||||
|
return %this.getDatablock().max[%data.getName()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::incInventory(%this, %data, %amount)
|
||||||
|
{
|
||||||
|
if(isObject(%data)) // z0dd - ZOD, 5/18/03. Console spam fix
|
||||||
|
{
|
||||||
|
%max = %this.maxInventory(%data);
|
||||||
|
%cv = %this.inv[%data.getName()];
|
||||||
|
if (%cv < %max) {
|
||||||
|
if (%cv + %amount > %max)
|
||||||
|
%amount = %max - %cv;
|
||||||
|
|
||||||
|
%this.setInventory(%data,%cv + %amount);
|
||||||
|
%data.incCatagory(%this); // Inc the players weapon count
|
||||||
|
return %amount;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::decInventory(%this,%data,%amount)
|
||||||
|
{
|
||||||
|
%name = %data.getName();
|
||||||
|
%cv = %this.inv[%name];
|
||||||
|
if (%cv > 0) {
|
||||||
|
if (%cv < %amount)
|
||||||
|
%amount = %cv;
|
||||||
|
%this.setInventory(%data,%cv - %amount, true);
|
||||||
|
%data.decCatagory(%this); // Dec the players weapon count
|
||||||
|
return %amount;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function SimObject::decCatagory(%this)
|
||||||
|
{
|
||||||
|
//function was added to reduce console err msg spam
|
||||||
|
}
|
||||||
|
|
||||||
|
function SimObject::incCatagory(%this)
|
||||||
|
{
|
||||||
|
//function was added to reduce console err msg spam
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::setInventory(%this,%data,%value,%force)
|
||||||
|
{
|
||||||
|
if (!isObject(%data))
|
||||||
|
return;
|
||||||
|
|
||||||
|
%name = %data.getName();
|
||||||
|
if (%value < 0)
|
||||||
|
%value = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!%force)
|
||||||
|
{
|
||||||
|
// Impose inventory limits
|
||||||
|
%max = %this.maxInventory(%data);
|
||||||
|
if (%value > %max)
|
||||||
|
%value = %max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (%this.inv[%name] != %value)
|
||||||
|
{
|
||||||
|
%this.inv[%name] = %value;
|
||||||
|
%data.onInventory(%this,%value);
|
||||||
|
|
||||||
|
if ( %data.className $= "Weapon" )
|
||||||
|
{
|
||||||
|
if ( %this.weaponSlotCount $= "" )
|
||||||
|
%this.weaponSlotCount = 0;
|
||||||
|
|
||||||
|
%cur = -1;
|
||||||
|
for ( %slot = 0; %slot < %this.weaponSlotCount; %slot++ )
|
||||||
|
{
|
||||||
|
if ( %this.weaponSlot[%slot] $= %name )
|
||||||
|
{
|
||||||
|
%cur = %slot;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( %cur == -1 )
|
||||||
|
{
|
||||||
|
// Put this weapon in the next weapon slot:
|
||||||
|
if ( %this.weaponSlot[%this.weaponSlotCount - 1] $= "TargetingLaser" )
|
||||||
|
{
|
||||||
|
%this.weaponSlot[%this.weaponSlotCount - 1] = %name;
|
||||||
|
%this.weaponSlot[%this.weaponSlotCount] = "TargetingLaser";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
%this.weaponSlot[%this.weaponSlotCount] = %name;
|
||||||
|
%this.weaponSlotCount++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Remove the weapon from the weapon slot:
|
||||||
|
for ( %i = %cur; %i < %this.weaponSlotCount - 1; %i++ )
|
||||||
|
%this.weaponSlot[%i] = %this.weaponSlot[%i + 1];
|
||||||
|
%this.weaponSlot[%i] = "";
|
||||||
|
%this.weaponSlotCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%this.getDataBlock().onInventory(%data,%value);
|
||||||
|
}
|
||||||
|
return %value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::getInventory(%this,%data)
|
||||||
|
{
|
||||||
|
if ( isObject( %data ) )
|
||||||
|
return( %this.inv[%data.getName()] );
|
||||||
|
else
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// z0dd - ZOD, 9/13/02. Streamlined.
|
||||||
|
function ShapeBase::hasAmmo( %this, %weapon )
|
||||||
|
{
|
||||||
|
if(%weapon $= LaserRifle)
|
||||||
|
return( %this.getInventory( EnergyPack ) );
|
||||||
|
|
||||||
|
if (%weapon.image.ammo $= "")
|
||||||
|
{
|
||||||
|
if (%weapon $= TargetingLaser)
|
||||||
|
{
|
||||||
|
return( false );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( %this.getInventory( %weapon.image.ammo ) > 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function SimObject::onInventory(%this, %obj)
|
||||||
|
{
|
||||||
|
//function was added to reduce console error msg spam
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::throwItem(%this,%data)
|
||||||
|
{
|
||||||
|
%item = new Item() {
|
||||||
|
dataBlock = %data;
|
||||||
|
rotation = "0 0 1 " @ (getRandom() * 360);
|
||||||
|
};
|
||||||
|
|
||||||
|
%item.ammoStore = %data.ammoStore;
|
||||||
|
MissionCleanup.add(%item);
|
||||||
|
%this.throwObject(%item);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::throwObject(%this,%obj)
|
||||||
|
{
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// z0dd - ZOD, 4/15/02. Allow respawn switching during tourney wait.
|
||||||
|
if(!$MatchStarted)
|
||||||
|
return;
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
// z0dd - ZOD, 5/26/02. Remove anti-hover so flag can be thrown properly
|
||||||
|
if(%obj.getDataBlock().getName() $= "Flag")
|
||||||
|
{
|
||||||
|
%obj.static = false;
|
||||||
|
// z0dd - ZOD - SquirrelOfDeath, 10/02/02. Hack for flag collision bug.
|
||||||
|
if(Game.Class $= CTFGame || Game.Class $= PracticeCTFGame || Game.Class $= SCtFGame)
|
||||||
|
%obj.searchSchedule = Game.schedule(10, "startFlagCollisionSearch", %obj);
|
||||||
|
}
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
%srcCorpse = (%this.getState() $= "Dead"); // z0dd - ZOD, 4/14/02. Flag tossed from corpse
|
||||||
|
//if the object is being thrown by a corpse, use a random vector
|
||||||
|
if (%srcCorpse && %obj.getDataBlock().getName() !$= "Flag") // z0dd - ZOD, 4/14/02. Except for flags..
|
||||||
|
{
|
||||||
|
%vec = (-1.0 + getRandom() * 2.0) SPC (-1.0 + getRandom() * 2.0) SPC getRandom();
|
||||||
|
%vec = vectorScale(%vec, 10);
|
||||||
|
}
|
||||||
|
else // else Initial vel based on the dir the player is looking
|
||||||
|
{
|
||||||
|
%eye = %this.getEyeVector();
|
||||||
|
%vec = vectorScale(%eye, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a vertical component to give the item a better arc
|
||||||
|
%dot = vectorDot("0 0 1",%eye);
|
||||||
|
if (%dot < 0)
|
||||||
|
%dot = -%dot;
|
||||||
|
%vec = vectorAdd(%vec,vectorScale("0 0 12",1 - %dot)); // z0dd - ZOD, 9/10/02. 10 was 8
|
||||||
|
|
||||||
|
// Add player's velocity
|
||||||
|
%vec = vectorAdd(%vec,%this.getVelocity());
|
||||||
|
%pos = getBoxCenter(%this.getWorldBox());
|
||||||
|
|
||||||
|
//since flags have a huge mass (so when you shoot them, they don't bounce too far)
|
||||||
|
//we need to up the %vec so that you can still throw them...
|
||||||
|
if (%obj.getDataBlock().getName() $= "Flag")
|
||||||
|
{
|
||||||
|
%vec = vectorScale(%vec, (%srcCorpse ? 40 : 75)); // z0dd - ZOD, 4/14/02. Throw flag force. Value was 40
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// z0dd - ZOD, 9/27/02. Delay on grabbing flag after tossing it
|
||||||
|
%this.flagTossWait = true;
|
||||||
|
%this.schedule(1000, resetFlagTossWait);
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// From AntiLou
|
||||||
|
// Delay on calculating stats
|
||||||
|
%this.flagStatsWait = true;
|
||||||
|
%this.schedule(5000, resetFlagStatsWait);
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do stuff
|
||||||
|
%obj.setCollisionTimeout(%this);
|
||||||
|
%obj.setTransform(%pos);
|
||||||
|
%obj.applyImpulse(%pos,%vec);
|
||||||
|
%data = %obj.getDatablock();
|
||||||
|
|
||||||
|
%data.onThrow(%obj,%this);
|
||||||
|
|
||||||
|
//call the AI hook
|
||||||
|
AIThrowObject(%obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
// From AntiLou
|
||||||
|
// Player::resetFlagStatsWait(%this)
|
||||||
|
// Info: Delay on calculating the stats
|
||||||
|
function Player::resetFlagStatsWait(%this)
|
||||||
|
{
|
||||||
|
%this.flagStatsWait = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ShapeBase::clearInventory(%this)
|
||||||
|
{
|
||||||
|
// z0dd - ZOD, 5/18/03. Auto cleanup of weapons and ammo. Streamline
|
||||||
|
for(%i = 0; %i < $WeaponsHudCount; %i++)
|
||||||
|
{
|
||||||
|
%this.setInventory($WeaponsHudData[%i, itemDataName], 0);
|
||||||
|
if($WeaponsHudData[%i, ammoDataName] !$= "")
|
||||||
|
%this.setInventory($WeaponsHudData[%i, ammoDataName], 0);
|
||||||
|
}
|
||||||
|
for(%i = 0; $InvGrenade[%i] !$= ""; %i++)
|
||||||
|
%this.setInventory($NameToInv[$InvGrenade[%i]], 0);
|
||||||
|
|
||||||
|
for(%i = 0; $InvMine[%i] !$= ""; %i++)
|
||||||
|
%this.setInventory($NameToInv[$InvMine[%i]], 0);
|
||||||
|
|
||||||
|
%this.setInventory(RepairKit, 0);
|
||||||
|
%this.setInventory(Beacon, 0);
|
||||||
|
|
||||||
|
// take away any pack the player has
|
||||||
|
%curPack = %this.getMountedImage($BackpackSlot);
|
||||||
|
if(%curPack > 0)
|
||||||
|
%this.setInventory(%curPack.item, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
function ShapeBase::cycleWeapon( %this, %data )
|
||||||
|
{
|
||||||
|
if ( %this.weaponSlotCount == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
%slot = -1;
|
||||||
|
if ( %this.getMountedImage($WeaponSlot) != 0 )
|
||||||
|
{
|
||||||
|
%curWeapon = %this.getMountedImage($WeaponSlot).item.getName();
|
||||||
|
for ( %i = 0; %i < %this.weaponSlotCount; %i++ )
|
||||||
|
{
|
||||||
|
//error("curWeaponName == " @ %curWeaponName);
|
||||||
|
if ( %curWeapon $= %this.weaponSlot[%i] )
|
||||||
|
{
|
||||||
|
%slot = %i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( %data $= "prev" )
|
||||||
|
{
|
||||||
|
// Previous weapon...
|
||||||
|
if ( %slot == 0 || %slot == -1 )
|
||||||
|
{
|
||||||
|
%i = %this.weaponSlotCount - 1;
|
||||||
|
%slot = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
%i = %slot - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Next weapon...
|
||||||
|
if ( %slot == ( %this.weaponSlotCount - 1 ) || %slot == -1 )
|
||||||
|
{
|
||||||
|
%i = 0;
|
||||||
|
%slot = ( %this.weaponSlotCount - 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
%i = %slot + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
%newSlot = -1;
|
||||||
|
while ( %i != %slot )
|
||||||
|
{
|
||||||
|
if ( %this.weaponSlot[%i] !$= ""
|
||||||
|
&& %this.hasInventory( %this.weaponSlot[%i] )
|
||||||
|
&& %this.hasAmmo( %this.weaponSlot[%i] ) )
|
||||||
|
{
|
||||||
|
// player has this weapon and it has ammo or doesn't need ammo
|
||||||
|
%newSlot = %i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( %data $= "prev" )
|
||||||
|
{
|
||||||
|
if ( %i == 0 )
|
||||||
|
%i = %this.weaponSlotCount - 1;
|
||||||
|
else
|
||||||
|
%i--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( %i == ( %this.weaponSlotCount - 1 ) )
|
||||||
|
%i = 0;
|
||||||
|
else
|
||||||
|
%i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( %newSlot != -1 )
|
||||||
|
%this.use( %this.weaponSlot[%newSlot] );
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
function ShapeBase::selectWeaponSlot( %this, %data )
|
||||||
|
{
|
||||||
|
if ( %data < 0 || %data > %this.weaponSlotCount
|
||||||
|
|| %this.weaponSlot[%data] $= "" || %this.weaponSlot[%data] $= "TargetingLaser" )
|
||||||
|
return;
|
||||||
|
|
||||||
|
%this.use( %this.weaponSlot[%data] );
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function serverCmdGiveAll(%client)
|
||||||
|
{
|
||||||
|
if($TestCheats)
|
||||||
|
{
|
||||||
|
%player = %client.player;
|
||||||
|
// z0dd - ZOD, 5/18/03. Auto increment of weapons and ammo. Streamline
|
||||||
|
for(%i = 0; %i < $WeaponsHudCount; %i++)
|
||||||
|
{
|
||||||
|
%player.setInventory($WeaponsHudData[%i, itemDataName], 1);
|
||||||
|
if($WeaponsHudData[%i, ammoDataName] !$= "")
|
||||||
|
%player.setInventory($WeaponsHudData[%i, ammoDataName], 999);
|
||||||
|
}
|
||||||
|
for(%i = 0; $InvGrenade[%i] !$= ""; %i++)
|
||||||
|
%player.setInventory($NameToInv[$InvGrenade[%i]], 0);
|
||||||
|
|
||||||
|
for(%i = 0; $InvMine[%i] !$= ""; %i++)
|
||||||
|
%player.setInventory($NameToInv[$InvMine[%i]], 0);
|
||||||
|
|
||||||
|
%player.setInventory(RepairKit, 999);
|
||||||
|
%player.setInventory(Beacon, 999);
|
||||||
|
%player.setInventory(RocketCannonAmmo, 999);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue