-
Notifications
You must be signed in to change notification settings - Fork 749
Medical - Support Magazine Treatment Items #9816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
fe4ed52
count treatment items
BrettMayson e88afa6
getCountofItem
BrettMayson d05bb52
getCountofItem fix
BrettMayson 41eafbc
convert painkillers to magazine
BrettMayson 936897e
use isclass
BrettMayson d8cac46
forget to change variable
BrettMayson 5c15384
Update addons/medical_treatment/functions/fnc_hasItem.sqf
BrettMayson 65dfa6b
better magazine adjustment
BrettMayson ef251a4
Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
BrettMayson 5137885
Update addons/medical_treatment/functions/fnc_medication.sqf
BrettMayson 21a6b5b
Update addons/medical_treatment/functions/fnc_treatmentFailure.sqf
BrettMayson 81be584
Update docs/wiki/framework/arsenal-framework.md
BrettMayson a343b38
Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
BrettMayson ee070a6
Header
LinkIsGrim 8a0d64f
use switch statement in fnc_useItem
LinkIsGrim 601524d
Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
johnb432 e488e13
Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
BrettMayson a701251
only check adding to mags that are not full
BrettMayson 7709779
Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
johnb432 cbed198
Update fnc_getCountOfItem.sqf
johnb432 c6ebef8
Optimisations & header fix
johnb432 f53063d
Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
johnb432 f5dc797
Fixed vehicle implementation
johnb432 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Author: Katalam, Blue, Brett Mayson | ||
| * Handle adjusting a magazine's ammo | ||
| * | ||
| * Arguments: | ||
| * 0: Vehicle or Unit <OBJECT> | ||
| * 1: Item <STRING> | ||
| * 2: Count <NUMBER> (default: -1) | ||
|
LinkIsGrim marked this conversation as resolved.
Outdated
|
||
| * | ||
| * Return Value: | ||
| * Empty mag <BOOLEAN> - true if the magazine is empty after the ammo is consumed | ||
| * | ||
| * Example: | ||
| * [player, "30Rnd_556x45_Stanag", 1] call ace_common_fnc_adjustMagazineAmmo; | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_unit", "_item", ["_count", -1]]; | ||
|
|
||
| if (_unit isKindOf "CAManBase") then { | ||
| // get matching non-loaded mags | ||
| private _magazines = (magazinesAmmoFull _unit) select {(_x select 0) == _item && _x select 2 == false}; | ||
| // use items in uniform first, then vest, then backpack | ||
| _magazines = _magazines apply { | ||
| _x params ["_class", "_ammo", "_loaded", "", "_location"]; | ||
| [_class, _ammo, switch (_location) do { | ||
| case "Uniform": { | ||
| 0 | ||
| }; | ||
| case "Vest": { | ||
| 1 | ||
| }; | ||
| case "Backpack": { | ||
| 2 | ||
| }; | ||
| }] | ||
| }; | ||
| _magazines sort true; | ||
| _unit removeMagazines _item; | ||
|
BrettMayson marked this conversation as resolved.
Outdated
|
||
| (_magazines select 0) params ["_class", "_ammo", "_location"]; | ||
| _magazines set [0, [_class, _ammo + _count, _location]]; | ||
| { | ||
| _x params ["_class", "_ammo", "_location"]; | ||
| if (_ammo > 0) then { | ||
| switch (_location) do { | ||
|
BrettMayson marked this conversation as resolved.
Outdated
|
||
| case 0: { | ||
| uniformContainer _unit | ||
| }; | ||
| case 1: { | ||
| vestContainer _unit | ||
| }; | ||
| case 2: { | ||
| backpackContainer _unit | ||
| }; | ||
| } addMagazineAmmoCargo [_class, 1, _ammo]; | ||
| }; | ||
| } forEach _magazines; | ||
| _ammo + _count <= 0 | ||
| } else { | ||
| private _cargoMags = magazinesAmmoCargo _unit; | ||
| private _itemIndex = _cargoMags findIf {_x select 0 isEqualTo _item}; | ||
| if (_itemIndex == -1) exitWith {}; | ||
| clearMagazineCargoGlobal _unit; | ||
| { | ||
| if (_forEachIndex == _itemIndex) then { | ||
| if (((_x select 1) + _count) > 0) then { | ||
| _unit addMagazineAmmoCargo [_x select 0, 1, ((_x select 1) + _count)]; | ||
| }; | ||
| } else { | ||
| _unit addMagazineAmmoCargo [_x select 0, 1, _x select 1]; | ||
| }; | ||
| } forEach _cargoMags; | ||
| ((_cargoMags select _itemIndex) select 1) + _count <= 0 | ||
| }; | ||
|
BrettMayson marked this conversation as resolved.
Outdated
|
||
|
johnb432 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,84 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Author: mharis001 | ||
| * Returns list of unique items in a unit's inventory. | ||
| * Items are cached if unit is ACE_player. | ||
| * Author: mharis001, Blue, Brett Mayson | ||
| * Returns list of unique items in the target's inventory. | ||
| * | ||
| * Arguments: | ||
| * 0: Unit <OBJECT> | ||
| * 0: Target <OBJECT> | ||
| * 1: Include magazines <NUMBER> | ||
| * 0: No (default) | ||
| * 1: Yes | ||
| * 2: Only magazines | ||
| * | ||
| * Return Value: | ||
| * Items <ARRAY> | ||
| * | ||
| * Example: | ||
| * [player] call ace_common_fnc_uniqueItems | ||
| * [player, 2] call ace_common_fnc_getUniqueItems | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_unit"]; | ||
| params ["_target", ["_includeMagazines", 0]]; | ||
|
|
||
| private _fnc_getItems = { | ||
| private _items = (getItemCargo uniformContainer _unit) select 0; | ||
| _items append ((getItemCargo vestContainer _unit) select 0); | ||
| _items append ((getItemCargo backpackContainer _unit) select 0); | ||
| private _items = []; | ||
|
|
||
| private _inventoryItems = []; | ||
|
|
||
| _inventoryItems append ((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 | ||
| }; | ||
|
|
||
| // Use cached items list if unit is ACE_player | ||
| if (_unit isEqualTo ACE_player) then { | ||
| // Cache items list if unit is ACE_player | ||
| if (_target isEqualTo ACE_player) then { | ||
| if (isNil QGVAR(uniqueItemsCache)) then { | ||
| GVAR(uniqueItemsCache) = call _fnc_getItems; | ||
| }; | ||
| +GVAR(uniqueItemsCache) | ||
|
|
||
| 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; | ||
|
BrettMayson marked this conversation as resolved.
Outdated
|
||
| }; | ||
| }; | ||
| } else { | ||
| call _fnc_getItems; | ||
| if (_isVehicle) then { | ||
|
johnb432 marked this conversation as resolved.
Outdated
|
||
| private _items = switch (_includeMagazines) do { | ||
| case 0: { | ||
| itemCargo _target | ||
| }; | ||
| case 1: { | ||
| (magazineCargo _target) + (itemCargo _target) | ||
| }; | ||
| case 2: { | ||
| magazineCargo _target | ||
| }; | ||
| }; | ||
| _items arrayIntersect _items | ||
| } else { | ||
| 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; | ||
|
BrettMayson marked this conversation as resolved.
Outdated
|
||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| class CfgMagazines { | ||
| class CA_Magazine; | ||
| class ACE_painkillers: CA_Magazine { | ||
| scope = 2; | ||
| author = ECSTRING(common,ACETeam); | ||
| displayName = CSTRING(painkillers_Display); | ||
| model = "\A3\Structures_F_EPA\Items\Medical\PainKillers_F.p3d"; | ||
| picture = QPATHTOF(ui\painkillers_ca.paa); | ||
| descriptionShort = CSTRING(painkillers_Desc_Short); | ||
| descriptionUse = CSTRING(painkillers_Desc_Use); | ||
| ACE_isMedicalItem = 1; | ||
| ACE_asItem = 1; | ||
| count = 10; | ||
| mass = 1; | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
BrettMayson marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.