Gunbag - Add BI Arsenal Compatibility (#7887)

* Initial Commit

* Remove development components

* Adapt to ACE_player & resolve returned assignment

* Update addons/gunbag/functions/fnc_BIArsenalClose.sqf

Co-authored-by: commy2 <commy-2@gmx.de>

Co-authored-by: commy2 <commy-2@gmx.de>
This commit is contained in:
mjc4wilton 2020-10-29 11:12:51 -04:00 committed by GitHub
parent 78c307196d
commit 2220822d30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 0 deletions

View File

@ -10,3 +10,19 @@ class Extended_PreInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
//EH must be loaded this way to get ace_gunbag_gunbagWeapon before it is deleted upon opening the BI arsenal. May cause instability with other mods.
class RscPicture;
class RscDisplayArsenal {
class Controls {
class IconBackgroundPrimaryWeapon: RscPicture {
onLoad = QUOTE([ACE_player] call FUNC(BIArsenalOpen));
};
};
};
class Extended_DisplayUnload_EventHandlers {
class RscDisplayArsenal {
ADDON = QUOTE([ACE_player] call FUNC(BIArsenalClose));
};
};

View File

@ -10,3 +10,5 @@ PREP(canInteract);
PREP(calculateMass);
PREP(hasGunbag);
PREP(isMachineGun);
PREP(BIArsenalClose);
PREP(BIArsenalOpen);

View File

@ -0,0 +1,26 @@
#include "script_component.hpp"
/*
* Author: mjc4wilton
* Handle BI arsenal closing
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [] call ace_gunbag_fnc_BIArsenalClose
*
* Public: No
*/
params ["_unit"];
if (!isNil QGVAR(arsenalCache)) then {
backpackContainer _unit setVariable [QGVAR(gunbagWeapon), GVAR(arsenalCache), true];
};
GVAR(arsenalCache) = nil;
nil

View File

@ -0,0 +1,22 @@
#include "script_component.hpp"
/*
* Author: mjc4wilton
* Handle BI arsenal opening
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [] call ace_gunbag_fnc_BIArsenalOpen
*
* Public: No
*/
params ["_unit"];
if ([_unit] call FUNC(hasGunBag)) then {
GVAR(arsenalCache) = backpackContainer _unit getVariable [QGVAR(gunbagWeapon), []];
};