Botpack
Class CH_Earthquake

source: e:\games\UnrealTournament\Botpack\Classes\CH_Earthquake.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Keypoint
         |
         +--UnrealShare.Earthquake
            |
            +--Botpack.CH_Earthquake
Direct Known Subclasses:None

class CH_Earthquake
extends UnrealShare.Earthquake

//============================================================================= // CH_Earthquake. //=============================================================================
Variables
 bool bThrowStuff


Function Summary
 void Timer()
 void Trigger(Actor Other, Pawn EventInstigator)



Source Code


00001	//=============================================================================
00002	// CH_Earthquake.
00003	//=============================================================================
00004	class CH_Earthquake extends Earthquake;
00005	
00006	var() bool bThrowStuff;
00007	
00008		function Trigger(actor Other, pawn EventInstigator)
00009		{
00010			local Actor A;
00011			local vector throwVect;
00012			if (bThrowStuff)
00013			{
00014				throwVect = 0.18 * Magnitude * VRand();
00015				throwVect.Z = FMax(Abs(ThrowVect.Z), 120);
00016			} 
00017			foreach visiblecollidingactors(class'Actor', A, radius,, true)
00018			{
00019				if ( A.IsA('PlayerPawn') )
00020					PlayerPawn(A).ShakeView(duration, magnitude, 0.015 * magnitude);
00021				if ( bThrowStuff )
00022				{
00023					if ( A.bIsPawn )
00024						Pawn(A).AddVelocity(throwVect);
00025					else if ( A.IsA('Decoration') && Decoration(A).bPushable
00026								&& (A.Physics == PHYS_None) )
00027					{
00028						A.SetPhysics(PHYS_Falling);
00029						A.Velocity = throwVect;
00030					}
00031				}
00032			}
00033	
00034			if ( bThrowStuff && (duration > 0.5) )
00035			{
00036				remainingTime = duration;
00037				SetTimer(0.5, false);
00038			}
00039		}
00040	
00041		function Timer()
00042		{
00043			local vector throwVect;
00044			local Actor A;
00045			local PlayerPawn P;
00046			remainingTime -= 0.5;
00047			throwVect = 0.15 * Magnitude * VRand();
00048			throwVect.Z = FMax(Abs(ThrowVect.Z), 120);
00049	
00050			foreach visiblecollidingactors(class'Actor', A, radius,, true)
00051			{
00052				if ( A.IsA('PlayerPawn') )
00053				{
00054					P = PlayerPawn(A);
00055					P.BaseEyeHeight = FMin(P.Default.BaseEyeHeight, P.BaseEyeHeight * (0.5 + FRand()));
00056					P.ShakeView(remainingTime, magnitude, 0.015 * magnitude);
00057				}
00058				if ( A.bIsPawn && (A.Physics != PHYS_Falling) )
00059					Pawn(A).AddVelocity(throwVect);
00060				else if ( A.IsA('Decoration') && Decoration(A).bPushable
00061							&& (A.Physics == PHYS_None) )
00062				{
00063					A.SetPhysics(PHYS_Falling);
00064					A.Velocity = throwVect;
00065				}
00066			}
00067				
00068			if ( remainingTime > 0.5 )
00069				SetTimer(0.5, false);
00070		}	
00071	
00072	defaultproperties
00073	{
00074	}

End Source Code