ACE3/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf

49 lines
1.4 KiB
Plaintext
Raw Normal View History

/*
* Author: Rocko, Ruthberg
* Handles lengthening and tilting of the ladder
*
* Arguments:
* Amount scrolled <NUMBER>
*
* Return Value:
* Handled <BOOL>
*
* Example:
2015-08-07 06:19:15 +00:00
* [1] call ace_tacticalladder_fnc_handleScrollWheel;
*
* Public: No
*/
#include "script_component.hpp"
2015-08-07 06:19:15 +00:00
params ["_scroll"];
if (isNull GVAR(ladder)) exitWith { false };
if (GETMVAR(ACE_Modifier,0) == 0) then {
private ["_currentStep"];
// Lengthening
if (_scroll > 0) then {
_currentStep = GVAR(currentStep);
if (_currentStep == 11) exitWith {};
_currentStep = _currentStep + 1;
if (GVAR(ladder) animationPhase (format["extract_%1", _currentStep]) == 0) then {
GVAR(ladder) animate [format["extract_%1", _currentStep], 1];
GVAR(currentStep) = _currentStep;
};
};
if (_scroll < 0) then {
_currentStep = GVAR(currentStep);
if (_currentStep == 3) exitWith {};
if (GVAR(ladder) animationPhase (format["extract_%1", _currentStep]) == 1) then {
GVAR(ladder) animate [format["extract_%1", _currentStep], 0];
GVAR(currentStep) = _currentStep - 1;
2015-08-07 06:19:15 +00:00
};
};
} else {
// Tilting (disabled due to sinking, interaction point offset and unsuitable animation)
//GVAR(currentAngle) = 0 max (GVAR(currentAngle) + _scroll) min 30;
//GVAR(ladder) animate ["rotate", GVAR(currentAngle)];
};
2015-08-07 06:19:15 +00:00
true