Botpack
Class FortStandard

source: e:\games\UnrealTournament\Botpack\Classes\FortStandard.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--Botpack.StationaryPawn
            |
            +--Botpack.FortStandard
Direct Known Subclasses:None

class FortStandard
extends Botpack.StationaryPawn

//============================================================================= // FortStandard. //=============================================================================
Variables
 float ChargeDist
           Fort to fallback to if this one is destroyed;
 float DamageEventThreshold[8]
           Fort to fallback to if this one is destroyed;
 name DamageEvent[8]
           Fort to fallback to if this one is destroyed;
 Pawn Defender
           how long defenders must defend base (in minutes)
 byte DefensePriority
 int DefenseTime
           how long defenders must defend base (in minutes)
 string DestroyedMessage
           Fort to fallback to if this one is destroyed;
 name EndCamTag
           Fort to fallback to if this one is destroyed;
 name FallBackFort
           Fort to fallback to if this one is destroyed;
 string FortName
           Fort to fallback to if this one is destroyed;
 float LastHelpMessage
           how long defenders must defend base (in minutes)
 NavigationPoint NearestPath
           Fort to fallback to if this one is destroyed;
 name NearestPathNodeTag
           how long defenders must defend base (in minutes)
 bool bFinalFort
 bool bFlashing
 bool bForceRadius
 bool bSayDestroyed
 bool bSelfDisplayed
 bool bTriggerOnly


Function Summary
 void DestroyFort(Pawn InstigatedBy)
 void Destroyed()
 String GetHumanName()
 void PostBeginPlay()
 void TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
 void Timer()
 void Touch(Actor Other)
 void Trigger(Actor Other, Pawn EventInstigator)



Source Code


00001	//=============================================================================
00002	// FortStandard.
00003	//=============================================================================
00004	class FortStandard extends StationaryPawn;
00005	
00006	#exec AUDIO IMPORT FILE="Sounds\Domination\teleprt28.WAV" NAME="ControlSound" GROUP="Domination"
00007	#exec AUDIO IMPORT FILE="Sounds\Domination\uLNitro1.WAV" NAME="WarningSound" GROUP="Domination"
00008	
00009	var() bool bSelfDisplayed;
00010	var() bool bTriggerOnly;
00011	var() bool bFlashing;
00012	var() bool bSayDestroyed;
00013	var() bool bForceRadius;
00014	var() bool bFinalFort;
00015	
00016	var() byte DefensePriority;
00017	var() int DefenseTime;		// how long defenders must defend base (in minutes)
00018	var Pawn Defender;
00019	var float LastHelpMessage;
00020	var() name NearestPathNodeTag;
00021	var() name	FallBackFort;		// Fort to fallback to if this one is destroyed;
00022	var() float ChargeDist;
00023	var NavigationPoint NearestPath;
00024	var() name EndCamTag;
00025	var() localized string FortName;
00026	var() localized string DestroyedMessage;
00027	 
00028	var() name DamageEvent[8];
00029	var() float DamageEventThreshold[8];
00030	var	  int DamagePointer;
00031	var	  float TotalDamage;
00032	
00033	function PostBeginPlay()
00034	{
00035		local NavigationPoint N;
00036	
00037		if ( !Level.Game.IsA('Assault') )
00038		{
00039			Destroy();
00040			return;
00041		}
00042	
00043		if ( bTriggerOnly )
00044			bProjTarget = false;
00045	
00046		if ( NearestPathNodeTag != '' )
00047			for ( N=Level.NavigationPointList; N!=None; N=N.NextNavigationPoint )
00048				if ( N.Tag == NearestPathNodeTag )
00049				{
00050					NearestPath = N;
00051					break;
00052				}
00053	
00054		Super.PostBeginPlay();
00055		if (!bSelfDisplayed )
00056			DrawType = DT_None;
00057		LoopAnim('Wave', 0.5);
00058	}
00059	
00060	function String GetHumanName()
00061	{
00062		return FortName;
00063	}
00064	
00065	function Destroyed()
00066	{
00067		Super.Destroyed();
00068		if ( Level.Game.IsA('Assault') )
00069			Assault(Level.Game).RemoveFort(self, instigator);
00070	}
00071	
00072	function Touch( Actor Other )
00073	{
00074		if ( bTriggerOnly && Other.bIsPawn && Pawn(Other).bIsPlayer 
00075			&& (Pawn(Other).PlayerReplicationInfo.Team != Assault(Level.Game).Defender.TeamIndex) )
00076			DestroyFort(Pawn(Other));
00077	}
00078	
00079	function Trigger( actor Other, pawn EventInstigator )
00080	{
00081		if ( EventInstigator.bIsPlayer 
00082			&& (EventInstigator.PlayerReplicationInfo.Team != Assault(Level.Game).Defender.TeamIndex) )
00083			DestroyFort(EventInstigator);
00084	}
00085	
00086	function DestroyFort(pawn InstigatedBy)
00087	{
00088		local Actor A;
00089	
00090		SetTimer(0.0, false);
00091		Health = Default.Health;
00092		AmbientSound = None;
00093		if ( FallBackFort != '' )
00094			Assault(Level.Game).FallBackTo(FallBackFort, DefensePriority);
00095			
00096		if ( Event != '' )
00097			ForEach AllActors(class'Actor', A, Event)
00098				A.Trigger( self, instigatedBy );
00099		instigator = instigatedBy;
00100		Destroy();
00101	}
00102	
00103	function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, 
00104							Vector momentum, name damageType)
00105	{
00106		local Pawn P;
00107		local Actor A;
00108	
00109		if ( bTriggerOnly || (instigatedBy == None)
00110			 || (instigatedBy.bIsPlayer && (instigatedBy.PlayerReplicationInfo.Team == Assault(Level.Game).Defender.TeamIndex)) )
00111			return;
00112		Health -= Damage;
00113		if ( (Defender != None) && (Defender.Health > 0)
00114			&& (Level.TimeSeconds - LastHelpMessage > 15)
00115			&& (VSize(Location - Defender.Location) < 1000)
00116			&& Defender.LineOfSightTo(self) )
00117		{
00118			if ( Defender.IsA('Bot') )
00119				Bot(Defender).SendTeamMessage(None, 'OTHER', 13, 15);
00120			LastHelpMessage = Level.TimeSeconds;
00121		}
00122		if ( Health < 0 )
00123			DestroyFort(instigatedBy);
00124		else
00125		{	
00126			TotalDamage += Damage;
00127			if ( (DamageEvent[DamagePointer] != '') && (TotalDamage >= DamageEventThreshold[DamagePointer]) )
00128			{
00129				ForEach AllActors(class'Actor', A, DamageEvent[DamagePointer] )
00130					A.Trigger(self, instigatedBy);
00131				DamagePointer++;
00132			}	
00133			AmbientSound = sound'WarningSound'; 
00134			if ( bFlashing && ((TimerRate == 0) || (TimerRate - TimerCounter > 0.01 * Health)) )
00135				SetTimer(FClamp(0.006 * Health,0.2,1.5), true);
00136		}
00137	}
00138	
00139	function Timer()
00140	{
00141		if ( !bFlashing || (LightType == LT_Steady) )
00142			LightType = LT_None;
00143		else
00144		{
00145			LightType = LT_Steady;
00146			PlaySound(sound'ControlSound');
00147		}
00148	}
00149	
00150	defaultproperties
00151	{
00152	     bSelfDisplayed=True
00153	     bFlashing=True
00154	     bSayDestroyed=True
00155	     DefenseTime=10
00156	     ChargeDist=1000.000000
00157	     FortName="Assault Target"
00158	     DestroyedMessage="was destroyed!"
00159	     Health=100
00160	     bAlwaysRelevant=True
00161	     Skin=Texture'UnrealI.Skins.JFlag11'
00162	     Mesh=LodMesh'UnrealI.Flag1M'
00163	     bUnlit=True
00164	     SoundRadius=255
00165	     SoundVolume=255
00166	     bBlockActors=False
00167	     bBlockPlayers=False
00168	     LightEffect=LE_NonIncidence
00169	     LightBrightness=255
00170	     LightHue=170
00171	     LightSaturation=96
00172	     LightRadius=12
00173	}

End Source Code