mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
67ebb15e07
* Dragging - Improve weapon reselect behaviour * Add and use func to getFiremodeIndex --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com>
32 lines
761 B
Plaintext
32 lines
761 B
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: PabstMirror
|
|
* Get the firemode index of the weapon for use with "SwitchWeapon"
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
* 1: Muzzle <STRING> (Optional)
|
|
* 2: Firemode <STRING> (Optional)
|
|
*
|
|
* Return Value:
|
|
* Weapon/Mode index <NUMBER>
|
|
*
|
|
* Example:
|
|
* [player] call ace_common_fnc_getFiremodeIndex
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
params ["_unit"];
|
|
(weaponState _unit) params ["", "_currentMuzzle", "_currentFiremode"];
|
|
params ["", ["_muzzle", _currentMuzzle], ["_firemode", _currentFireMode]];
|
|
|
|
private _weapons = _unit weaponsInfo [_muzzle, false];
|
|
private _index = -1;
|
|
{
|
|
_x params ["_xIndex", "", "", "", "_xFiremode"];
|
|
if (_xFiremode == _firemode) exitWith { _index = _xIndex; };
|
|
} forEach _weapons;
|
|
|
|
_index
|