2015-06-04 19:13:44 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Adjust tripod height
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: tripod <OBJECT>
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* None
|
2015-08-07 06:07:10 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2015-09-26 01:16:55 +00:00
|
|
|
* [ACE_player, tripod] call ace_tripod_fnc_adjust
|
2015-08-07 06:07:10 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2015-06-04 19:13:44 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-26 01:16:55 +00:00
|
|
|
params ["_unit", "_tripod"];
|
2015-06-04 19:13:44 +00:00
|
|
|
|
2015-09-26 01:16:55 +00:00
|
|
|
_unit setVariable [QGVAR(adjusting), true, true];
|
2015-06-04 19:13:44 +00:00
|
|
|
|
2015-09-26 01:16:55 +00:00
|
|
|
// add PFH to adjust the tripod animation
|
2015-06-04 19:13:44 +00:00
|
|
|
GVAR(adjustPFH) = [{
|
2015-09-26 01:16:55 +00:00
|
|
|
(_this select 0) params ["_unit", "_tripod"];
|
2015-08-07 06:07:10 +00:00
|
|
|
|
2015-09-26 01:16:55 +00:00
|
|
|
if (!(_unit getVariable [QGVAR(adjusting), false]) || {isNull _tripod} || {_unit distance _tripod > 5}) exitWith {
|
2015-06-04 19:13:44 +00:00
|
|
|
call EFUNC(interaction,hideMouseHint);
|
2015-09-26 01:16:55 +00:00
|
|
|
|
|
|
|
[_unit, "DefaultAction", _unit getVariable [QGVAR(Adjust), -1]] call EFUNC(common,removeActionEventHandler);
|
|
|
|
|
|
|
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
2015-06-04 19:13:44 +00:00
|
|
|
};
|
2015-08-07 06:07:10 +00:00
|
|
|
|
2015-06-04 19:13:44 +00:00
|
|
|
{
|
|
|
|
_tripod animate [_x, 1 - GVAR(height)];
|
2015-08-07 06:07:10 +00:00
|
|
|
} count ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"];
|
|
|
|
|
2015-09-26 01:16:55 +00:00
|
|
|
}, 0, [_unit, _tripod]] call CBA_fnc_addPerFrameHandler;
|
2015-06-04 19:13:44 +00:00
|
|
|
|
2015-09-26 01:16:55 +00:00
|
|
|
// add mouse button action and hint
|
2015-06-04 19:13:44 +00:00
|
|
|
[localize "STR_ACE_Tripod_Done", "", localize "STR_ACE_Tripod_ScrollAction"] call EFUNC(interaction,showMouseHint);
|
|
|
|
|
2015-09-26 01:16:55 +00:00
|
|
|
_unit setVariable [QGVAR(Adjust), [
|
|
|
|
_unit, "DefaultAction",
|
|
|
|
{GVAR(adjustPFH) != -1},
|
|
|
|
{(_this select 0) setVariable [QGVAR(adjusting), false, true]}
|
|
|
|
] call EFUNC(common,addActionEventHandler)];
|