2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2017-11-12 11:12:49 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
2017-12-15 16:22:31 +00:00
|
|
|
* Gets the base angle of the weapon & optic combination with the given weapon index
|
2017-11-12 11:12:49 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Weapon index <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* base angle <NUMBER>
|
|
|
|
*
|
|
|
|
* Example:
|
2017-12-15 16:22:31 +00:00
|
|
|
* [player, 0] call ace_scopes_fnc_getBaseAngle
|
2017-11-12 11:12:49 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
2017-12-15 16:22:31 +00:00
|
|
|
params ["_unit", "_weaponIndex"];
|
|
|
|
|
|
|
|
if (_weaponIndex < 0 || {_weaponIndex > 2}) exitWith { 0 };
|
|
|
|
|
|
|
|
private _weaponClass = [primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] select _weaponIndex;
|
|
|
|
private _opticsClass = ([_unit] call FUNC(getOptics)) select _weaponIndex;
|
2017-11-12 11:12:49 +00:00
|
|
|
|
|
|
|
private _weaponConfig = configFile >> "CfgWeapons" >> _weaponClass;
|
2017-11-20 19:14:24 +00:00
|
|
|
private _baseAngle = getNumber(_weaponConfig >> "ACE_IronSightBaseAngle");
|
|
|
|
|
|
|
|
if (_opticsClass != "") then {
|
|
|
|
if (isNumber (_weaponConfig >> "ACE_RailBaseAngle")) then {
|
|
|
|
_baseAngle = getNumber(_weaponConfig >> "ACE_RailBaseAngle");
|
|
|
|
} else {
|
|
|
|
_baseAngle = DEFAULT_RAIL_BASE_ANGLE;
|
|
|
|
};
|
2017-11-12 11:12:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_baseAngle
|