2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-06-04 19:13:44 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Adjust tripod height
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: tripod <OBJECT>
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-06-04 19:13:44 +00:00
|
|
|
* 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
|
|
|
*/
|
|
|
|
|
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);
|
2017-12-07 17:26:21 +00:00
|
|
|
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
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;
|
2021-02-04 16:48:58 +00:00
|
|
|
GVAR(adjustPFH) = -1;
|
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)];
|
2024-04-04 11:15:26 +00:00
|
|
|
} forEach ["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
|
|
|
|
2017-12-07 17:26:21 +00:00
|
|
|
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
2015-09-26 01:16:55 +00:00
|
|
|
// add mouse button action and hint
|
2019-12-07 21:40:44 +00:00
|
|
|
[LLSTRING(Done), "", LLSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint);
|
2015-06-04 19:13:44 +00:00
|
|
|
|
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)];
|