mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
3c5b46c42d
* count treatment items * getCountofItem Co-Authored-By: Blue <itzblueman@gmail.com> * getCountofItem fix Co-Authored-By: Blue <itzblueman@gmail.com> * convert painkillers to magazine * use isclass Co-Authored-By: johnb432 <58661205+johnb432@users.noreply.github.com> * forget to change variable * Update addons/medical_treatment/functions/fnc_hasItem.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * better magazine adjustment * Update addons/common/functions/fnc_adjustMagazineAmmo.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/medical_treatment/functions/fnc_medication.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/medical_treatment/functions/fnc_treatmentFailure.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update docs/wiki/framework/arsenal-framework.md Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> * Update addons/common/functions/fnc_adjustMagazineAmmo.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Header * use switch statement in fnc_useItem * Update addons/common/functions/fnc_adjustMagazineAmmo.sqf * Update addons/common/functions/fnc_adjustMagazineAmmo.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * only check adding to mags that are not full Co-Authored-By: LinkIsGrim <salluci.lovi@gmail.com> * Update addons/common/functions/fnc_adjustMagazineAmmo.sqf * Update fnc_getCountOfItem.sqf * Optimisations & header fix * Update addons/common/functions/fnc_adjustMagazineAmmo.sqf * Fixed vehicle implementation --------- Co-authored-by: Blue <itzblueman@gmail.com> Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> Co-authored-by: LinkIsGrim <salluci.lovi@gmail.com>
85 lines
2.0 KiB
Plaintext
85 lines
2.0 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: mharis001, Blue, Brett Mayson
|
|
* Returns list of unique items in the target's inventory.
|
|
*
|
|
* Arguments:
|
|
* 0: Target <OBJECT>
|
|
* 1: Include magazines <NUMBER>
|
|
* 0: No (default)
|
|
* 1: Yes
|
|
* 2: Only magazines
|
|
*
|
|
* Return Value:
|
|
* Items <ARRAY>
|
|
*
|
|
* Example:
|
|
* [player, 2] call ace_common_fnc_uniqueItems
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_target", ["_includeMagazines", 0]];
|
|
|
|
private _fnc_getItems = {
|
|
private _items = [];
|
|
|
|
private _inventoryItems = (getItemCargo uniformContainer _target) select 0;
|
|
_inventoryItems append ((getItemCargo vestContainer _target) select 0);
|
|
_inventoryItems append ((getItemCargo backpackContainer _target) select 0);
|
|
|
|
_items set [0, _inventoryItems];
|
|
_items set [1, magazines _target];
|
|
|
|
_items arrayIntersect _items
|
|
};
|
|
|
|
// Cache items list if unit is ACE_player
|
|
if (_target isEqualTo ACE_player) then {
|
|
if (isNil QGVAR(uniqueItemsCache)) then {
|
|
GVAR(uniqueItemsCache) = call _fnc_getItems;
|
|
};
|
|
|
|
switch (_includeMagazines) do {
|
|
case 0: {
|
|
GVAR(uniqueItemsCache) select 0
|
|
};
|
|
case 1: {
|
|
(GVAR(uniqueItemsCache) select 1) + (GVAR(uniqueItemsCache) select 0)
|
|
};
|
|
case 2: {
|
|
GVAR(uniqueItemsCache) select 1
|
|
};
|
|
};
|
|
} else {
|
|
if (_target isKindOf "CAManBase") then {
|
|
private _items = call _fnc_getItems;
|
|
|
|
switch (_includeMagazines) do {
|
|
case 0: {
|
|
_items select 0
|
|
};
|
|
case 1: {
|
|
(_items select 1) + (_items select 0)
|
|
};
|
|
case 2: {
|
|
_items select 1
|
|
};
|
|
};
|
|
} else {
|
|
private _items = switch (_includeMagazines) do {
|
|
case 0: {
|
|
itemCargo _target
|
|
};
|
|
case 1: {
|
|
(magazineCargo _target) + (itemCargo _target)
|
|
};
|
|
case 2: {
|
|
magazineCargo _target
|
|
};
|
|
};
|
|
|
|
_items arrayIntersect _items
|
|
};
|
|
};
|