mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #3778 from acemod/fixGetWeaponState
fix getWeaponState, fix #3777
This commit is contained in:
@ -18,7 +18,7 @@ private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles")
|
|||||||
|
|
||||||
{
|
{
|
||||||
if (_x == "this") then {
|
if (_x == "this") then {
|
||||||
_muzzles set [_forEachIndex, _weapon];
|
_muzzles set [_forEachIndex, configName (configFile >> "CfgWeapons" >> _weapon)];
|
||||||
};
|
};
|
||||||
} forEach _muzzles;
|
} forEach _muzzles;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: unit <OBJECT>
|
* 0: unit <OBJECT>
|
||||||
* 1: weapon <STRING>
|
* 1: weapon (optional, default: units current weapon) <STRING>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* 0: Attachements <ARRAY>
|
* 0: Attachements <ARRAY>
|
||||||
@ -16,21 +16,19 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit", "_weapon"];
|
params [["_unit", objNull, [objNull]], ["_weapon", nil, [""]]];
|
||||||
|
|
||||||
|
if (isNil "_weapon") then {
|
||||||
|
_weapon = currentWeapon _unit;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _attachments = [_unit weaponAccessories _weapon] param [0, ["","","",""]];
|
||||||
|
|
||||||
private _muzzles = _weapon call FUNC(getWeaponMuzzles);
|
private _muzzles = _weapon call FUNC(getWeaponMuzzles);
|
||||||
|
|
||||||
private _weaponInfo = [["","","",""], primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit] select ((["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] find _weapon) max 0);
|
|
||||||
|
|
||||||
// get loaded magazines and ammo
|
// get loaded magazines and ammo
|
||||||
private _magazines = [];
|
private _magazines = _muzzles apply {""};
|
||||||
private _ammo = [];
|
private _ammo = _muzzles apply {0};
|
||||||
|
|
||||||
{
|
|
||||||
_magazines pushBack "";
|
|
||||||
_ammo pushBack 0;
|
|
||||||
false
|
|
||||||
} count _muzzles;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
if (_x select 2) then {
|
if (_x select 2) then {
|
||||||
@ -44,6 +42,4 @@ private _ammo = [];
|
|||||||
false
|
false
|
||||||
} count magazinesAmmoFull _unit;
|
} count magazinesAmmoFull _unit;
|
||||||
|
|
||||||
_weaponInfo append [_muzzles, _magazines, _ammo];
|
[_attachments, _muzzles, _magazines, _ammo];
|
||||||
|
|
||||||
_weaponInfo
|
|
||||||
|
Reference in New Issue
Block a user