2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* 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-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
private ["_vehicle", "_config", "_animation", "_action", "_inAction", "_turretIndex"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
PARAMS_1(_unit);
|
2015-01-11 16:42:31 +00:00
|
|
|
_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");
|
2015-01-11 16:42:31 +00:00
|
|
|
} else {
|
2015-05-14 18:06:06 +00:00
|
|
|
_turretIndex = [_unit] call FUNC(getTurretIndex);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
_config = [_config, _turretIndex] call FUNC(getTurretConfigPath);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
_action = getText (_config >> "gunnerAction");
|
|
|
|
_inAction = getText (_config >> "gunnerInAction");
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (_action == "" || {_inAction == ""} || {_action == _inAction}) exitWith {false};
|
|
|
|
|
|
|
|
_animation = toArray _animation;
|
|
|
|
_animation resize (count toArray _action);
|
|
|
|
_animation = toString _animation;
|
|
|
|
|
|
|
|
_animation == _action
|