2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-02-28 05:12:54 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Make the player climb over short walls.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The Unit (usually the player) <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
2015-02-28 05:12:54 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player] call ace_movement_fnc_climb
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-18 05:45:28 +00:00
|
|
|
|
2016-01-06 21:42:02 +00:00
|
|
|
params ["_unit"];
|
2015-01-18 05:45:28 +00:00
|
|
|
|
|
|
|
if !([_unit] call FUNC(canClimb)) exitWith {
|
2015-05-28 19:59:04 +00:00
|
|
|
[localize LSTRING(CanNotClimb)] call EFUNC(common,displayTextStructured);
|
2015-01-18 05:45:28 +00:00
|
|
|
};
|
|
|
|
|
2015-01-20 01:19:31 +00:00
|
|
|
if !(_unit getVariable [QGVAR(isClimbInit), false]) then {
|
2015-04-18 08:16:10 +00:00
|
|
|
_unit addEventHandler ["AnimChanged", {
|
|
|
|
if (local (_this select 0) && {_this select 1 == "ACE_Climb"}) then {
|
2015-12-21 16:05:48 +00:00
|
|
|
// abort climb animation
|
|
|
|
if !(_this call FUNC(canClimb)) then {
|
|
|
|
[_this select 0, "AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
|
|
|
};
|
2015-04-18 08:16:10 +00:00
|
|
|
};
|
|
|
|
}];
|
|
|
|
|
2015-02-28 05:12:54 +00:00
|
|
|
_unit addEventHandler ["AnimDone", {
|
|
|
|
if (local (_this select 0) && {_this select 1 == "ACE_Climb"}) then {_this call FUNC(handleClimb)};
|
|
|
|
}];
|
2015-01-18 05:45:28 +00:00
|
|
|
|
2015-02-28 05:12:54 +00:00
|
|
|
_unit setVariable [QGVAR(isClimbInit), true];
|
2015-01-18 05:45:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
2015-04-18 08:16:10 +00:00
|
|
|
[_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation);
|
2015-01-18 05:45:28 +00:00
|
|
|
[_unit, "ACE_Climb", 0] call EFUNC(common,doAnimation);
|