-
Notifications
You must be signed in to change notification settings - Fork 735
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Magazine Repack - Add inventory context menu action (#7631)
- Loading branch information
Showing
4 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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,4 +1,4 @@ | ||
|
||
PREP(canRepackMagazine); | ||
PREP(getMagazineChildren); | ||
PREP(magazineRepackFinish); | ||
PREP(magazineRepackProgress); | ||
|
This file contains 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,23 @@ | ||
#include "script_component.hpp" | ||
|
||
// Inventory context menu action to repack magazines | ||
[ | ||
"#Magazine", | ||
["CONTAINER", "MAGAZINE"], | ||
LSTRING(RepackMagazines), | ||
[], | ||
QPATHTOEF(common,UI\repack_ca.paa), | ||
[ | ||
{true}, | ||
{ | ||
params ["_unit", "", "_magazine"]; | ||
|
||
[_unit, _magazine] call FUNC(canRepackMagazine) | ||
} | ||
], | ||
{ | ||
params ["_unit", "", "_magazine"]; | ||
|
||
[_unit, _unit, _magazine] call FUNC(startRepackingMagazine); | ||
} | ||
] call CBA_fnc_addItemContextMenuOption; |
This file contains 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,29 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: mharis001 | ||
* Checks if the given unit can repack magazines of the given type. | ||
* | ||
* Arguments: | ||
* 0: Unit <OBJECT> | ||
* 1: Magazine <STRING> | ||
* | ||
* Return Value: | ||
* Can Repack Magazine <BOOL> | ||
* | ||
* Example: | ||
* [_unit, _magazine] call ace_magazinerepack_fnc_canRepackMagazine | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_unit", "_magazine"]; | ||
|
||
private _maxAmmoCount = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count"); | ||
|
||
{ | ||
_x params ["_magazineType", "_ammoCount", "_isLoaded"]; | ||
|
||
_magazineType == _magazine // Magazine is of given type | ||
&& {_ammoCount > 0 && {_ammoCount < _maxAmmoCount}} // Is a partial magazine | ||
&& {!_isLoaded || {_unit canAdd _magazineType}} // In inventory or can be moved into it | ||
} count magazinesAmmoFull _unit > 1 |