Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Author: commy2
- * Animates Leopard main gun in loading postion after firing.
- *
- * Arguments:
- * 0: mbt leopard <OBJECT>
- *
- * Return Value:
- * None
- *
- * Public: No
- */
- #include "script_component.h"
- #define ANIM_TIME_A 1
- #define ANIM_TIME_B 6
- params ["_vehicle"];
- if !(local _vehicle) exitWith {};
- [{
- (_this select 0) params ["_vehicle", "_time", "_state"];
- // handle deletion
- if (isNull _vehicle) exitWith {
- [_this select 1] call CBA_fnc_removePerFrameHandler;
- };
- // handle savegames
- if (time < _time) exitWith {
- _vehicle animate ["mainGun_loadingPosition", 0];
- [_this select 1] call CBA_fnc_removePerFrameHandler;
- };
- if (_state == 0) then {
- _vehicle animate ["mainGun_recoil", 1 - (time - _time) / ANIM_TIME_A];
- _vehicle animate ["mainGun_netz_recoil", 1 - (time - _time) / ANIM_TIME_A];
- if (time > _time + ANIM_TIME_A) then {
- (_this select 0) set [2, 1];
- };
- };
- if (_state == 1) then {
- _vehicle animate ["mainGun_loadingPosition", rad 12 - ((_vehicle animationPhase "mainGun") + (_vehicle animationPhase "mainGun_aboveEnginePosition"))];
- if (time > _time + ANIM_TIME_B) then {
- _vehicle animate ["mainGun_loadingPosition", 0];
- [_this select 1] call CBA_fnc_removePerFrameHandler;
- };
- };
- }, 0, [_vehicle, time, 0]] call CBA_fnc_addPerFrameHandler;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement