class SchlonzLinkGrenade extends Projectile; var float ExplodeTimer; var bool bCanHitOwner, bHitWater; var xEmitter Trail; var() float DampenFactor, DampenFactorParallel; var class HitEffectClass; var float LastSparkTime; var bool bTimerSet; replication { reliable if (Role==ROLE_Authority) ExplodeTimer; } simulated function Destroyed() { if ( Trail != None ) Trail.mRegen = false; // stop the emitter from regenerating Super.Destroyed(); } // Destroyed simulated function PostBeginPlay() { Super.PostBeginPlay(); if ( Role == ROLE_Authority ) { Velocity = Speed * Vector( Rotation ); RandSpin( 25000 ); bCanHitOwner = false; if( Instigator.HeadVolume.bWaterVolume ) { bHitWater = true; Velocity = 0.6*Velocity; } } } // PostBeginPlay simulated function PostNetBeginPlay() { if ( Physics == PHYS_None ) { SetTimer( ExplodeTimer, false ); bTimerSet = true; } } // PostNetBeginPlay simulated function Timer() { Explode( Location, vect(0,0,1) ); } // Timer simulated function Landed( vector HitNormal ) { HitWall( HitNormal, None ); } // Landed simulated function ProcessTouch( actor Other, vector HitLocation ) { if ( Pawn(Other) != None && (Other != Instigator || bCanHitOwner) ) { Explode( HitLocation, Normal( HitLocation-Other.Location ) ); } } // ProcessTouch simulated function HitWall( vector HitNormal, actor Wall ) { local Vector VNorm; if( !bTimerSet ) { SetTimer( ExplodeTimer, false ); bTimerSet = true; } // Reflect off Wall w/damping VNorm = (Velocity dot HitNormal) * HitNormal; Velocity = -VNorm * DampenFactor + (Velocity - VNorm) * DampenFactorParallel; RandSpin( 100000 ); Speed = VSize( Velocity ); if( Speed < 20 ) { bBounce = False; SetPhysics( PHYS_None ); if ( Trail != None ) Trail.mRegen = false; // stop the emitter from regenerating } else { if( (Level.NetMode != NM_DedicatedServer) && (Speed > 250) ) PlaySound(ImpactSound, SLOT_Misc ); if( !Level.bDropDetail && (Level.DetailMode != DM_Low) && (Level.TimeSeconds - LastSparkTime > 0.5) && EffectIsRelevant( Location,false ) ) { Spawn( HitEffectClass,,, Location, Rotator( HitNormal ) ); LastSparkTime = Level.TimeSeconds; } } } // HitWall simulated function Explode(vector HitLocation, vector HitNormal) { BlowUp( HitLocation ); PlaySound( sound'WeaponSounds.BExplosion3',,2.5*TransientSoundVolume ); if ( EffectIsRelevant(Location,false) ) { Spawn( class'SchlonzRocketExplosion',,, HitLocation, rotator(vect(0,0,1)) ); Spawn( ExplosionDecal,self,,HitLocation, rotator(-HitNormal) ); } Destroy(); } // Explode defaultproperties { ExplodeTimer=2.000000 DampenFactor=0.500000 DampenFactorParallel=0.800000 HitEffectClass=Class'XEffects.WallSparks' Speed=1500.000000 TossZ=0.000000 Damage=50.000000 DamageRadius=250.000000 MomentumTransfer=75000.000000 MyDamageType=Class'XWeapons.DamTypeAssaultGrenade' ImpactSound=ProceduralSound'WeaponSounds.PGrenFloor1.P1GrenFloor1' ExplosionDecal=Class'XEffects.RocketMark' Physics=PHYS_Falling DrawType=DT_StaticMesh StaticMesh=StaticMesh'WeaponStaticMesh.GrenadeMesh' DrawScale=3.000000 AmbientGlow=100 bBounce=True bFixedRotationDir=True DesiredRotation=(Pitch=12000,Yaw=5666,Roll=2334) }