ACE3/addons/common/functions/fnc_isTurnedOut.sqf

40 lines
1.1 KiB
Plaintext
Raw Normal View History

/*
* Author: commy2
*
* Check if the unit is in a vehicle and turned out.
*
* Argument:
* 0: Unit, not the vehicle (Object)
*
* Return value:
* Is the unit turned out or not? Will return false if there is no option to turn out in the first place. (Bool)
*/
2015-01-13 19:56:02 +00:00
#include "script_component.hpp"
2015-05-14 18:06:06 +00:00
private ["_vehicle", "_config", "_animation", "_action", "_inAction", "_turretIndex"];
2015-05-14 18:06:06 +00:00
PARAMS_1(_unit);
_vehicle = vehicle _unit;
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_animation = animationState _unit;
if (_unit == driver _vehicle) then {
2015-05-14 18:06:06 +00:00
_action = getText (_config >> "driverAction");
_inAction = getText (_config >> "driverInAction");
} else {
2015-05-14 18:06:06 +00:00
_turretIndex = [_unit] call FUNC(getTurretIndex);
2015-05-14 18:06:06 +00:00
_config = [_config, _turretIndex] call FUNC(getTurretConfigPath);
2015-05-14 18:06:06 +00:00
_action = getText (_config >> "gunnerAction");
_inAction = getText (_config >> "gunnerInAction");
};
if (_action == "" || {_inAction == ""} || {_action == _inAction}) exitWith {false};
_animation = toArray _animation;
_animation resize (count toArray _action);
_animation = toString _animation;
_animation == _action