Botpack
Class TournamentPlayer

source: e:\games\UnrealTournament\Botpack\Classes\TournamentPlayer.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--Engine.PlayerPawn
            |
            +--Botpack.TournamentPlayer
Direct Known Subclasses:Commander, TournamentFemale, TournamentMale

class TournamentPlayer
extends Engine.PlayerPawn

//============================================================================= // TournamentPlayer. //=============================================================================
Variables
 int AnnouncerVolume
           where player started the match
 class BossRef
           where player started the match
 Weapon ClientPending
           where player started the match
 string DefaultPackage
 string DefaultSkinName
 int FaceSkin
 int FixedSkin
 float LastKillTime
 int MultiLevel
 Weapon OldClientWeapon
           where player started the match
 NavigationPoint StartSpot
           where player started the match
 StatusDoll, StatusBelt
           don't receive any voice messages
 int TeamSkin1
 int TeamSkin2
 class TimeMessageClass
           where player started the match
 string VoicePackMetaClass
           don't receive any voice messages
 int WeaponUpdate
           don't receive any voice messages
 bool b3DSound
           don't receive any voice messages
 bool bInstantRocket
 bool bLastJumpAlt
 bool bNeedActivate
           don't receive any voice messages
 bool bNoMatureLanguage
           don't receive any taunts
 bool bNoVoiceMessages
           don't receive any voice messages
 bool bNoVoiceTaunts
           don't receive any taunts

States
GameEnded, Dying, FeigningDeath

Function Summary
 void AddBotNamed(string BotName)
 void Advance()
     
// Skip any map.
 void AdvanceAll()
     
// Skip all maps.
 void ChangeSetHand(string S)
 void CheckBob(float DeltaTime, float Speed2D, vector Y)
 
simulated
ClientPlaySound(sound ASound, optional bool, optional bool)
     
//Play a sound client side (so only client will hear it
 void ClientPlayTakeHit(vector HitLoc, byte Damage, bool bServerGuessWeapon)
 void ClientPutDown(Weapon Current, Weapon Next)
 void ClientReplicateSkins(Texture Skin1, optional texture, optional texture, optional texture)
 void ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
 void DoJump(optional float)
     
//Player Jumped
 void EndSpree(PlayerReplicationInfo Killer, PlayerReplicationInfo Other)
 
simulated
FootStepping()
 void Gasp()
 void GetMultiSkin(Actor SkinActor, out string, out string)
     
/* Skin Stuff */
 void IAmTheOne()
 void Killed(Pawn Killer, Pawn Other, name damageType)
 void ListBots()
 void LoadLeftHand()
 void Loaded()
 void NeedActivate()
 
simulated
PlayBeepSound()
 void PlayChatting()
 void PlayCrawling()
 void PlayDeathHit(float Damage, vector HitLocation, name damageType, vector Momentum)
 void PlayDodge(eDodgeDir DodgeMove)
 void PlayDuck()
 void PlayDyingSound()
 void PlayFeignDeath()
 void PlayFiring()
 
simulated
PlayFootStep()
 void PlayGutHit(float tweentime)
 void PlayHeadHit(float tweentime)
 void PlayHit(float Damage, vector HitLocation, name damageType, vector Momentum)
 void PlayInAir()
 void PlayLanded(float impactVel)
 void PlayLeftHit(float tweentime)
 void PlayRecoil(float Rate)
 void PlayRightHit(float tweentime)
 void PlayRising()
 void PlayRunning()
 void PlaySwimming()
 void PlayTakeHitSound(int damage, name damageType, int Mult)
     
//-----------------------------------------------------------------------------
// Sound functions
 void PlayTurning()
     
//-----------------------------------------------------------------------------
// Animation functions
 void PlayWaiting()
 void PlayWalking()
 void PlayWeaponSwitch(Weapon NewWeapon)
 void PlayWinMessage(bool bWinner)
 
simulated
PostBeginPlay()
 void PreCacheReferences()
 void PreSetMovement()
 void RealWeapon(Weapon Real, int N)
 void ReplicateMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
 void SendAltFire(Weapon W)
 void SendClientAltFire(Weapon W, int N)
 void SendClientFire(Weapon W, int N)
 void SendFire(Weapon W)
 void SendGlobalMessage(PlayerReplicationInfo Recipient, name MessageType, byte MessageID, float Wait)
 void SendTeamMessage(PlayerReplicationInfo Recipient, name MessageType, byte MessageID, float Wait)
 void ServerSetInstantRocket(bool B)
 void ServerSetTaunt(bool B)
 void SetAirControl(float F)
 void SetAutoTaunt(bool B)
 void SetInstantRocket(bool B)
 void SetMultiSkin(Actor SkinActor, string SkinName, string FaceName, byte TeamNum)
 void Summon(string ClassName)
 void TimeMessage(int Num)
 void TweenToRunning(float tweentime)
 void TweenToSwimming(float tweentime)
 void TweenToWaiting(float tweentime)
 void TweenToWalking(float tweentime)
 void UpdateRealWeapon(Weapon W)
 void Verbose()


State GameEnded Function Summary
 void Fire(optional float)


State Dying Function Summary
 void BeginState()
 void ViewFlash(float DeltaTime)


State FeigningDeath Function Summary
 void BeginState()
 void NeedActivate()



Source Code


00001	//=============================================================================
00002	// TournamentPlayer.
00003	//=============================================================================
00004	class TournamentPlayer extends PlayerPawn
00005		config(User)
00006		abstract;
00007	
00008	#exec AUDIO IMPORT FILE="Sounds\chatsound\chat8a.WAV" NAME="NewBeep" GROUP="ChatSound"
00009	#exec AUDIO IMPORT FILE="Sounds\chatsound\spree-sound.WAV" NAME="SpreeSound" GROUP="ChatSound"
00010	
00011	#exec TEXTURE IMPORT NAME=Man FILE=TEXTURES\HUD\IMale2.PCX GROUP="Icons" MIPS=OFF
00012	#exec TEXTURE IMPORT NAME=ManBelt FILE=TEXTURES\HUD\IMaleSBelt.PCX GROUP="Icons" MIPS=OFF
00013	
00014	var(Messages)	localized string spreenote[10];
00015	var(Sounds)		Sound Deaths[6];
00016	var int			FaceSkin;
00017	var int			FixedSkin;
00018	var int			TeamSkin1;
00019	var int			TeamSkin2;
00020	var int			MultiLevel;
00021	var string		DefaultSkinName;
00022	var string		DefaultPackage;
00023	var float		LastKillTime;
00024	
00025	var(Sounds) sound 	drown;
00026	var(Sounds) sound	breathagain;
00027	var(Sounds) sound	Footstep1;
00028	var(Sounds) sound	Footstep2;
00029	var(Sounds) sound	Footstep3;
00030	var(Sounds) sound	HitSound3;
00031	var(Sounds) sound	HitSound4;
00032	var(Sounds) sound	Die2;
00033	var(Sounds) sound	Die3;
00034	var(Sounds) sound	Die4;
00035	var(Sounds) sound	GaspSound;
00036	var(Sounds) sound	UWHit1;
00037	var(Sounds) sound	UWHit2;
00038	var(Sounds) sound	LandGrunt;
00039	
00040	var bool bLastJumpAlt;
00041	var  globalconfig bool bInstantRocket;
00042	var	 globalconfig bool bAutoTaunt; // player automatically generates taunts when fragging someone
00043	var	 globalconfig bool bNoAutoTaunts; // don't receive auto-taunts
00044	var  globalconfig bool bNoVoiceTaunts; // don't receive any taunts
00045	var  globalconfig bool bNoMatureLanguage;
00046	var  globalconfig bool bNoVoiceMessages; // don't receive any voice messages
00047	var bool bNeedActivate;
00048	var bool b3DSound;
00049	
00050	var int WeaponUpdate;
00051	
00052	// HUD status 
00053	var texture StatusDoll, StatusBelt;
00054	
00055	// allowed voices
00056	var string VoicePackMetaClass;
00057	
00058	var NavigationPoint StartSpot; //where player started the match
00059	
00060	var Weapon ClientPending;
00061	var Weapon OldClientWeapon;
00062	
00063	var globalconfig int AnnouncerVolume;
00064	var class<CriticalEventPlus> TimeMessageClass;
00065	
00066	var class<Actor> BossRef;
00067	
00068	replication
00069	{
00070		// Things the server should send to the client.
00071		unreliable if( Role==ROLE_Authority )
00072			ClientPlayTakeHit, TimeMessage;
00073		reliable if ( Role == ROLE_Authority )
00074			SendClientFire, SendClientAltFire, RealWeapon, PlayWinMessage; 
00075	
00076		// client to server
00077		reliable if ( Role < ROLE_Authority )
00078			Advance, AdvanceAll, ServerSetTaunt, ServerSetInstantRocket, ServerSetVoice, IAmTheOne;
00079	}
00080	
00081	exec function AddBotNamed(string BotName)
00082	{
00083		if ( Level.NetMode == NM_Client )
00084		{
00085			ClientMessage("Can't added named bots from client.");
00086			return;
00087		}
00088	
00089		if ( DeathMatchPlus(Level.Game) != None )	
00090			DeathMatchPlus(Level.Game).BotConfig.DesiredName = BotName;
00091		Level.Game.ForceAddBot();
00092	}
00093	
00094	function PlayWinMessage(bool bWinner)
00095	{
00096		local sound Announcement;
00097	
00098		if ( bWinner )
00099			Announcement = Sound(DynamicLoadObject("Announcer.Winner", class'Sound'));
00100		else
00101			Announcement = Sound(DynamicLoadObject("Announcer.LostMatch", class'Sound'));
00102	
00103		ClientPlaySound(Announcement, true, true);
00104	}
00105	
00106	//Player Jumped
00107	function DoJump( optional float F )
00108	{
00109		if ( CarriedDecoration != None )
00110			return;
00111		if ( !bIsCrouching && (Physics == PHYS_Walking) )
00112		{
00113			if ( !bUpdating )
00114				PlayOwnedSound(JumpSound, SLOT_Talk, 1.5, true, 1200, 1.0 );
00115			if ( (Level.Game != None) && (Level.Game.Difficulty > 0) )
00116				MakeNoise(0.1 * Level.Game.Difficulty);
00117			PlayInAir();
00118			if ( bCountJumps && (Role == ROLE_Authority) && (Inventory != None) )
00119				Inventory.OwnerJumped();
00120			if ( bIsWalking )
00121				Velocity.Z = Default.JumpZ;
00122			else
00123				Velocity.Z = JumpZ;
00124			if ( (Base != Level) && (Base != None) )
00125				Velocity.Z += Base.Velocity.Z; 
00126			SetPhysics(PHYS_Falling);
00127		}
00128	}
00129	//Play a sound client side (so only client will hear it
00130	simulated function ClientPlaySound(sound ASound, optional bool bInterrupt, optional bool bVolumeControl )
00131	{	
00132		local actor SoundPlayer;
00133		local int Volume;
00134	
00135		if ( b3DSound )
00136		{
00137			if ( bVolumeControl && (AnnouncerVolume == 0) )
00138				Volume = 0;
00139			else
00140				Volume = 1;
00141		}
00142		else if ( bVolumeControl )
00143			Volume = AnnouncerVolume;
00144		else
00145			Volume = 4;
00146	
00147		LastPlaySound = Level.TimeSeconds;	// so voice messages won't overlap
00148		if ( ViewTarget != None )
00149			SoundPlayer = ViewTarget;
00150		else
00151			SoundPlayer = self;
00152	
00153		if ( Volume == 0 )
00154			return;
00155		SoundPlayer.PlaySound(ASound, SLOT_None, 16.0, bInterrupt);
00156		if ( Volume == 1 )
00157			return;
00158		SoundPlayer.PlaySound(ASound, SLOT_Interface, 16.0, bInterrupt);
00159		if ( Volume == 2 )
00160			return;
00161		SoundPlayer.PlaySound(ASound, SLOT_Misc, 16.0, bInterrupt);
00162		if ( Volume == 3 )
00163			return;
00164		SoundPlayer.PlaySound(ASound, SLOT_Talk, 16.0, bInterrupt);
00165	}
00166	
00167	//==============
00168	// Encroachment
00169	event bool EncroachingOn( actor Other )
00170	{
00171		if ( GameReplicationInfo.bTeamGame && Other.bIsPawn 
00172			&& (Pawn(Other).PlayerReplicationInfo != None)
00173			&& (Pawn(Other).PlayerReplicationInfo.Team == PlayerReplicationInfo.Team) )
00174		{
00175			if ( (Role == ROLE_Authority) && Level.Game.IsA('DeathMatchPlus')
00176				&& DeathMatchPlus(Level.Game).bStartMatch )
00177				return Super.EncroachingOn(Other);
00178			else
00179				return true;
00180		}
00181		return Super.EncroachingOn(Other);
00182	}
00183	
00184	simulated function PostBeginPlay()
00185	{
00186		Super.PostBeginPlay();
00187		if ( Level.NetMode != NM_DedicatedServer )
00188			Shadow = Spawn(class'PlayerShadow',self);
00189		if ( (Role == ROLE_Authority) && (Level.NetMode != NM_Standalone) )
00190			BossRef = class<Actor>(DynamicLoadObject("Botpack.TBoss",class'Class'));
00191	
00192		b3DSound = bool(ConsoleCommand("get ini:Engine.Engine.AudioDevice Use3dHardware"));
00193	}
00194	
00195	function ClientReplicateSkins(texture Skin1, optional texture Skin2, optional texture Skin3, optional texture Skin4)
00196	{
00197		local class<Actor> C;
00198	
00199		// do nothing (just loading other player skins onto client)
00200		log("Getting "$Skin1$", "$Skin2$", "$Skin3$", "$Skin4);
00201		if ( Role != ROLE_Authority )
00202			BossRef = class<Actor>(DynamicLoadObject("Botpack.TBoss",class'Class'));
00203	}
00204	
00205	function PreCacheReferences()
00206	{
00207		//never called - here to force precaching of meshes
00208		spawn(class'TMale1');
00209		spawn(class'TMale2');
00210		spawn(class'TFemale1');
00211		spawn(class'TFemale2');
00212		spawn(class'ImpactHammer');
00213		spawn(class'Translocator');
00214		spawn(class'Enforcer');
00215		spawn(class'UT_Biorifle');
00216		spawn(class'ShockRifle');
00217		spawn(class'PulseGun');
00218		spawn(class'Ripper');
00219		spawn(class'Minigun2');
00220		spawn(class'UT_FlakCannon');
00221		spawn(class'UT_Eightball');
00222		spawn(class'SniperRifle');
00223	}
00224	
00225	function SendClientFire(weapon W, int N)
00226	{
00227		RealWeapon(W,N);
00228		if ( Weapon.IsA('TournamentWeapon') )
00229		{
00230			TournamentWeapon(Weapon).bCanClientFire = true;
00231			TournamentWeapon(Weapon).ForceClientFire();
00232		}
00233	}
00234	
00235	function SendClientAltFire(weapon W, int N)
00236	{
00237		RealWeapon(W,N);
00238		if ( Weapon.IsA('TournamentWeapon') )
00239		{
00240			TournamentWeapon(Weapon).bCanClientFire = true;
00241			TournamentWeapon(Weapon).ForceClientAltFire();
00242		}
00243	}
00244	
00245	exec function KillAll(class<actor> aClass)
00246	{
00247		if ( bAdmin && (Level.NetMode != NM_Standalone) && Level.Game.IsA('DeathMatchPlus')
00248			&& ((aClass == class'Bot') || (aClass == class'Pawn')) )
00249			DeathMatchPlus(Level.Game).MinPlayers = 0;
00250	
00251		Super.KillAll(aClass);
00252	}
00253	
00254	function ClientPutDown(Weapon Current, Weapon Next)
00255	{	
00256		if ( Role == ROLE_Authority )
00257			return;
00258		bNeedActivate = false;
00259		if ( (Current != None) && (Current != Next) )
00260			Current.ClientPutDown(Next);
00261		else if ( Weapon != None )
00262		{
00263			if ( Weapon != Next )
00264				Weapon.ClientPutDown(Next);
00265			else
00266			{
00267				bNeedActivate = false;
00268				ClientPending = None;
00269				if ( Weapon.IsInState('ClientDown') || !Weapon.IsAnimating() )
00270				{
00271					Weapon.GotoState('');
00272					Weapon.TweenToStill();
00273				}
00274			}
00275		}
00276	}
00277	
00278	function SendFire(Weapon W)
00279	{
00280		WeaponUpdate++;
00281		SendClientFire(W,WeaponUpdate);
00282	}
00283	
00284	function SendAltFire(Weapon W)
00285	{
00286		WeaponUpdate++;
00287		SendClientAltFire(W,WeaponUpdate);
00288	}
00289	
00290	function UpdateRealWeapon(Weapon W)
00291	{
00292		WeaponUpdate++;
00293		RealWeapon(W,WeaponUpdate);
00294	}
00295		
00296	function RealWeapon(weapon Real, int N)
00297	{
00298		if ( N <= WeaponUpdate )
00299			return;
00300		WeaponUpdate = N;
00301		Weapon = Real;
00302		if ( (Weapon != None) && !Weapon.IsAnimating() )
00303		{
00304			if ( bNeedActivate || (Weapon == ClientPending) )
00305				Weapon.GotoState('ClientActive');
00306			else
00307				Weapon.TweenToStill();
00308		}
00309		bNeedActivate = false;
00310		ClientPending = None;	// make sure no client side weapon changes pending
00311	}
00312	
00313	function ReplicateMove
00314	(
00315		float DeltaTime, 
00316		vector NewAccel, 
00317		eDodgeDir DodgeMove, 
00318		rotator DeltaRot
00319	)
00320	{
00321		Super.ReplicateMove(DeltaTime,NewAccel,DodgeMove,DeltaRot);
00322		if ( (Weapon != None) && !Weapon.IsAnimating() )
00323		{
00324			if ( (Weapon == ClientPending) || (Weapon != OldClientWeapon) )
00325			{
00326				if ( Weapon.IsInState('ClientActive') )
00327					AnimEnd();
00328				else
00329					Weapon.GotoState('ClientActive');
00330				if ( (Weapon != ClientPending) && (myHUD != None) && myHUD.IsA('ChallengeHUD') )
00331					ChallengeHUD(myHUD).WeaponNameFade = 1.3;
00332				if ( (Weapon != OldClientWeapon) && (OldClientWeapon != None) )
00333					OldClientWeapon.GotoState('');
00334	
00335				ClientPending = None;
00336				bNeedActivate = false;
00337			}
00338			else
00339			{
00340				Weapon.GotoState('');
00341				Weapon.TweenToStill();
00342			}
00343		}
00344		OldClientWeapon = Weapon;
00345	}
00346		
00347	function TimeMessage(int Num)
00348	{
00349		if ( TimeMessageClass == None )
00350			TimeMessageClass = class<CriticalEventPlus>(DynamicLoadObject("Botpack.TimeMessage", class'Class'));
00351		ReceiveLocalizedMessage( TimeMessageClass, 16 - Num );
00352	}
00353	
00354	function SetVoice(class<ChallengeVoicePack> V)
00355	{
00356		PlayerReplicationInfo.VoiceType = V;
00357		UpdateURL("Voice", string(V), True);
00358		ServerSetVoice(V);
00359	}
00360	
00361	function ServerSetVoice(class<ChallengeVoicePack> V)
00362	{
00363		PlayerReplicationInfo.VoiceType = V;
00364	}
00365	
00366	exec function ListBots()
00367	{
00368		local Pawn P;
00369	
00370		for (P=Level.PawnList; P!=None; P=P.NextPawn)
00371			if ( P.bIsPlayer && P.IsA('Bot') ) 
00372				log(P.PlayerReplicationInfo.PlayerName$" skill "$P.Skill$" novice "$Bot(P).bNovice);
00373	}
00374	
00375	function PreSetMovement()
00376	{
00377		bCanJump = true;
00378		bCanWalk = true;
00379		bCanSwim = true;
00380		bCanFly = false;
00381		bCanOpenDoors = true;
00382		bCanDoSpecial = true;
00383	}
00384	
00385	function ServerSetTaunt(bool B)
00386	{
00387		bAutoTaunt = B;
00388	}
00389	
00390	function SetAutoTaunt(bool B)
00391	{
00392		bAutoTaunt = B;
00393		ServerSetTaunt(B);
00394	}
00395	
00396	function ServerSetInstantRocket(bool B)
00397	{
00398		bInstantRocket = B;
00399	}
00400	
00401	exec function SetInstantRocket(bool B)
00402	{
00403		bInstantRocket = B;
00404		ServerSetInstantRocket(B);
00405	}
00406	
00407	function ChangeSetHand( string S )
00408	{
00409		Super.ChangeSetHand(S);
00410		if ( Handedness == 1 )
00411			LoadLeftHand();
00412	}
00413	
00414	function LoadLeftHand()
00415	{
00416		local mesh M;
00417	
00418		// load left handed weapon meshes
00419		M = mesh(DynamicLoadObject("Botpack.PulseGunL", class'Mesh'));
00420		M = mesh(DynamicLoadObject("Botpack.Rifle2mL", class'Mesh'));
00421		M = mesh(DynamicLoadObject("Botpack.EightML", class'Mesh'));
00422		M = mesh(DynamicLoadObject("Botpack.Minigun2L", class'Mesh'));
00423	}
00424	
00425	event Possess()
00426	{
00427		local byte i;
00428	
00429		if ( Handedness == 1 )
00430			LoadLeftHand();
00431	
00432		if ( Level.Netmode == NM_Client )
00433		{
00434			ServerSetTaunt(bAutoTaunt);
00435			ServerSetInstantRocket(bInstantRocket);
00436		}
00437	
00438		Super.Possess();
00439	}
00440	
00441	function ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
00442	{
00443		if ( bNoVoiceMessages )
00444			return;
00445		if ( bNoVoiceTaunts && ((messageType == 'TAUNT') || (messageType == 'AUTOTAUNT')) )
00446			return;
00447		if ( bNoAutoTaunts && (messageType == 'AUTOTAUNT') )
00448			return;
00449	
00450		Super.ClientVoiceMessage(Sender, Recipient, messagetype, messageID);
00451	}
00452	
00453	function SendGlobalMessage(PlayerReplicationInfo Recipient, name MessageType, byte MessageID, float Wait)
00454	{
00455		if ( Level.TimeSeconds - OldMessageTime < 5 )
00456			return;
00457	
00458		SendVoiceMessage(PlayerReplicationInfo, Recipient, MessageType, MessageID, 'GLOBAL');
00459	}
00460	
00461	
00462	function SendTeamMessage(PlayerReplicationInfo Recipient, name MessageType, byte MessageID, float Wait)
00463	{
00464		if ( Level.TimeSeconds - OldMessageTime < 10 )
00465			return;
00466	
00467		SendVoiceMessage(PlayerReplicationInfo, Recipient, MessageType, MessageID, 'TEAM');
00468	}
00469	
00470	function Killed(pawn Killer, pawn Other, name damageType)
00471	{
00472		Super.Killed(Killer, Other, damageType);
00473	
00474		if ( (Killer == self) 
00475			&& (((bFire == 0) && (bAltFire == 0))
00476				|| ((Weapon != None) && !Weapon.IsA('Minigun2') && !Weapon.IsA('PulseGun'))) )
00477			Other.Health = FMin(Other.Health, -11); // don't let other do stagger death
00478	}
00479	
00480	exec function Loaded()
00481	{
00482		local inventory Inv;
00483		local weapon Weap;
00484		local DeathMatchPlus DM;
00485	
00486		if( !bCheatsEnabled )
00487			return;
00488		if( Level.Netmode!=NM_Standalone )
00489			return;
00490	
00491		DM = DeathMatchPlus(Level.Game);
00492		if ( DM == None )
00493			return;
00494	
00495		DM.GiveWeapon(self, "Botpack.PulseGun");
00496		DM.GiveWeapon(self, "Botpack.ShockRifle");
00497		DM.GiveWeapon(self, "Botpack.UT_FlakCannon");
00498		DM.GiveWeapon(self, "Botpack.UT_BioRifle");
00499		DM.GiveWeapon(self, "Botpack.Minigun2");
00500		DM.GiveWeapon(self, "Botpack.SniperRifle");
00501		DM.GiveWeapon(self, "Botpack.Ripper");
00502		DM.GiveWeapon(self, "Botpack.UT_Eightball");
00503		
00504		for ( inv=inventory; inv!=None; inv=inv.inventory )
00505		{
00506			weap = Weapon(inv);
00507			if ( (weap != None) && (weap.AmmoType != None) )
00508				weap.AmmoType.AmmoAmount = weap.AmmoType.MaxAmmo;
00509		}
00510	
00511		inv = Spawn(class'Armor2');
00512		if( inv != None )
00513		{
00514			inv.bHeldItem = true;
00515			inv.RespawnTime = 0.0;
00516			inv.GiveTo(self);
00517		}
00518		inv = Spawn(class'Thighpads');
00519		if( inv != None )
00520		{
00521			inv.bHeldItem = true;
00522			inv.RespawnTime = 0.0;
00523			inv.GiveTo(self);
00524		}
00525	}
00526	
00527	function PlayDodge(eDodgeDir DodgeMove)
00528	{
00529		Velocity.Z = 210;
00530		if ( DodgeMove == DODGE_Left )
00531			TweenAnim('DodgeL', 0.25);
00532		else if ( DodgeMove == DODGE_Right )
00533			TweenAnim('DodgeR', 0.25);
00534		else if ( DodgeMove == DODGE_Back )
00535			TweenAnim('DodgeB', 0.25);
00536		else 
00537			PlayAnim('Flip', 1.35 * FMax(0.35, Region.Zone.ZoneGravity.Z/Region.Zone.Default.ZoneGravity.Z), 0.06);
00538	}
00539	
00540	function PlayDyingSound()
00541	{
00542		local int rnd;
00543	
00544		if ( HeadRegion.Zone.bWaterZone )
00545		{
00546			if ( FRand() < 0.5 )
00547				PlaySound(UWHit1, SLOT_Pain,16,,,Frand()*0.2+0.9);
00548			else
00549				PlaySound(UWHit2, SLOT_Pain,16,,,Frand()*0.2+0.9);
00550			return;
00551		}
00552	
00553		rnd = Rand(6);
00554		PlaySound(Deaths[rnd], SLOT_Talk, 16);
00555		PlaySound(Deaths[rnd], SLOT_Pain, 16);
00556	}
00557	
00558	simulated function PlayBeepSound()
00559	{
00560		PlaySound(sound'NewBeep',SLOT_Interface, 2.0);
00561	}
00562	
00563	function PlayChatting()
00564	{
00565		if ( mesh != None )
00566			LoopAnim('Chat1', 0.7, 0.25);
00567	}
00568	
00569	function PlayWaiting()
00570	{
00571		local name newAnim;
00572	
00573		if ( Mesh == None )
00574			return;
00575	
00576		if ( bIsTyping )
00577		{
00578			PlayChatting();
00579			return;
00580		}
00581	
00582		if ( (IsInState('PlayerSwimming')) || (Physics == PHYS_Swimming) )
00583		{
00584			BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
00585			if ( (Weapon == None) || (Weapon.Mass < 20) )
00586				LoopAnim('TreadSM');
00587			else
00588				LoopAnim('TreadLG');
00589		}
00590		else
00591		{	
00592			BaseEyeHeight = Default.BaseEyeHeight;
00593			ViewRotation.Pitch = ViewRotation.Pitch & 65535;
00594			If ( (ViewRotation.Pitch > RotationRate.Pitch) 
00595				&& (ViewRotation.Pitch < 65536 - RotationRate.Pitch) )
00596			{
00597				If (ViewRotation.Pitch < 32768) 
00598				{
00599					if ( (Weapon == None) || (Weapon.Mass < 20) )
00600						TweenAnim('AimUpSm', 0.3);
00601					else
00602						TweenAnim('AimUpLg', 0.3);
00603				}
00604				else
00605				{
00606					if ( (Weapon == None) || (Weapon.Mass < 20) )
00607						TweenAnim('AimDnSm', 0.3);
00608					else
00609						TweenAnim('AimDnLg', 0.3);
00610				}
00611			}
00612			else if ( (Weapon != None) && Weapon.bPointing )
00613			{
00614				if ( Weapon.bRapidFire && ((bFire != 0) || (bAltFire != 0)) )
00615					LoopAnim('StillFRRP');
00616				else if ( Weapon.Mass < 20 )
00617					TweenAnim('StillSMFR', 0.3);
00618				else
00619					TweenAnim('StillFRRP', 0.3);
00620			}
00621			else
00622			{
00623				if ( FRand() < 0.1 )
00624				{
00625					if ( (Weapon == None) || (Weapon.Mass < 20) )
00626						PlayAnim('CockGun', 0.5 + 0.5 * FRand(), 0.3);
00627					else
00628						PlayAnim('CockGunL', 0.5 + 0.5 * FRand(), 0.3);
00629				}
00630				else
00631				{
00632					if ( (Weapon == None) || (Weapon.Mass < 20) )
00633					{
00634						if ( (FRand() < 0.75) && ((AnimSequence == 'Breath1') || (AnimSequence == 'Breath2')) )
00635							newAnim = AnimSequence;
00636						else if ( FRand() < 0.5 )
00637							newAnim = 'Breath1';
00638						else
00639							newAnim = 'Breath2';
00640					}
00641					else
00642					{
00643						if ( (FRand() < 0.75) && ((AnimSequence == 'Breath1L') || (AnimSequence == 'Breath2L')) )
00644							newAnim = AnimSequence;
00645						else if ( FRand() < 0.5 )
00646							newAnim = 'Breath1L';
00647						else
00648							newAnim = 'Breath2L';
00649					}
00650									
00651					if ( AnimSequence == newAnim )
00652						LoopAnim(newAnim, 0.4 + 0.4 * FRand());
00653					else
00654						PlayAnim(newAnim, 0.4 + 0.4 * FRand(), 0.25);
00655				}
00656			}
00657		}
00658	}
00659	
00660	function EndSpree(PlayerReplicationInfo Killer, PlayerReplicationInfo Other)
00661	{
00662		if ( (Killer == Other) || (Killer == None) )
00663			ReceiveLocalizedMessage( class'KillingSpreeMessage', 1, None, Other );
00664		else
00665			ReceiveLocalizedMessage( class'KillingSpreeMessage', 0, Other, Killer );
00666	}
00667	
00668	exec function IAmTheOne()
00669	{
00670		// What are you doing looking at this?!  CHEATER!!!
00671		bCheatsEnabled = True;
00672	}
00673	
00674	exec function SetAirControl(float F)
00675	{
00676		if ( bAdmin || (Level.Netmode == NM_Standalone) )
00677			AirControl = F;
00678	}
00679	
00680	exec function Verbose()
00681	{
00682		if ( Bot(ViewTarget) != None )
00683			Bot(ViewTarget).bVerbose = true;
00684	}
00685	
00686	// Skip any map.
00687	exec function Advance()
00688	{
00689		if( !bCheatsEnabled )
00690			return;
00691		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
00692			return;
00693	
00694		if (Level.Game.IsA('DeathMatchPlus'))
00695			DeathMatchPlus(Level.Game).Skip();
00696	}
00697	
00698	// Skip all maps.
00699	exec function AdvanceAll()
00700	{
00701		if( !bCheatsEnabled )
00702			return;
00703		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
00704			return;
00705	
00706		if (Level.Game.IsA('DeathMatchPlus'))
00707			DeathMatchPlus(Level.Game).SkipAll();
00708	}
00709	
00710	/* Skin Stuff */
00711	static function GetMultiSkin( Actor SkinActor, out string SkinName, out string FaceName )
00712	{
00713		local string ShortSkinName, FullSkinName, ShortFaceName, FullFaceName;
00714	
00715		FullSkinName  = String(SkinActor.Multiskins[default.FixedSkin]);
00716		ShortSkinName = SkinActor.GetItemName(FullSkinName);
00717	
00718		FullFaceName = String(SkinActor.Multiskins[default.FaceSkin]);
00719		ShortFaceName = SkinActor.GetItemName(FullFaceName);
00720	
00721		SkinName = Left(FullSkinName, Len(FullSkinName) - Len(ShortSkinName)) $ Left(ShortSkinName, 4);
00722		FaceName = Left(FullFaceName, Len(FullFaceName) - Len(ShortFaceName)) $Mid(ShortFaceName, 5);
00723	}
00724	
00725	static function SetMultiSkin(Actor SkinActor, string SkinName, string FaceName, byte TeamNum)
00726	{
00727		local string MeshName, FacePackage, SkinItem, FaceItem, SkinPackage;
00728	
00729		MeshName = SkinActor.GetItemName(string(SkinActor.Mesh));
00730	
00731		SkinItem = SkinActor.GetItemName(SkinName);
00732		FaceItem = SkinActor.GetItemName(FaceName);
00733		FacePackage = Left(FaceName, Len(FaceName) - Len(FaceItem));
00734		SkinPackage = Left(SkinName, Len(SkinName) - Len(SkinItem));
00735	
00736		if(SkinPackage == "")
00737		{
00738			SkinPackage=default.DefaultPackage;
00739			SkinName=SkinPackage$SkinName;
00740		}
00741		if(FacePackage == "")
00742		{
00743			FacePackage=default.DefaultPackage;
00744			FaceName=FacePackage$FaceName;
00745		}
00746	
00747		// Set the fixed skin element.  If it fails, go to default skin & no face.
00748		if(!SetSkinElement(SkinActor, default.FixedSkin, SkinName$string(default.FixedSkin+1), default.DefaultSkinName$string(default.FixedSkin+1)))
00749		{
00750			SkinName = default.DefaultSkinName;
00751			FaceName = "";
00752		}
00753	
00754		// Set the face - if it fails, set the default skin for that face element.
00755		SetSkinElement(SkinActor, default.FaceSkin, FacePackage$SkinItem$String(default.FaceSkin+1)$FaceItem, SkinName$String(default.FaceSkin+1));
00756	
00757		// Set the team elements
00758		if( TeamNum != 255 )
00759		{
00760			SetSkinElement(SkinActor, default.TeamSkin1, SkinName$string(default.TeamSkin1+1)$"T_"$String(TeamNum), SkinName$string(default.TeamSkin1+1));
00761			SetSkinElement(SkinActor, default.TeamSkin2, SkinName$string(default.TeamSkin2+1)$"T_"$String(TeamNum), SkinName$string(default.TeamSkin2+1));
00762		}
00763		else
00764		{
00765			SetSkinElement(SkinActor, default.TeamSkin1, SkinName$string(default.TeamSkin1+1), "");
00766			SetSkinElement(SkinActor, default.TeamSkin2, SkinName$string(default.TeamSkin2+1), "");
00767		}
00768	
00769		// Set the talktexture
00770		if(Pawn(SkinActor) != None)
00771		{
00772			if(FaceName != "")
00773				Pawn(SkinActor).PlayerReplicationInfo.TalkTexture = Texture(DynamicLoadObject(FacePackage$SkinItem$"5"$FaceItem, class'Texture'));
00774			else
00775				Pawn(SkinActor).PlayerReplicationInfo.TalkTexture = None;
00776		}		
00777	}
00778	
00779	exec function Summon( string ClassName )
00780	{
00781		local class<actor> NewClass;
00782		if( !bCheatsEnabled )
00783			return;
00784		if( !bAdmin && (Level.Netmode != NM_Standalone) )
00785			return;
00786		if( instr(ClassName,".")==-1 )
00787			ClassName = "Botpack." $ ClassName;
00788		Super.Summon( ClassName );
00789	}
00790	
00791	function CheckBob(float DeltaTime, float Speed2D, vector Y)
00792	{
00793		local float OldBobTime;
00794		local int m,n;
00795	
00796		OldBobTime = BobTime;
00797		if ( Speed2D < 10 )
00798			BobTime += 0.2 * DeltaTime;
00799		else
00800			BobTime += DeltaTime * (0.3 + 0.7 * Speed2D/GroundSpeed);
00801		WalkBob = Y * 0.4 * Bob * Speed2D * sin(8 * BobTime);
00802		AppliedBob = AppliedBob * (1 - FMin(1, 16 * deltatime));
00803		if ( Speed2D < 10 )
00804			WalkBob.Z = AppliedBob;
00805		else
00806			WalkBob.Z = AppliedBob + 0.3 * Bob * Speed2D * sin(16 * BobTime);
00807		if ( LandBob > 0.01 )
00808		{
00809			AppliedBob += FMin(1, 16 * deltatime) * LandBob;
00810			LandBob *= (1 - 8*Deltatime);
00811		}
00812	
00813		if ( bBehindView || (Speed2D < 10) )
00814			return;
00815	
00816		m = int(0.5 * Pi + 9.0 * OldBobTime/Pi);
00817		n = int(0.5 * Pi + 9.0 * BobTime/Pi);
00818	
00819		if ( (m != n) && !bIsWalking )
00820			FootStepping();
00821	}
00822	
00823	simulated function PlayFootStep()
00824	{
00825		if ( (Level.NetMode != NM_Client) 
00826			&& ((Weapon == None) || !Weapon.bPointing) )
00827			MakeNoise(0.1);
00828	
00829		if ( bBehindView || (Role==ROLE_SimulatedProxy) )	
00830			FootStepping();
00831	}
00832	
00833	simulated function FootStepping()
00834	{
00835		local sound step;
00836		local float decision;
00837	
00838		if ( FootRegion.Zone.bWaterZone )
00839		{
00840			PlaySound(WaterStep, SLOT_Interact, 1, false, 1000.0, 1.0);
00841			return;
00842		}
00843	
00844		decision = FRand();
00845		if ( decision < 0.34 )
00846			step = Footstep1;
00847		else if (decision < 0.67 )
00848			step = Footstep2;
00849		else
00850			step = Footstep3;
00851	
00852		PlaySound(step, SLOT_Interact, 2.2, false, 1000.0, 1.0);
00853	}
00854	
00855	function PlayHit(float Damage, vector HitLocation, name damageType, vector Momentum)
00856	{
00857		local float rnd;
00858		local Bubble1 bub;
00859		local bool bServerGuessWeapon;
00860		local class<DamageType> DamageClass;
00861		local vector BloodOffset, Mo;
00862		local int iDam;
00863	
00864		if ( (Damage <= 0) && (ReducedDamageType != 'All') )
00865			return;
00866	
00867		//DamageClass = class(damageType);
00868		if ( ReducedDamageType != 'All' ) //spawn some blood
00869		{
00870			if (damageType == 'Drowned')
00871			{
00872				bub = spawn(class 'Bubble1',,, Location 
00873					+ 0.7 * CollisionRadius * vector(ViewRotation) + 0.3 * EyeHeight * vect(0,0,1));
00874				if (bub != None)
00875					bub.DrawScale = FRand()*0.06+0.04; 
00876			}
00877			else if ( (damageType != 'Burned') && (damageType != 'Corroded') 
00878						&& (damageType != 'Fell') )
00879			{
00880				BloodOffset = 0.2 * CollisionRadius * Normal(HitLocation - Location);
00881				BloodOffset.Z = BloodOffset.Z * 0.5;
00882				if ( (DamageType == 'shot') || (DamageType == 'decapitated') || (DamageType == 'shredded') )
00883				{
00884					Mo = Momentum;
00885					if ( Mo.Z > 0 )
00886						Mo.Z *= 0.5;
00887					spawn(class 'UT_BloodHit',self,,hitLocation + BloodOffset, rotator(Mo));
00888				}
00889				else
00890					spawn(class 'UT_BloodBurst',self,,hitLocation + BloodOffset);
00891			}
00892		}	
00893	
00894		rnd = FClamp(Damage, 20, 60);
00895		if ( damageType == 'Burned' )
00896			ClientFlash( -0.009375 * rnd, rnd * vect(16.41, 11.719, 4.6875));
00897		else if ( damageType == 'Corroded' )
00898			ClientFlash( -0.01171875 * rnd, rnd * vect(9.375, 14.0625, 4.6875));
00899		else if ( damageType == 'Drowned' )
00900			ClientFlash(-0.390, vect(312.5,468.75,468.75));
00901		else 
00902			ClientFlash( -0.019 * rnd, rnd * vect(26.5, 4.5, 4.5));
00903	
00904		ShakeView(0.15 + 0.005 * Damage, Damage * 30, 0.3 * Damage); 
00905		PlayTakeHitSound(Damage, damageType, 1);
00906		bServerGuessWeapon = ( ((Weapon != None) && Weapon.bPointing) || (GetAnimGroup(AnimSequence) == 'Dodge') );
00907		iDam = Clamp(Damage,0,200);
00908		ClientPlayTakeHit(hitLocation - Location, iDam, bServerGuessWeapon ); 
00909		if ( !bServerGuessWeapon 
00910			&& ((Level.NetMode == NM_DedicatedServer) || (Level.NetMode == NM_ListenServer)) )
00911		{
00912			Enable('AnimEnd');
00913			BaseEyeHeight = Default.BaseEyeHeight;
00914			bAnimTransition = true;
00915			PlayTakeHit(0.1, hitLocation, Damage);
00916		}
00917	}
00918	
00919	function PlayDeathHit(float Damage, vector HitLocation, name damageType, vector Momentum)
00920	{
00921		local Bubble1 bub;
00922		local vector Mo;
00923	
00924		if ( Region.Zone.bDestructive && (Region.Zone.ExitActor != None) )
00925			Spawn(Region.Zone.ExitActor);
00926		if (HeadRegion.Zone.bWaterZone)
00927		{
00928			bub = spawn(class 'Bubble1',,, Location 
00929				+ 0.3 * CollisionRadius * vector(Rotation) + 0.8 * EyeHeight * vect(0,0,1));
00930			if (bub != None)
00931				bub.DrawScale = FRand()*0.08+0.03; 
00932			bub = spawn(class 'Bubble1',,, Location 
00933				+ 0.2 * CollisionRadius * VRand() + 0.7 * EyeHeight * vect(0,0,1));
00934			if (bub != None)
00935				bub.DrawScale = FRand()*0.08+0.03; 
00936			bub = spawn(class 'Bubble1',,, Location 
00937				+ 0.3 * CollisionRadius * VRand() + 0.6 * EyeHeight * vect(0,0,1));
00938			if (bub != None)
00939				bub.DrawScale = FRand()*0.08+0.03; 
00940		}
00941	
00942		if ( (!Level.bDropDetail || (FRand() < 0.67))
00943				&& ((DamageType == 'shot') || (DamageType == 'decapitated') || (DamageType == 'shredded')) )
00944		{
00945			Mo = Momentum;
00946			if ( Mo.Z > 0 )
00947				Mo.Z *= 0.5;
00948			spawn(class 'UT_BloodHit',self,,hitLocation, rotator(Mo));
00949		}
00950		else if ( (damageType != 'Drowned') && (damageType != 'Corroded') )
00951			spawn(class 'UT_BloodBurst',self,'', hitLocation);
00952	}
00953	
00954	//-----------------------------------------------------------------------------
00955	// Sound functions
00956	
00957	function PlayTakeHitSound(int damage, name damageType, int Mult)
00958	{
00959		if ( Level.TimeSeconds - LastPainSound < 0.3 )
00960			return;
00961		LastPainSound = Level.TimeSeconds;
00962	
00963		if ( HeadRegion.Zone.bWaterZone )
00964		{
00965			if ( damageType == 'Drowned' )
00966				PlaySound(drown, SLOT_Pain, 12);
00967			else if ( FRand() < 0.5 )
00968				PlaySound(UWHit1, SLOT_Pain,16,,,Frand()*0.15+0.9);
00969			else
00970				PlaySound(UWHit2, SLOT_Pain,16,,,Frand()*0.15+0.9);
00971			return;
00972		}
00973		damage *= FRand();
00974	
00975		if (damage < 8) 
00976			PlaySound(HitSound1, SLOT_Pain,16,,,Frand()*0.15+0.9);
00977		else if (damage < 25)
00978		{
00979			if (FRand() < 0.5) PlaySound(HitSound2, SLOT_Pain,16,,,Frand()*0.15+0.9);			
00980			else PlaySound(HitSound3, SLOT_Pain,16,,,Frand()*0.15+0.9);
00981		}
00982		else
00983			PlaySound(HitSound4, SLOT_Pain,16,,,Frand()*0.15+0.9);			
00984	}
00985	
00986	function ClientPlayTakeHit(vector HitLoc, byte Damage, bool bServerGuessWeapon)
00987	{
00988		local ChallengeHUD CHUD;
00989	
00990		CHUD = ChallengeHUD(myHUD);
00991		if ( CHUD != None )
00992			CHUD.SetDamage(HitLoc, damage);
00993	
00994		HitLoc += Location;
00995		if ( bServerGuessWeapon && ((GetAnimGroup(AnimSequence) == 'Dodge') || ((Weapon != None) && Weapon.bPointing)) )
00996			return;
00997		Enable('AnimEnd');
00998		bAnimTransition = true;
00999		BaseEyeHeight = Default.BaseEyeHeight;
01000		PlayTakeHit(0.1, HitLoc, Damage);
01001	}	
01002	
01003	function Gasp()
01004	{
01005		if ( Role != ROLE_Authority )
01006			return;
01007		if ( PainTime < 2 )
01008			PlaySound(GaspSound, SLOT_Talk, 2.0);
01009		else
01010			PlaySound(BreathAgain, SLOT_Talk, 2.0);
01011	}
01012	
01013	//-----------------------------------------------------------------------------
01014	// Animation functions
01015	
01016	function PlayTurning()
01017	{
01018		BaseEyeHeight = Default.BaseEyeHeight;
01019		if ( (Weapon == None) || (Weapon.Mass < 20) )
01020			PlayAnim('TurnSM', 0.3, 0.3);
01021		else
01022			PlayAnim('TurnLG', 0.3, 0.3);
01023	}
01024	
01025	function TweenToWalking(float tweentime)
01026	{
01027		BaseEyeHeight = Default.BaseEyeHeight;
01028		if (Weapon == None)
01029			TweenAnim('Walk', tweentime);
01030		else if ( Weapon.bPointing || (CarriedDecoration != None) ) 
01031		{
01032			if (Weapon.Mass < 20)
01033				TweenAnim('WalkSMFR', tweentime);
01034			else
01035				TweenAnim('WalkLGFR', tweentime);
01036		}
01037		else
01038		{
01039			if (Weapon.Mass < 20)
01040				TweenAnim('WalkSM', tweentime);
01041			else
01042				TweenAnim('WalkLG', tweentime);
01043		} 
01044	}
01045	
01046	function PlayWalking()
01047	{
01048		BaseEyeHeight = Default.BaseEyeHeight;
01049		if (Weapon == None)
01050			LoopAnim('Walk');
01051		else if ( Weapon.bPointing || (CarriedDecoration != None) ) 
01052		{
01053			if (Weapon.Mass < 20)
01054				LoopAnim('WalkSMFR');
01055			else
01056				LoopAnim('WalkLGFR');
01057		}
01058		else
01059		{
01060			if (Weapon.Mass < 20)
01061				LoopAnim('WalkSM');
01062			else
01063				LoopAnim('WalkLG');
01064		}
01065	}
01066	
01067	function TweenToRunning(float tweentime)
01068	{
01069		local vector X,Y,Z, Dir;
01070	
01071		BaseEyeHeight = Default.BaseEyeHeight;
01072		if (bIsWalking)
01073		{
01074			TweenToWalking(0.1);
01075			return;
01076		}
01077	
01078		GetAxes(Rotation, X,Y,Z);
01079		Dir = Normal(Acceleration);
01080		if ( (Dir Dot X < 0.75) && (Dir != vect(0,0,0)) )
01081		{
01082			// strafing or backing up
01083			if ( Dir Dot X < -0.75 )
01084				PlayAnim('BackRun', 0.9, tweentime);
01085			else if ( Dir Dot Y > 0 )
01086				PlayAnim('StrafeR', 0.9, tweentime);
01087			else
01088				PlayAnim('StrafeL', 0.9, tweentime);
01089		}
01090		else if (Weapon == None)
01091			PlayAnim('RunSM', 0.9, tweentime);
01092		else if ( Weapon.bPointing ) 
01093		{
01094			if (Weapon.Mass < 20)
01095				PlayAnim('RunSMFR', 0.9, tweentime);
01096			else
01097				PlayAnim('RunLGFR', 0.9, tweentime);
01098		}
01099		else
01100		{
01101			if (Weapon.Mass < 20)
01102				PlayAnim('RunSM', 0.9, tweentime);
01103			else
01104				PlayAnim('RunLG', 0.9, tweentime);
01105		} 
01106	}
01107	
01108	function PlayRunning()
01109	{
01110		local vector X,Y,Z, Dir;
01111	
01112		BaseEyeHeight = Default.BaseEyeHeight;
01113	
01114		// determine facing direction
01115		GetAxes(Rotation, X,Y,Z);
01116		Dir = Normal(Acceleration);
01117		if ( (Dir Dot X < 0.75) && (Dir != vect(0,0,0)) )
01118		{
01119			// strafing or backing up
01120			if ( Dir Dot X < -0.75 )
01121				LoopAnim('BackRun');
01122			else if ( Dir Dot Y > 0 )
01123				LoopAnim('StrafeR');
01124			else
01125				LoopAnim('StrafeL');
01126		}
01127		else if (Weapon == None)
01128			LoopAnim('RunSM');
01129		else if ( Weapon.bPointing ) 
01130		{
01131			if (Weapon.Mass < 20)
01132				LoopAnim('RunSMFR');
01133			else
01134				LoopAnim('RunLGFR');
01135		}
01136		else
01137		{
01138			if (Weapon.Mass < 20)
01139				LoopAnim('RunSM');
01140			else
01141				LoopAnim('RunLG');
01142		}
01143	}
01144	
01145	function PlayRising()
01146	{
01147		BaseEyeHeight = 0.4 * Default.BaseEyeHeight;
01148		TweenAnim('DuckWlkS', 0.7);
01149	}
01150	
01151	function PlayFeignDeath()
01152	{
01153		local float decision;
01154	
01155		BaseEyeHeight = 0;
01156		decision = frand();
01157		if ( decision < 0.33 )
01158			TweenAnim('DeathEnd', 0.5);
01159		else if ( decision < 0.67 )
01160			TweenAnim('DeathEnd2', 0.5);
01161		else 
01162			TweenAnim('DeathEnd3', 0.5);
01163	}
01164	
01165	function PlayGutHit(float tweentime)
01166	{
01167		if ( (AnimSequence == 'GutHit') || (AnimSequence == 'Dead2') )
01168		{
01169			if (FRand() < 0.5)
01170				TweenAnim('LeftHit', tweentime);
01171			else
01172				TweenAnim('RightHit', tweentime);
01173		}
01174		else if ( FRand() < 0.6 )
01175			TweenAnim('GutHit', tweentime);
01176		else
01177			TweenAnim('Dead2', tweentime);
01178	
01179	}
01180	
01181	function PlayHeadHit(float tweentime)
01182	{
01183		if ( (AnimSequence == 'HeadHit') || (AnimSequence == 'Dead4') )
01184			TweenAnim('GutHit', tweentime);
01185		else if ( FRand() < 0.6 )
01186			TweenAnim('HeadHit', tweentime);
01187		else
01188			TweenAnim('Dead4', tweentime);
01189	}
01190	
01191	function PlayLeftHit(float tweentime)
01192	{
01193		if ( (AnimSequence == 'LeftHit') || (AnimSequence == 'Dead3') )
01194			TweenAnim('GutHit', tweentime);
01195		else if ( FRand() < 0.6 )
01196			TweenAnim('LeftHit', tweentime);
01197		else 
01198			TweenAnim('Dead3', tweentime);
01199	}
01200	
01201	function PlayRightHit(float tweentime)
01202	{
01203		if ( (AnimSequence == 'RightHit') || (AnimSequence == 'Dead5') )
01204			TweenAnim('GutHit', tweentime);
01205		else if ( FRand() < 0.6 )
01206			TweenAnim('RightHit', tweentime);
01207		else
01208			TweenAnim('Dead5', tweentime);
01209	}
01210		
01211	function PlayLanded(float impactVel)
01212	{	
01213		impactVel = impactVel/JumpZ;
01214		impactVel = 0.1 * impactVel * impactVel;
01215		BaseEyeHeight = Default.BaseEyeHeight;
01216	
01217		if ( impactVel > 0.17 )
01218			PlayOwnedSound(LandGrunt, SLOT_Talk, FMin(5, 5 * impactVel),false,1200,FRand()*0.4+0.8);
01219		if ( !FootRegion.Zone.bWaterZone && (impactVel > 0.01) )
01220			PlayOwnedSound(Land, SLOT_Interact, FClamp(4 * impactVel,0.5,5), false,1000, 1.0);
01221		if ( (impactVel > 0.06) || (GetAnimGroup(AnimSequence) == 'Jumping') || (GetAnimGroup(AnimSequence) == 'Ducking') )
01222		{
01223			if ( (Weapon == None) || (Weapon.Mass < 20) )
01224				TweenAnim('LandSMFR', 0.12);
01225			else
01226				TweenAnim('LandLGFR', 0.12);
01227		}
01228		else if ( !IsAnimating() )
01229		{
01230			if ( GetAnimGroup(AnimSequence) == 'TakeHit' )
01231			{
01232				SetPhysics(PHYS_Walking);
01233				AnimEnd();
01234			}
01235			else 
01236			{
01237				if ( (Weapon == None) || (Weapon.Mass < 20) )
01238					TweenAnim('LandSMFR', 0.12);
01239				else
01240					TweenAnim('LandLGFR', 0.12);
01241			}
01242		}
01243	}
01244		
01245	function PlayInAir()
01246	{
01247		local vector X,Y,Z, Dir;
01248		local float f, TweenTime;
01249	
01250		BaseEyeHeight =  0.7 * Default.BaseEyeHeight;
01251	
01252		if ( (GetAnimGroup(AnimSequence) == 'Landing') && !bLastJumpAlt )
01253		{
01254			GetAxes(Rotation, X,Y,Z);
01255			Dir = Normal(Acceleration);
01256			f = Dir dot Y;
01257			if ( f > 0.7 )
01258				TweenAnim('DodgeL', 0.35);
01259			else if ( f < -0.7 )
01260				TweenAnim('DodgeR', 0.35);
01261			else if ( Dir dot X > 0 )
01262				TweenAnim('DodgeF', 0.35);
01263			else
01264				TweenAnim('DodgeB', 0.35);
01265			bLastJumpAlt = true;
01266			return;
01267		}
01268		bLastJumpAlt = false;
01269		if ( GetAnimGroup(AnimSequence) == 'Jumping' )
01270		{
01271			if ( (Weapon == None) || (Weapon.Mass < 20) )
01272				TweenAnim('DuckWlkS', 2);
01273			else
01274				TweenAnim('DuckWlkL', 2);
01275			return;
01276		}
01277		else if ( GetAnimGroup(AnimSequence) == 'Ducking' )
01278			TweenTime = 2;
01279		else 
01280			TweenTime = 0.7;
01281	
01282		if ( AnimSequence == 'StrafeL' )
01283			TweenAnim('DodgeR', TweenTime);
01284		else if ( AnimSequence == 'StrafeR' )
01285			TweenAnim('DodgeL', TweenTime);
01286		else if ( AnimSequence == 'BackRun' )
01287			TweenAnim('DodgeB', TweenTime);
01288		else if ( (Weapon == None) || (Weapon.Mass < 20) )
01289			TweenAnim('JumpSMFR', TweenTime);
01290		else
01291			TweenAnim('JumpLGFR', TweenTime); 
01292	}
01293	
01294	function PlayDuck()
01295	{
01296		BaseEyeHeight = 0;
01297		if ( (Weapon == None) || (Weapon.Mass < 20) )
01298			TweenAnim('DuckWlkS', 0.25);
01299		else
01300			TweenAnim('DuckWlkL', 0.25);
01301	}
01302	
01303	function PlayCrawling()
01304	{
01305		//log("Play duck");
01306		BaseEyeHeight = 0;
01307		if ( (Weapon == None) || (Weapon.Mass < 20) )
01308			LoopAnim('DuckWlkS');
01309		else
01310			LoopAnim('DuckWlkL');
01311	}
01312	
01313	function TweenToWaiting(float tweentime)
01314	{
01315		if ( (IsInState('PlayerSwimming')) || (Physics == PHYS_Swimming) )
01316		{
01317			BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
01318			if ( (Weapon == None) || (Weapon.Mass < 20) )
01319				TweenAnim('TreadSM', tweentime);
01320			else
01321				TweenAnim('TreadLG', tweentime);
01322		}
01323		else
01324		{
01325			BaseEyeHeight = Default.BaseEyeHeight;
01326			if ( (Weapon == None) || (Weapon.Mass < 20) )
01327				TweenAnim('StillSMFR', tweentime);
01328			else 
01329				TweenAnim('StillFRRP', tweentime);
01330		}
01331	}
01332		
01333	function PlayRecoil(float Rate)
01334	{
01335		if ( Weapon.bRapidFire )
01336		{
01337			if ( !IsAnimating() && (Physics == PHYS_Walking) )
01338				LoopAnim('StillFRRP', 0.02);
01339		}
01340		else if ( AnimSequence == 'StillSmFr' )
01341			PlayAnim('StillSmFr', Rate, 0.02);
01342		else if ( (AnimSequence == 'StillLgFr') || (AnimSequence == 'StillFrRp') )	
01343			PlayAnim('StillLgFr', Rate, 0.02);
01344	}
01345	
01346	function PlayFiring()
01347	{
01348		// switch animation sequence mid-stream if needed
01349		if (AnimSequence == 'RunLG')
01350			AnimSequence = 'RunLGFR';
01351		else if (AnimSequence == 'RunSM')
01352			AnimSequence = 'RunSMFR';
01353		else if (AnimSequence == 'WalkLG')
01354			AnimSequence = 'WalkLGFR';
01355		else if (AnimSequence == 'WalkSM')
01356			AnimSequence = 'WalkSMFR';
01357		else if ( AnimSequence == 'JumpSMFR' )
01358			TweenAnim('JumpSMFR', 0.03);
01359		else if ( AnimSequence == 'JumpLGFR' )
01360			TweenAnim('JumpLGFR', 0.03);
01361		else if ( (GetAnimGroup(AnimSequence) == 'Waiting') || (GetAnimGroup(AnimSequence) == 'Gesture')
01362			&& (AnimSequence != 'TreadLG') && (AnimSequence != 'TreadSM') )
01363		{
01364			if ( Weapon.Mass < 20 )
01365				TweenAnim('StillSMFR', 0.02);
01366			else
01367				TweenAnim('StillFRRP', 0.02);
01368		}
01369	}
01370	
01371	function PlayWeaponSwitch(Weapon NewWeapon)
01372	{
01373		if ( (Weapon == None) || (Weapon.Mass < 20) )
01374		{
01375			if ( (NewWeapon != None) && (NewWeapon.Mass > 20) )
01376			{
01377				if ( (AnimSequence == 'RunSM') || (AnimSequence == 'RunSMFR') )
01378					AnimSequence = 'RunLG';
01379				else if ( (AnimSequence == 'WalkSM') || (AnimSequence == 'WalkSMFR') )
01380					AnimSequence = 'WalkLG';	
01381			 	else if ( AnimSequence == 'JumpSMFR' )
01382			 		AnimSequence = 'JumpLGFR';
01383				else if ( AnimSequence == 'DuckWlkL' )
01384					AnimSequence = 'DuckWlkS';
01385			 	else if ( AnimSequence == 'StillSMFR' )
01386			 		AnimSequence = 'StillFRRP';
01387				else if ( AnimSequence == 'AimDnSm' )
01388					AnimSequence = 'AimDnLg';
01389				else if ( AnimSequence == 'AimUpSm' )
01390					AnimSequence = 'AimUpLg';
01391			 }	
01392		}
01393		else if ( (NewWeapon == None) || (NewWeapon.Mass < 20) )
01394		{		
01395			if ( (AnimSequence == 'RunLG') || (AnimSequence == 'RunLGFR') )
01396				AnimSequence = 'RunSM';
01397			else if ( (AnimSequence == 'WalkLG') || (AnimSequence == 'WalkLGFR') )
01398				AnimSequence = 'WalkSM';
01399		 	else if ( AnimSequence == 'JumpLGFR' )
01400		 		AnimSequence = 'JumpSMFR';
01401			else if ( AnimSequence == 'DuckWlkS' )
01402				AnimSequence = 'DuckWlkL';
01403		 	else if (AnimSequence == 'StillFRRP')
01404		 		AnimSequence = 'StillSMFR';
01405			else if ( AnimSequence == 'AimDnLg' )
01406				AnimSequence = 'AimDnSm';
01407			else if ( AnimSequence == 'AimUpLg' )
01408				AnimSequence = 'AimUpSm';
01409		}
01410	}
01411	
01412	function PlaySwimming()
01413	{
01414		BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
01415		if ((Weapon == None) || (Weapon.Mass < 20) )
01416			LoopAnim('SwimSM');
01417		else
01418			LoopAnim('SwimLG');
01419	}
01420	
01421	function TweenToSwimming(float tweentime)
01422	{
01423		BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
01424		if ((Weapon == None) || (Weapon.Mass < 20) )
01425			TweenAnim('SwimSM',tweentime);
01426		else
01427			TweenAnim('SwimLG',tweentime);
01428	}
01429	
01430	function NeedActivate()
01431	{
01432		bNeedActivate = true;
01433	}
01434	
01435	state FeigningDeath
01436	{
01437		function NeedActivate()
01438		{
01439			bNeedActivate = false;
01440		}
01441	
01442		function BeginState()
01443		{
01444			if ( (Role == ROLE_Authority) && (PlayerReplicationInfo.HasFlag != None)
01445				&& PlayerReplicationInfo.HasFlag.IsA('CTFFlag')  )
01446				PlayerReplicationInfo.HasFlag.Drop(vect(0,0,0));
01447			Super.BeginState();
01448			bNeedActivate = false;
01449		}
01450	}
01451	
01452	state Dying
01453	{
01454	ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, SwitchWeapon, Falling, PainTimer;
01455	
01456		function ViewFlash(float DeltaTime)
01457		{
01458			if ( Carcass(ViewTarget) != None )
01459			{
01460				InstantFlash = -0.3;
01461				InstantFog = vect(0.25, 0.03, 0.03);
01462			}
01463			Super.ViewFlash(DeltaTime);
01464		}
01465	
01466		function BeginState()
01467		{
01468			Super.BeginState();
01469			LastKillTime = 0;
01470		}
01471	}
01472		
01473	state GameEnded
01474	{
01475		ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, TakeDamage, PainTimer, Died;
01476	
01477		exec function Fire( optional float F )
01478		{
01479			if ( Role < ROLE_Authority )
01480				return;
01481	
01482			if ( (Level.NetMode == NM_Standalone) && !bFrozen )
01483				ServerReStartGame();
01484		}
01485	}
01486	
01487	defaultproperties
01488	{
01489	     spreenote(0)="is on a killing spree!"
01490	     spreenote(1)="is on a rampage!"
01491	     spreenote(2)="is dominating!"
01492	     spreenote(3)="is brutalizing the competition!"
01493	     spreenote(4)="is unstoppable!"
01494	     spreenote(5)="owns you!"
01495	     spreenote(6)="needs to find some real competition!"
01496	     spreenote(7)="is a GOD!"
01497	     LastKillTime=-1000.000000
01498	     Footstep1=Sound'Botpack.FemaleSounds.(All).stone02'
01499	     Footstep2=Sound'Botpack.FemaleSounds.(All).stone04'
01500	     Footstep3=Sound'Botpack.FemaleSounds.(All).stone05'
01501	     StatusDoll=Texture'Botpack.Icons.Man'
01502	     StatusBelt=Texture'Botpack.Icons.ManBelt'
01503	     VoicePackMetaClass="BotPack.ChallengeVoicePack"
01504	     AnnouncerVolume=4
01505	     bSinglePlayer=True
01506	     bCheatsEnabled=True
01507	     bCanStrafe=True
01508	     bIsHuman=True
01509	     bIsMultiSkinned=True
01510	     MeleeRange=50.000000
01511	     GroundSpeed=400.000000
01512	     AirSpeed=400.000000
01513	     AccelRate=2048.000000
01514	     AirControl=0.350000
01515	     BaseEyeHeight=27.000000
01516	     EyeHeight=27.000000
01517	     UnderWaterTime=20.000000
01518	     Intelligence=BRAINS_HUMAN
01519	     Land=Sound'UnrealShare.Generic.Land1'
01520	     WaterStep=Sound'UnrealShare.Generic.LSplash'
01521	     VoiceType="BotPack.VoiceMaleOne"
01522	     AnimSequence=WalkSm
01523	     DrawType=DT_Mesh
01524	     AmbientGlow=17
01525	     CollisionRadius=17.000000
01526	     CollisionHeight=39.000000
01527	     LightBrightness=70
01528	     LightHue=40
01529	     LightSaturation=128
01530	     LightRadius=6
01531	     Buoyancy=99.000000
01532	     RotationRate=(Pitch=3072,Yaw=65000,Roll=2048)
01533	}

End Source Code