Advertisement
Chronos_Ouroboros

flare grenade

Jan 3rd, 2018
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. class S7_ThumperGrenadeFlare : S7_ThumperGrenade {
  2. default {
  3. damageFunction (fRandom [weaponDamage] (1.0, 6.0) * 5);
  4. damageType "TH_GrenadeImpact";
  5. translation "112:127=80:95";
  6.  
  7. -noGravity
  8. }
  9.  
  10. bool initialized;
  11. int maxTime;
  12. int time;
  13. PointLight dynLight;
  14.  
  15. override void PostBeginPlay () {
  16. time = maxTime = random [weaponSpc] (1025, 1050);
  17.  
  18. if (!dynLight)
  19. dynLight = PointLight (Spawn ("PointLight")); // Spawn the dynamic light
  20. dynLight.target = self;
  21. dynLight.args [DynamicLight.Light_Red] = 114; // Color - Red
  22. dynLight.args [DynamicLight.Light_Green] = 186; // Color - Green
  23. dynLight.args [DynamicLight.Light_Blue] = 255; // Color - Blue
  24. dynLight.args [DynamicLight.Light_Intensity] = 85; // Size
  25. //dynLight.args [DynamicLight.Light_Secondary_Intensity] = 75; // Secondary size
  26. //dynLight.angle = 0.72;
  27.  
  28. A_PlaySound ("Fire/Flare", CHAN_7, 0.15, TRUE);
  29. initialized = true;
  30. }
  31.  
  32. states {
  33. Spawn:
  34. THGR A 1 {
  35. if (time <= 0)
  36. return ResolveState ("RanOut");
  37.  
  38. if (dynLight) {
  39. double mult = 1.0;
  40. if (time < (maxTime * 0.25))
  41. mult = Clamp (time / (maxTime * 0.025), 0.05, 1.0);
  42. dynLight.args [DynamicLight.Light_Intensity] = int (floor (85 * mult));
  43. //dynLight.args [DynamicLight.Light_Secondary_Intensity] = int (floor (75 * mult));
  44. } else
  45. return ResolveState ("RanOut");
  46.  
  47. time--;
  48.  
  49. return ResolveState (null);
  50. }
  51. loop;
  52.  
  53. Death:
  54. TNT1 A 0 {
  55. if (!initialized)
  56. PostBeginPlay ();
  57.  
  58. vel.x = vel.y = 0;
  59. A_SetGravity (1.0);
  60. }
  61. Loople:
  62. THGR A 1 {
  63. if (time <= 0)
  64. return ResolveState ("RanOut");
  65.  
  66. if (dynLight) {
  67. double mult = 1.0;
  68. if (time < (maxTime * 0.25))
  69. mult = Clamp (time / (maxTime * 0.025), 0.05, 1.0);
  70. dynLight.args [DynamicLight.Light_Intensity] = int (floor (85 * mult));
  71. //dynLight.args [DynamicLight.Light_Secondary_Intensity] = int (floor (75 * mult));
  72. } else
  73. return ResolveState ("RanOut");
  74.  
  75. time--;
  76.  
  77. return ResolveState (null);
  78. }
  79. loop;
  80.  
  81. RanOut:
  82. THGR B 1 {
  83. if (dynLight)
  84. dynLight.A_Remove (AAPTR_Default, RMVF_EVERYTHING);
  85.  
  86. A_StopSound (CHAN_7);
  87. A_SpawnItemEx ("S7_Thumper_Used", 0.0, 0.0, 0.0, vel.x, vel.y, vel.z, 0, SXF_NoCheckPosition | SXF_TransferTranslation | SXF_TransferPitch | SXF_TransferPointers | SXF_AbsoluteVelocity);
  88. }
  89. stop;
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement