Core.Object | +--Engine.Actor | +--Engine.Projectile | +--Botpack.UT_Grenade
int
NumExtraGrenades
Count,
SmokeRate
bCanHitOwner,
bHitWater
simulated
BeginPlay()
void
BlowUp(vector HitLocation)
///////////////////////////////////////////////////////
Explosion(vector HitLocation)
HitWall(vector HitNormal, Actor Wall)
Landed(vector HitNormal)
PostBeginPlay()
ProcessTouch(Actor Other, vector HitLocation)
Tick(float DeltaTime)
Timer()
ZoneChange(ZoneInfo NewZone)
00001 //============================================================================= 00002 // Grenade. 00003 //============================================================================= 00004 class UT_Grenade extends Projectile; 00005 00006 #exec MESH IMPORT MESH=UTGrenade ANIVFILE=MODELS\eightballrocket_a.3D DATAFILE=MODELS\eightballrocket_d.3D X=0 Y=0 Z=0 00007 #exec MESH ORIGIN MESH=UTGrenade X=0 Y=0 Z=0 YAW=-64 00008 00009 #exec MESH SEQUENCE MESH=UTGrenade SEQ=All STARTFRAME=0 NUMFRAMES=1 00010 #exec MESH SEQUENCE MESH=UTGrenade SEQ=WingIn STARTFRAME=0 NUMFRAMES=1 00011 00012 #exec TEXTURE IMPORT NAME=JuRocket1 FILE=MODELS\eightballRocket.PCX 00013 #exec MESHMAP SCALE MESHMAP=UTGrenade X=2.2 Y=2.2 Z=4.3 YAW=128 00014 #exec MESHMAP SETTEXTURE MESHMAP=UTGrenade NUM=1 TEXTURE=JuRocket1 00015 00016 var bool bCanHitOwner, bHitWater; 00017 var float Count, SmokeRate; 00018 var int NumExtraGrenades; 00019 00020 simulated function PostBeginPlay() 00021 { 00022 local vector X,Y,Z; 00023 local rotator RandRot; 00024 00025 Super.PostBeginPlay(); 00026 if ( Level.NetMode != NM_DedicatedServer ) 00027 PlayAnim('WingIn'); 00028 SetTimer(2.5+FRand()*0.5,false); //Grenade begins unarmed 00029 00030 if ( Role == ROLE_Authority ) 00031 { 00032 GetAxes(Instigator.ViewRotation,X,Y,Z); 00033 Velocity = X * (Instigator.Velocity Dot X)*0.4 + Vector(Rotation) * (Speed + 00034 FRand() * 100); 00035 Velocity.z += 210; 00036 MaxSpeed = 1000; 00037 RandSpin(50000); 00038 bCanHitOwner = False; 00039 if (Instigator.HeadRegion.Zone.bWaterZone) 00040 { 00041 bHitWater = True; 00042 Disable('Tick'); 00043 Velocity=0.6*Velocity; 00044 } 00045 } 00046 } 00047 00048 simulated function BeginPlay() 00049 { 00050 if ( Level.bHighDetailMode && !Level.bDropDetail ) 00051 SmokeRate = 0.03; 00052 else 00053 SmokeRate = 0.15; 00054 } 00055 00056 simulated function ZoneChange( Zoneinfo NewZone ) 00057 { 00058 local waterring w; 00059 00060 if (!NewZone.bWaterZone || bHitWater) Return; 00061 00062 bHitWater = True; 00063 w = Spawn(class'WaterRing',,,,rot(16384,0,0)); 00064 w.DrawScale = 0.2; 00065 w.RemoteRole = ROLE_None; 00066 Velocity=0.6*Velocity; 00067 } 00068 00069 simulated function Timer() 00070 { 00071 Explosion(Location+Vect(0,0,1)*16); 00072 } 00073 00074 simulated function Tick(float DeltaTime) 00075 { 00076 local UT_BlackSmoke b; 00077 00078 if ( bHitWater || Level.bDropDetail ) 00079 { 00080 Disable('Tick'); 00081 Return; 00082 } 00083 Count += DeltaTime; 00084 if ( (Count>Frand()*SmokeRate+SmokeRate+NumExtraGrenades*0.03) && (Level.NetMode!=NM_DedicatedServer) ) 00085 { 00086 b = Spawn(class'UT_BlackSmoke'); 00087 b.RemoteRole = ROLE_None; 00088 Count=0; 00089 } 00090 } 00091 00092 simulated function Landed( vector HitNormal ) 00093 { 00094 HitWall( HitNormal, None ); 00095 } 00096 00097 simulated function ProcessTouch( actor Other, vector HitLocation ) 00098 { 00099 if ( (Other!=instigator) || bCanHitOwner ) 00100 Explosion(HitLocation); 00101 } 00102 00103 simulated function HitWall( vector HitNormal, actor Wall ) 00104 { 00105 bCanHitOwner = True; 00106 Velocity = 0.75*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity); // Reflect off Wall w/damping 00107 RandSpin(100000); 00108 speed = VSize(Velocity); 00109 if ( Level.NetMode != NM_DedicatedServer ) 00110 PlaySound(ImpactSound, SLOT_Misc, 1.5 ); 00111 if ( Velocity.Z > 400 ) 00112 Velocity.Z = 0.5 * (400 + Velocity.Z); 00113 else if ( speed < 20 ) 00114 { 00115 bBounce = False; 00116 SetPhysics(PHYS_None); 00117 } 00118 } 00119 00120 /////////////////////////////////////////////////////// 00121 function BlowUp(vector HitLocation) 00122 { 00123 HurtRadius(damage, 200, MyDamageType, MomentumTransfer, HitLocation); 00124 MakeNoise(1.0); 00125 } 00126 00127 simulated function Explosion(vector HitLocation) 00128 { 00129 local UT_SpriteBallExplosion s; 00130 00131 BlowUp(HitLocation); 00132 if ( Level.NetMode != NM_DedicatedServer ) 00133 { 00134 spawn(class'Botpack.BlastMark',,,,rot(16384,0,0)); 00135 s = spawn(class'UT_SpriteBallExplosion',,,HitLocation); 00136 s.RemoteRole = ROLE_None; 00137 } 00138 Destroy(); 00139 } 00140 00141 defaultproperties 00142 { 00143 speed=600.000000 00144 MaxSpeed=1000.000000 00145 Damage=80.000000 00146 MomentumTransfer=50000 00147 MyDamageType=GrenadeDeath 00148 ImpactSound=Sound'UnrealShare.Eightball.GrenadeFloor' 00149 ExplosionDecal=Class'Botpack.BlastMark' 00150 Physics=PHYS_Falling 00151 RemoteRole=ROLE_SimulatedProxy 00152 AnimSequence=WingIn 00153 Mesh=LodMesh'Botpack.UTGrenade' 00154 DrawScale=0.020000 00155 AmbientGlow=64 00156 bUnlit=True 00157 bBounce=True 00158 bFixedRotationDir=True 00159 DesiredRotation=(Pitch=12000,Yaw=5666,Roll=2334) 00160 }