Advertisement
Guest User

Untitled

a guest
Nov 12th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Lilith's Kiss Firing Animation:
  3. // Happy Valentine's Day!
  4. //=============================================================================
  5. class LilithKissFire extends KFShotgunFire;
  6.  
  7. var() Emitter Flash2Emitter;
  8.  
  9. var()           class<Emitter>  ShellEject${1}< ${3} >            // class of the shell eject emitter
  10. var()           Emitter         ShellEjectEmitter;          // The shell eject emitter
  11. var()           name            ShellEjectBoneName;         // name of the shell eject bone
  12. var()           Emitter         ShellEject2Emitter;          // The shell eject emitter
  13. var()           name            ShellEject2BoneName;         // name of the shell eject bone
  14.  
  15. var name FireAnim2, FireAimedAnim2;
  16. var name fa;
  17. var float TraceRange;
  18.  
  19. var() vector SightedProjSpawnOffset;
  20.  
  21. simulated function InitEffects()
  22. {
  23.     // don't even spawn on server
  24.     if ( (Level.NetMode == NM_DedicatedServer) || (AIController(Instigator.Controller) != None) )
  25.         return;
  26.     if ( (FlashEmitterClass != None) && ((FlashEmitter == None) || FlashEmitter.bDeleteMe) )
  27.     {
  28.         FlashEmitter = Weapon.Spawn(FlashEmitterClass);
  29.         Weapon.AttachToBone(FlashEmitter, KFWeapon(Weapon).default.FlashBoneName);
  30.     }
  31.     if ( (FlashEmitterClass != None) && ((Flash2Emitter == None) || Flash2Emitter.bDeleteMe) )
  32.     {
  33.         Flash2Emitter = Weapon.Spawn(FlashEmitterClass);
  34.         Weapon.AttachToBone(Flash2Emitter, LilithKiss(Weapon).default.altFlashBoneName);
  35.     }
  36.  
  37.     if ( (SmokeEmitterClass != None) && ((SmokeEmitter == None) || SmokeEmitter.bDeleteMe) )
  38.     {
  39.         SmokeEmitter = Weapon.Spawn(SmokeEmitterClass);
  40.     }
  41. }
  42.  
  43. simulated function DestroyEffects()
  44. {
  45.     super.DestroyEffects();
  46.  
  47.     if (Flash2Emitter != None)
  48.         Flash2Emitter.Destroy();
  49. }
  50.  
  51. function DrawMuzzleFlash(Canvas Canvas)
  52. {
  53.     super.DrawMuzzleFlash(Canvas);
  54. }
  55.  
  56. function FlashMuzzleFlash()
  57. {
  58.     if (Flash2Emitter == none || FlashEmitter == none)
  59.         return;
  60.  
  61.     if( KFWeap.bAimingRifle )
  62.     {
  63.         if( FireAimedAnim == 'FireLeft' )
  64.         {
  65.             Flash2Emitter.Trigger(Weapon, Instigator);
  66.         }
  67.         else
  68.         {
  69.             FlashEmitter.Trigger(Weapon, Instigator);
  70.         }
  71.     }
  72.     else
  73.     {
  74.         if(FireAnim == 'FireLeft')
  75.         {
  76.             Flash2Emitter.Trigger(Weapon, Instigator);
  77.         }
  78.         else
  79.         {
  80.             FlashEmitter.Trigger(Weapon, Instigator);
  81.         }
  82.     }
  83. }
  84.  
  85. event ModeDoFire()
  86. {
  87.     local name bn;
  88.  
  89.     bn = Dualies(Weapon).altFlashBoneName;
  90.     LilithKiss(Weapon).altFlashBoneName = LilithKiss(Weapon).FlashBoneName;
  91.     LilithKiss(Weapon).FlashBoneName = bn;
  92.  
  93.     Super.ModeDoFire();
  94.  
  95.     if( KFWeap.bAimingRifle )
  96.     {
  97.         fa = FireAimedAnim2;
  98.         FireAimedAnim2 = FireAimedAnim;
  99.         FireAimedAnim = fa;
  100.     }
  101.     else
  102.     {
  103.         fa = FireAnim2;
  104.         FireAnim2 = FireAnim;
  105.         FireAnim = fa;
  106.     }
  107.     InitEffects();
  108. }
  109.  
  110. function DoFireEffect()
  111. {
  112.     local Vector StartProj, StartTrace, X,Y,Z;
  113.     local Rotator R, Aim;
  114.     local Vector HitLocation, HitNormal;
  115.     local Actor Other;
  116.     local int p;
  117.     local int SpawnCount;
  118.     local float theta;
  119.  
  120.     Instigator.MakeNoise(1.0);
  121.     Weapon.GetViewAxes(X,Y,Z);
  122.  
  123.     StartTrace = Instigator.Location + Instigator.EyePosition();// + X*Instigator.CollisionRadius;
  124.  
  125.     if( KFWeap.bAimingRifle )
  126.     {
  127.         StartProj = StartTrace + X*SightedProjSpawnOffset.X;
  128.  
  129.         if( FireAimedAnim == 'FireLeft_Iron')
  130.         {
  131.             StartProj = StartProj + -1 * Y*SightedProjSpawnOffset.Y + Z*SightedProjSpawnOffset.Z;
  132.         }
  133.         else
  134.         {
  135.             StartProj = StartProj + Weapon.Hand * Y*SightedProjSpawnOffset.Y + Z*SightedProjSpawnOffset.Z;
  136.         }
  137.     }
  138.     else
  139.     {
  140.         StartProj = StartTrace + X*ProjSpawnOffset.X;
  141.  
  142.         if(FireAnim == 'FireLeft')
  143.         {
  144.             StartProj = StartProj + -1 * Y*ProjSpawnOffset.Y + Z*ProjSpawnOffset.Z;
  145.         }
  146.         else
  147.         {
  148.             StartProj = StartProj + Weapon.Hand * Y*ProjSpawnOffset.Y + Z*ProjSpawnOffset.Z;
  149.         }
  150.     }
  151.  
  152.     // check if projectile would spawn through a wall and adjust start location accordingly
  153.     Other = Weapon.Trace(HitLocation, HitNormal, StartProj, StartTrace, false);
  154.  
  155. // Collision attachment debugging
  156.  /*   if( Other.IsA('ROCollisionAttachment'))
  157.     {
  158.         log(self$"'s trace hit "$Other.Base$" Collision attachment");
  159.     }*/
  160.  
  161.     if (Other != None)
  162.     {
  163.         StartProj = HitLocation;
  164.     }
  165.  
  166.     Aim = AdjustAim(StartProj, AimError);
  167.  
  168.     SpawnCount = Max(1, ProjPerFire * int(Load));
  169.  
  170.     switch (SpreadStyle)
  171.     {
  172.     case SS_Random:
  173.         X = Vector(Aim);
  174.         for (p = 0; p < SpawnCount; p++)
  175.         {
  176.             R.Yaw = Spread * (FRand()-0.5);
  177.             R.Pitch = Spread * (FRand()-0.5);
  178.             R.Roll = Spread * (FRand()-0.5);
  179.             SpawnProjectile(StartProj, Rotator(X >> R));
  180.         }
  181.         break;
  182.     case SS_Line:
  183.         for (p = 0; p < SpawnCount; p++)
  184.         {
  185.             theta = Spread*PI/32768*(p - float(SpawnCount-1)/2.0);
  186.             X.X = Cos(theta);
  187.             X.Y = Sin(theta);
  188.             X.Z = 0.0;
  189.             SpawnProjectile(StartProj, Rotator(X >> Aim));
  190.         }
  191.         break;
  192.     default:
  193.         SpawnProjectile(StartProj, Aim);
  194.     }
  195.  
  196.     if (Instigator != none )
  197.     {
  198.         if( Instigator.Physics != PHYS_Falling  )
  199.         {
  200.             Instigator.AddVelocity(KickMomentum >> Instigator.GetViewRotation());
  201.         }
  202.         // Really boost the momentum for low grav
  203.         else if( Instigator.Physics == PHYS_Falling
  204.             && Instigator.PhysicsVolume.Gravity.Z > class'PhysicsVolume'.default.Gravity.Z)
  205.         {
  206.             Instigator.AddVelocity((KickMomentum * 10.0) >> Instigator.GetViewRotation());
  207.         }
  208.     }
  209. }
  210.  
  211. simulated function DoClientOnlyFireEffect()
  212. {
  213.     local Vector StartTrace;
  214.     local Rotator R, Aim;
  215.  
  216.     if( KFWeap.bAimingRifle )
  217.     {
  218.         if( FireAimedAnim == 'FireLeft')
  219.         {
  220.             StartTrace = Instigator.Location + Instigator.EyePosition();
  221.             StartTrace.Y  += (rand(30)+ 5);
  222.         }
  223.         else
  224.         {
  225.             StartTrace = Instigator.Location + Instigator.EyePosition();
  226.         }
  227.     }
  228.     else
  229.     {
  230.         if(FireAnim == 'FireLeft')
  231.         {
  232.             StartTrace = Instigator.Location + Instigator.EyePosition();
  233.             StartTrace.Y  += (rand(30)+ 5);
  234.         }
  235.         else
  236.         {
  237.             StartTrace = Instigator.Location + Instigator.EyePosition();
  238.         }
  239.     }
  240.  
  241.     Aim = AdjustAim(StartTrace, AimError);
  242.     R = rotator(vector(Aim) + VRand()*FRand()*Spread);
  243. }
  244.  
  245. simulated function bool AllowFire()
  246. {
  247.     if(KFWeapon(Weapon).bIsReloading)
  248.         return true;
  249.     if(KFPawn(Instigator).SecondaryItem!=none)
  250.         return false;
  251.     if(KFPawn(Instigator).bThrowingNade)
  252.         return false;
  253.  
  254.     if(KFWeapon(Weapon).MagAmmoRemaining < 0)
  255.     {
  256.    
  257.         if( Level.TimeSeconds - LastClickTime > FireRate )
  258.         {
  259.             LastClickTime = Level.TimeSeconds;
  260.         }
  261.  
  262.         if( AIController(Instigator.Controller)!=None )
  263.             KFWeapon(Weapon).ReloadMeNow();
  264.            
  265.         return false;
  266.        
  267.     }
  268.  
  269.     return super(WeaponFire).AllowFire();
  270. }
  271.  
  272. defaultproperties
  273. {
  274.      FireAnim2="FireLeft"
  275.      FireAimedAnim2="FireLeft"
  276.      FireAimedAnim="FireRight"
  277.      RecoilRate=0.070000
  278.      maxVerticalRecoilAngle=1000
  279.      maxHorizontalRecoilAngle=50
  280.      FireSoundRef="LilithKiss_S.lilith_fire_m"
  281.      StereoFireSoundRef="LilithKiss_S.lilith_fire"
  282.      KickMomentum=(X=-35.000000,Z=5.000000)
  283.      bWaitForRelease=True
  284.      bAttachSmokeEmitter=True
  285.      FireAnim="FireRight"
  286.      NoAmmoSound=Sound'KF_9MMSnd.9mm_DryFire'
  287.      FireRate=0.100000
  288.      AmmoClass=Class'LilithKissWep.LilithAmmo'
  289.      ShakeRotMag=(X=50.000000,Y=50.000000,Z=250.000000)
  290.      ShakeRotRate=(X=12500.000000,Y=12500.000000,Z=12500.000000)
  291.      ShakeRotTime=3.000000
  292.      ShakeOffsetMag=(X=6.000000,Y=2.000000,Z=6.000000)
  293.      ShakeOffsetRate=(X=1000.000000,Y=1000.000000,Z=1000.000000)
  294.      ShakeOffsetTime=1.250000
  295.      TransientSoundVolume=2.000000
  296.      TransientSoundRadius=500.000000
  297.      ProjectileClass=Class'LilithKissWep.LilithBullet'
  298.      ProjPerFire=5
  299.      BotRefireRate=0.250000
  300.      FlashEmitterClass=Class'ROEffects.MuzzleFlash1stMP'
  301.      aimerror=1.000000
  302.      Spread=1125.000000
  303. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement