//============================================================================= // AmGrenade. //============================================================================= class AmGrenade expands Grenade; var bool bCanHitOwner, bHitWater; var float Count, SmokeRate; var ScriptedPawn WarnTarget; // warn this pawn away var int NumExtraGrenades; simulated function PostBeginPlay() { local vector X,Y,Z; local rotator RandRot; Super.PostBeginPlay(); if ( Level.NetMode != NM_DedicatedServer ) PlayAnim('WingIn'); SetTimer(2.5+FRand()*0.5,false); //Grenade begins unarmed if ( Role == ROLE_Authority ) { GetAxes(Instigator.ViewRotation,X,Y,Z); Velocity = X * (Instigator.Velocity Dot X)*0.4 + Vector(Rotation) * (Speed + FRand() * 100); Velocity.z += 210; RandRot.Pitch = FRand() * 1400 - 700; RandRot.Yaw = FRand() * 1400 - 700; RandRot.Roll = FRand() * 1400 - 700; MaxSpeed = 1000; Velocity = Velocity >> RandRot; RandSpin(50000); bCanHitOwner = False; if (Instigator.HeadRegion.Zone.bWaterZone) { bHitWater = True; Disable('Tick'); Velocity=0.6*Velocity; } } } simulated function BeginPlay() { if (Level.bHighDetailMode) SmokeRate = 0.03; else SmokeRate = 0.15; } simulated function ZoneChange( Zoneinfo NewZone ) { local waterring w; if (!NewZone.bWaterZone || bHitWater) Return; bHitWater = True; w = Spawn(class'WaterRing',,,,rot(16384,0,0)); w.DrawScale = 0.2; w.RemoteRole = ROLE_None; Velocity=0.6*Velocity; } simulated function Timer() { Explosion(Location+Vect(0,0,1)*16); } simulated function Tick(float DeltaTime) { local SpriteBallExplosion b; if (bHitWater) { Disable('Tick'); Return; } Count += DeltaTime; if ( (Count>Frand()*SmokeRate+SmokeRate+NumExtraGrenades*0.03) && (Level.NetMode!=NM_DedicatedServer) ) { b = Spawn(class'SpriteBallExplosion'); b.RemoteRole = ROLE_None; Count=0; } } simulated function Landed( vector HitNormal ) { HitWall( HitNormal, None ); } simulated function ProcessTouch( actor Other, vector HitLocation ) { if ( (Other!=instigator) || bCanHitOwner ) Explosion(HitLocation); } simulated function HitWall( vector HitNormal, actor Wall ) { bCanHitOwner = True; Velocity = 0.8*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity); // Reflect off Wall w/damping RandSpin(100000); speed = VSize(Velocity); if ( Level.NetMode != NM_DedicatedServer ) PlaySound(ImpactSound, SLOT_Misc, FMax(0.5, speed/800) ); if ( Velocity.Z > 400 ) Velocity.Z = 0.5 * (400 + Velocity.Z); else if ( speed < 20 ) { bBounce = False; SetPhysics(PHYS_None); } } /////////////////////////////////////////////////////// function BlowUp(vector HitLocation) { HurtRadius(damage, 200, 'exploded', MomentumTransfer, HitLocation); MakeNoise(1.0); } simulated function Explosion(vector HitLocation) { local RingExplosion3 s; BlowUp(HitLocation); s = spawn(class'RingExplosion3',,,HitLocation); s.RemoteRole = ROLE_None; Destroy(); } defaultproperties { speed=1000.000000 MaxSpeed=2000.000000 Damage=94.000000 Texture=FireTexture'UnrealShare.Effect1.FireEffect1p' bMeshEnviroMap=True }