ACE3/addons/tripod/functions/fnc_adjust.sqf

51 lines
1.5 KiB
Plaintext
Raw Normal View History

#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:
* [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
*/
params ["_unit", "_tripod"];
2015-06-04 19:13:44 +00:00
_unit setVariable [QGVAR(adjusting), true, true];
2015-06-04 19:13:44 +00:00
// add PFH to adjust the tripod animation
2015-06-04 19:13:44 +00:00
GVAR(adjustPFH) = [{
(_this select 0) params ["_unit", "_tripod"];
2015-08-07 06:07:10 +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);
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
[_unit, "DefaultAction", _unit getVariable [QGVAR(Adjust), -1]] call EFUNC(common,removeActionEventHandler);
[_this select 1] call CBA_fnc_removePerFrameHandler;
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)];
2015-08-07 06:07:10 +00:00
} count ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"];
}, 0, [_unit, _tripod]] call CBA_fnc_addPerFrameHandler;
2015-06-04 19:13:44 +00:00
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
// 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
_unit setVariable [QGVAR(Adjust), [
_unit, "DefaultAction",
{GVAR(adjustPFH) != -1},
{(_this select 0) setVariable [QGVAR(adjusting), false, true]}
] call EFUNC(common,addActionEventHandler)];