mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Rangecard - Fixes broken bore height display (#5907)
* Reverts the getBoreHeight API change from:91425f8576
This commit is contained in:
parent
0a87bd134b
commit
b77c4d4667
@ -1,24 +1,27 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Gets the bore height of the currently used weapon & optic combination
|
||||
* Gets the bore height of the weapon & optic combination with the given weapon index
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Weapon index <NUMBER>
|
||||
* 2: Weapon <CLASS>
|
||||
* 3: Optic <CLASS>
|
||||
*
|
||||
* Return Value:
|
||||
* bore height <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [player, 0, "srifle_LRR_F", "optic_LRPS"] call ace_scopes_fnc_getBoreHeight
|
||||
* [player, 0] call ace_scopes_fnc_getBoreHeight
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_player", "_weaponIndex", "_weaponClass", "_opticsClass"];
|
||||
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;
|
||||
|
||||
if (_opticsClass == "") then { _opticsClass = _weaponClass; };
|
||||
|
||||
|
@ -82,8 +82,8 @@ private _newOptics = [_player] call FUNC(getOptics);
|
||||
private _newGuns = [primaryWeapon _player, secondaryWeapon _player, handgunWeapon _player];
|
||||
{
|
||||
if ((_newOptics select _x) != (GVAR(Optics) select _x) || (_newGuns select _x != GVAR(Guns) select _x)) then {
|
||||
GVAR(baseAngle) set [_x, [_player, _x, _newGuns select _x, _newOptics select _x] call FUNC(getBaseAngle)];
|
||||
GVAR(boreHeight) set [_x, [_player, _x, _newGuns select _x, _newOptics select _x] call FUNC(getBoreHeight)];
|
||||
GVAR(baseAngle) set [_x, [_player, _x] call FUNC(getBaseAngle)];
|
||||
GVAR(boreHeight) set [_x, [_player, _x] call FUNC(getBoreHeight)];
|
||||
|
||||
if ((_newOptics select _x) == "") then {
|
||||
// Check if the weapon comes with an integrated optic
|
||||
|
Loading…
Reference in New Issue
Block a user