Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.84 KB | None | 0 0
  1. class FS2Flak extends EXUGenericProjectiles;
  2. // player/weapon version
  3.  
  4. var float BlastSize;
  5. var() float MaxBlastSize,InitialBlastSize;
  6. var FlakCollisionProxy Proxified;
  7. var FS2FlakOverlay FSO;
  8. var sound BeepSound;
  9.  
  10. simulated function PostBeginPlay()
  11. {
  12. Super.PostBeginPlay();
  13.  
  14. Velocity = Vector(Rotation) * speed;
  15. BlastSize = InitialBlastSize;
  16.  
  17. if(Role==ROLE_Authority)
  18. Proxified=Spawn(Class'FlakCollisionProxy',Self);
  19. settimer(randrange(1.5,1.85),false);
  20.  
  21. if(Instigator!=None)
  22. MakeNoise(0.5);
  23.  
  24. if(Level.Netmode==NM_DedicatedServer)
  25. return;
  26.  
  27. ///FIXME: this thing doesn't roll when moving, but randspin I'm pretty sure makes it constantly rotate, even when still
  28.  
  29. FSO = Spawn(Class'FS2FlakOverlay',self);
  30.  
  31. PlaySound(SpawnSound, SLOT_Interact, 8);
  32. PlaySound(SpawnSound, SLOT_None, 8);
  33.  
  34. if(Level.bDropDetail)
  35. LightType=LT_None;
  36. }
  37.  
  38. simulated function Destroyed()
  39. {
  40. if (Proxified!=none)
  41. Proxified.Destroy();
  42. if (FSO!=none)
  43. FSO.Destroy();
  44.  
  45. if(level.netmode==nm_client && !bexploded) // netmode hack for proper destruction sync
  46. explode(location,vect(0,0,0));
  47.  
  48. Super.Destroyed();
  49. }
  50.  
  51. simulated function tick(float dt)
  52. {
  53. if(BlastSize<MaxBlastSize)
  54. BlastSize+=BlastSize*2.25*dt;
  55.  
  56. if(FSO!=None && FSO.DrawScale<0.75)
  57. FSO.DrawScale+=FSO.Default.DrawScale*1.875*dt;
  58. }
  59.  
  60. simulated function burst()
  61. {
  62. local DemonSpark S;
  63. local int i;
  64.  
  65. for (i = 0; i < (2 + Rand(3)); i++)
  66. {
  67. S = Spawn(class'DemonSpark');
  68. if (S!=none)
  69. {
  70. S.velocity = normal(vrand()+vect(0,0,0))*randrange(800,1200);
  71. S.Texture = MultiSkins[7];
  72. S.DrawScale = randrange(0.075,0.125);
  73. S.LifeSpan = randrange(0.125,0.5);
  74. }
  75. }
  76. }
  77.  
  78. simulated function timer()
  79. {
  80. if( bFriendliesPresent() )
  81. {
  82. PlaySound(BeepSound);
  83. settimer(0.5,false);
  84. }
  85. else
  86. Explode(Location,vect(0,0,0));
  87. }
  88.  
  89. function bool bFriendliesPresent() // If the instigator or one of their friends is present, don't detonate
  90. {
  91. local Pawn P;
  92.  
  93. if(BlastSize<=100)
  94. return false;
  95.  
  96. else
  97. {
  98. foreach radiusactors( class'Pawn', P, BlastSize ) // Check for pawns
  99. {
  100. if( bFriendlyTarget(P) ) // Pawn was detected; is it friendly?
  101. return True; // If yes, return true and delay detonation
  102. }
  103. }
  104.  
  105. return False;
  106. }
  107.  
  108. function bool bFriendlyTarget(actor Other)
  109. {
  110. if( other==none || !other.IsA('Pawn') || other.IsA('ScriptedPawn') ) ///FIXME: add support for allied scriptedpawns later
  111. return false;
  112.  
  113. if( !other.bprojtarget || Pawn(other).getstatename()=='dying' || Pawn(other).health<=0 ) // Target cannot be hit, why wait to explode?
  114. return false;
  115.  
  116. if( other==Instigator )
  117. return True;
  118.  
  119. 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
  120. return True;
  121.  
  122. return false; // If nothing ends up true, then there's no friendlies nearby afterall!
  123. }
  124.  
  125. simulated function ProcessTouch (Actor Other, vector HitLocation)
  126. {
  127. if( bFriendlyTarget(Other) )
  128. return;
  129.  
  130. Super.ProcessTouch(Other,Hitlocation);
  131. }
  132.  
  133. simulated function Explode(vector HitLocation, vector HitNormal)
  134. {
  135. Local actor s;
  136.  
  137. if(bexploded) return;
  138. bexploded=true;
  139.  
  140. if (Role==ROLE_Authority)
  141. class'EXUStaticFuncs'.static.HurtRadius2(self, damage, BlastSize, MyDamageType, MomentumTransfer, hitlocation, bUseDamageAttenuation, bHurtInstigator, impacted);
  142.  
  143. if (instigator!=none && FRand() < 0.5)
  144. MakeNoise(1.0);
  145.  
  146. class'exustaticfuncs'.static.FlakBurstShake(self);
  147.  
  148. if (level.netmode!=NM_DedicatedServer)
  149. {
  150. PlaySound(ImpactSound, SLOT_None, 8,,, randrange(0.9,1.1));
  151.  
  152. Spawn(class'Flakimpact',,,HitLocation+HitNormal*15);
  153.  
  154. if(!Level.bDropDetail)
  155. {
  156. Burst();
  157.  
  158. if (FRand()<0.275)
  159. {
  160. s = Spawn(Class'ContactBlob',,,HitLocation+HitNormal*15);
  161. if (s!=none)
  162. s.DrawScale = 7.0*(BlastSize/MaxBlastSize);
  163. }
  164. }
  165. }
  166. if(!bdeleteme || level.netmode!=nm_client)
  167. Destroy();
  168. }
  169.  
  170. simulated function HitWall (vector HitNormal, actor Wall)
  171. {
  172. if ( (Mover(Wall) != None) && Mover(Wall).bDamageTriggered )
  173. {
  174. if ( Role == ROLE_Authority )
  175. Wall.TakeDamage( Damage, instigator, Location, MomentumTransfer * Normal(Velocity), '');
  176. Explode(Location, Hitnormal);
  177. Destroy();
  178. return;
  179. }
  180.  
  181. Velocity = BounceMagnitude*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity);
  182. speed = VSize(Velocity);
  183.  
  184. if( Speed > 60 )
  185. PlaySound(MiscSound,,,,, randrange(0.7,1.3) );
  186.  
  187. if ( Velocity.Z > 400 )
  188. Velocity.Z = 0.3 * (400 + Velocity.Z);
  189. else if ( speed < 20 )
  190. {
  191. bBounce = False;
  192. SetPhysics(PHYS_None);
  193. }
  194.  
  195. if( MaxWallHits>0 )
  196. {
  197. NumWallHits++;
  198. if ( NumWallHits > MaxWallHits )
  199. Explode(Location, HitNormal);
  200. }
  201. ExtraWallImpactShit( HitNormal, None );
  202. }
  203.  
  204. defaultproperties
  205. {
  206. bCanHitInstigator=False
  207. Physics=PHYS_Falling
  208. bBounce=True
  209. bGrenadeBounce=True
  210. BounceMagnitude=0.85
  211. bUnlit=True
  212. RemoteRole=ROLE_SimulatedProxy
  213. speed=1800.000000
  214. MaxSpeed=2500.000000
  215. Damage=275.000000
  216. MomentumTransfer=20000
  217. MyDamageType=exploded
  218. ImpactSound=Sound'EXU-Sounds.GunSounds.flakburst'
  219. ExploWallOut=8.000000
  220. DrawType=DT_Mesh
  221. Mesh=Mesh'UnrealI.Moon1'
  222. Skin=Texture'PlayrShp.Deco.Htest10'
  223. DrawScale=0.060000
  224. SoundRadius=128
  225. SoundVolume=255
  226. SoundPitch=255
  227. MultiSkins(7)=Texture'EXU-Textures.Misc.FireGlow'
  228. TransientSoundVolume=1.000000
  229. TransientSoundRadius=2500.000000
  230. MaxBlastSize=500
  231. InitialBlastSize=80
  232. LifeSpan=0
  233. bIgnoreGibs=True
  234. ExplosionDecal=Class'EXU.EXUEnergyImpact'
  235. bNetTemporary=False
  236. bHurtInstigator=True
  237. MiscSound=Sound'EXU-Sounds.GunSounds.CFBallHit'
  238. BeepSound=Sound'EXU-Sounds.GunSounds.HighBeep'
  239. CollisionHeight=3.0
  240. CollisionRadius=3.0
  241. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement