Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. /*
  2. * Author: commy2
  3. * Animates Leopard main gun in loading postion after firing.
  4. *
  5. * Arguments:
  6. * 0: mbt leopard <OBJECT>
  7. *
  8. * Return Value:
  9. * None
  10. *
  11. * Public: No
  12. */
  13. #include "script_component.h"
  14.  
  15. #define ANIM_TIME_A 1
  16. #define ANIM_TIME_B 6
  17.  
  18. params ["_vehicle"];
  19.  
  20. if !(local _vehicle) exitWith {};
  21.  
  22. [{
  23. (_this select 0) params ["_vehicle", "_time", "_state"];
  24.  
  25. // handle deletion
  26. if (isNull _vehicle) exitWith {
  27. [_this select 1] call CBA_fnc_removePerFrameHandler;
  28. };
  29.  
  30. // handle savegames
  31. if (time < _time) exitWith {
  32. _vehicle animate ["mainGun_loadingPosition", 0];
  33. [_this select 1] call CBA_fnc_removePerFrameHandler;
  34. };
  35.  
  36. if (_state == 0) then {
  37. _vehicle animate ["mainGun_recoil", 1 - (time - _time) / ANIM_TIME_A];
  38. _vehicle animate ["mainGun_netz_recoil", 1 - (time - _time) / ANIM_TIME_A];
  39.  
  40. if (time > _time + ANIM_TIME_A) then {
  41. (_this select 0) set [2, 1];
  42. };
  43. };
  44.  
  45. if (_state == 1) then {
  46. _vehicle animate ["mainGun_loadingPosition", rad 12 - ((_vehicle animationPhase "mainGun") + (_vehicle animationPhase "mainGun_aboveEnginePosition"))];
  47.  
  48. if (time > _time + ANIM_TIME_B) then {
  49. _vehicle animate ["mainGun_loadingPosition", 0];
  50. [_this select 1] call CBA_fnc_removePerFrameHandler;
  51. };
  52. };
  53. }, 0, [_vehicle, time, 0]] call CBA_fnc_addPerFrameHandler;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement