Advertisement
ijontichy

<stdin>

Apr 13th, 2014
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. script 476 (int begin, int button, int superThreshold)
  2. {
  3. begin = !!begin;
  4. superThreshold = condFalse(superThreshold, 26);
  5. button = condFalse(button, BT_ALTATTACK);
  6.  
  7. int pln = PlayerNumber();
  8. if (pln == -1) { terminate; }
  9. int curstate = MissileCheckStates[pln];
  10. if (curstate == begin) { terminate; }
  11.  
  12. MissileCheckStates[pln] = begin;
  13.  
  14. int chargelevel = 0;
  15. int couldsuper, cansuper = 0, givesuper = 0, isfiring = 0;
  16.  
  17. while (MissileCheckStates[pln])
  18. {
  19. // There's a dirty joke somewhere in here.
  20. if (CheckInventory("BorphMallAcquired"))
  21. {
  22. MissileCheckStates[pln] = 0;
  23. break;
  24. }
  25.  
  26. cansuper = !!CheckInventory("SuperMissileAmmo");
  27. isfiring = keyDown(button);
  28.  
  29. // Clear out the trigger if we can hold for super missiles
  30. // - if we only have normal missiles, this could waste bandwidth
  31.  
  32. if (cansuper && CheckInventory("DakkaBeamCanMissile"))
  33. {
  34. TakeInventory("DakkaBeamCanMissile", 0x7FFFFFFF);
  35. }
  36.  
  37. // chargan
  38. if (isfiring && cansuper) { chargelevel++; }
  39. else
  40. {
  41. // Let go of the trigger before charged? fire a normal missile
  42. if (chargelevel > 0 && cansuper && !couldsuper)
  43. {
  44. GiveInventory("DakkaBeamCanMissile", 1);
  45. }
  46.  
  47. chargelevel = 0;
  48. }
  49.  
  50. givesuper = chargelevel >= superThreshold;
  51. givesuper &= cansuper;
  52.  
  53. // Handle no-super-missiles here
  54. if (!cansuper && isfiring)
  55. {
  56. if (!CheckInventory("DakkaBeamCanMissile")) { GiveInventory("DakkaBeamCanMissile", 1); }
  57. else { TakeInventory("DakkaBeamCanMissile", 0x7FFFFFFF); }
  58. }
  59.  
  60. // LOCKED AND LOADED
  61. if (givesuper && !couldsuper)
  62. {
  63. ActivatorSound("supermissile/ready", 127);
  64. }
  65.  
  66. // If we let go of the trigger, either send the super missile signal
  67. // (if charged), or clear the signal if there (if not)
  68. if (!givesuper)
  69. {
  70. if (couldsuper) { GiveInventory("DakkaBeamCanSuper", 1); }
  71. else if (CheckInventory("DakkaBeamCanSuoer")) { TakeInventory("DakkaBeamCanSuper", 0x7FFFFFFF); }
  72. }
  73.  
  74. couldsuper = givesuper;
  75. Delay(1);
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement