Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FS2Flak extends EXUGenericProjectiles;
- // player/weapon version
- var float BlastSize;
- var() float MaxBlastSize,InitialBlastSize;
- var FlakCollisionProxy Proxified;
- var FS2FlakOverlay FSO;
- var sound BeepSound;
- simulated function PostBeginPlay()
- {
- Super.PostBeginPlay();
- Velocity = Vector(Rotation) * speed;
- BlastSize = InitialBlastSize;
- if(Role==ROLE_Authority)
- Proxified=Spawn(Class'FlakCollisionProxy',Self);
- settimer(randrange(1.5,1.85),false);
- if(Instigator!=None)
- MakeNoise(0.5);
- if(Level.Netmode==NM_DedicatedServer)
- return;
- ///FIXME: this thing doesn't roll when moving, but randspin I'm pretty sure makes it constantly rotate, even when still
- FSO = Spawn(Class'FS2FlakOverlay',self);
- PlaySound(SpawnSound, SLOT_Interact, 8);
- PlaySound(SpawnSound, SLOT_None, 8);
- if(Level.bDropDetail)
- LightType=LT_None;
- }
- simulated function Destroyed()
- {
- if (Proxified!=none)
- Proxified.Destroy();
- if (FSO!=none)
- FSO.Destroy();
- if(level.netmode==nm_client && !bexploded) // netmode hack for proper destruction sync
- explode(location,vect(0,0,0));
- Super.Destroyed();
- }
- simulated function tick(float dt)
- {
- if(BlastSize<MaxBlastSize)
- BlastSize+=BlastSize*2.25*dt;
- if(FSO!=None && FSO.DrawScale<0.75)
- FSO.DrawScale+=FSO.Default.DrawScale*1.875*dt;
- }
- simulated function burst()
- {
- local DemonSpark S;
- local int i;
- for (i = 0; i < (2 + Rand(3)); i++)
- {
- S = Spawn(class'DemonSpark');
- if (S!=none)
- {
- S.velocity = normal(vrand()+vect(0,0,0))*randrange(800,1200);
- S.Texture = MultiSkins[7];
- S.DrawScale = randrange(0.075,0.125);
- S.LifeSpan = randrange(0.125,0.5);
- }
- }
- }
- simulated function timer()
- {
- if( bFriendliesPresent() )
- {
- PlaySound(BeepSound);
- settimer(0.5,false);
- }
- else
- Explode(Location,vect(0,0,0));
- }
- function bool bFriendliesPresent() // If the instigator or one of their friends is present, don't detonate
- {
- local Pawn P;
- if(BlastSize<=100)
- return false;
- else
- {
- foreach radiusactors( class'Pawn', P, BlastSize ) // Check for pawns
- {
- if( bFriendlyTarget(P) ) // Pawn was detected; is it friendly?
- return True; // If yes, return true and delay detonation
- }
- }
- return False;
- }
- function bool bFriendlyTarget(actor Other)
- {
- if( other==none || !other.IsA('Pawn') || other.IsA('ScriptedPawn') ) ///FIXME: add support for allied scriptedpawns later
- return false;
- if( !other.bprojtarget || Pawn(other).getstatename()=='dying' || Pawn(other).health<=0 ) // Target cannot be hit, why wait to explode?
- return false;
- if( other==Instigator )
- return True;
- if( level.game.bteamgame && Pawn(other).playerreplicationinfo!=none && Instigator!=none && instigator.playerreplicationinfo!=none && Pawn(other).playerreplicationinfo.team == instigator.playerreplicationinfo.team ) // If target isn't the shooter, be sure it isn't a teammate
- return True;
- return false; // If nothing ends up true, then there's no friendlies nearby afterall!
- }
- simulated function ProcessTouch (Actor Other, vector HitLocation)
- {
- if( bFriendlyTarget(Other) )
- return;
- Super.ProcessTouch(Other,Hitlocation);
- }
- simulated function Explode(vector HitLocation, vector HitNormal)
- {
- Local actor s;
- if(bexploded) return;
- bexploded=true;
- if (Role==ROLE_Authority)
- class'EXUStaticFuncs'.static.HurtRadius2(self, damage, BlastSize, MyDamageType, MomentumTransfer, hitlocation, bUseDamageAttenuation, bHurtInstigator, impacted);
- if (instigator!=none && FRand() < 0.5)
- MakeNoise(1.0);
- class'exustaticfuncs'.static.FlakBurstShake(self);
- if (level.netmode!=NM_DedicatedServer)
- {
- PlaySound(ImpactSound, SLOT_None, 8,,, randrange(0.9,1.1));
- Spawn(class'Flakimpact',,,HitLocation+HitNormal*15);
- if(!Level.bDropDetail)
- {
- Burst();
- if (FRand()<0.275)
- {
- s = Spawn(Class'ContactBlob',,,HitLocation+HitNormal*15);
- if (s!=none)
- s.DrawScale = 7.0*(BlastSize/MaxBlastSize);
- }
- }
- }
- if(!bdeleteme || level.netmode!=nm_client)
- Destroy();
- }
- simulated function HitWall (vector HitNormal, actor Wall)
- {
- if ( (Mover(Wall) != None) && Mover(Wall).bDamageTriggered )
- {
- if ( Role == ROLE_Authority )
- Wall.TakeDamage( Damage, instigator, Location, MomentumTransfer * Normal(Velocity), '');
- Explode(Location, Hitnormal);
- Destroy();
- return;
- }
- Velocity = BounceMagnitude*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity);
- speed = VSize(Velocity);
- if( Speed > 60 )
- PlaySound(MiscSound,,,,, randrange(0.7,1.3) );
- if ( Velocity.Z > 400 )
- Velocity.Z = 0.3 * (400 + Velocity.Z);
- else if ( speed < 20 )
- {
- bBounce = False;
- SetPhysics(PHYS_None);
- }
- if( MaxWallHits>0 )
- {
- NumWallHits++;
- if ( NumWallHits > MaxWallHits )
- Explode(Location, HitNormal);
- }
- ExtraWallImpactShit( HitNormal, None );
- }
- defaultproperties
- {
- bCanHitInstigator=False
- Physics=PHYS_Falling
- bBounce=True
- bGrenadeBounce=True
- BounceMagnitude=0.85
- bUnlit=True
- RemoteRole=ROLE_SimulatedProxy
- speed=1800.000000
- MaxSpeed=2500.000000
- Damage=275.000000
- MomentumTransfer=20000
- MyDamageType=exploded
- ImpactSound=Sound'EXU-Sounds.GunSounds.flakburst'
- ExploWallOut=8.000000
- DrawType=DT_Mesh
- Mesh=Mesh'UnrealI.Moon1'
- Skin=Texture'PlayrShp.Deco.Htest10'
- DrawScale=0.060000
- SoundRadius=128
- SoundVolume=255
- SoundPitch=255
- MultiSkins(7)=Texture'EXU-Textures.Misc.FireGlow'
- TransientSoundVolume=1.000000
- TransientSoundRadius=2500.000000
- MaxBlastSize=500
- InitialBlastSize=80
- LifeSpan=0
- bIgnoreGibs=True
- ExplosionDecal=Class'EXU.EXUEnergyImpact'
- bNetTemporary=False
- bHurtInstigator=True
- MiscSound=Sound'EXU-Sounds.GunSounds.CFBallHit'
- BeepSound=Sound'EXU-Sounds.GunSounds.HighBeep'
- CollisionHeight=3.0
- CollisionRadius=3.0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement