Remove mode, add arg to openBox to have arsenal prefilled

This commit is contained in:
Josuan Albin
2017-11-03 10:13:09 +01:00
parent f13d0ebc5b
commit a1b921e3d4
3 changed files with 20 additions and 42 deletions

View File

@ -1,7 +1,7 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params [["_object", objNull, [objNull]], ["_mode", 1, [1]], ["_items", true, [[], true]], ["_global", true, [true]]];
params [["_object", objNull, [objNull]], ["_items", true, [[], true]], ["_global", true, [true]]];
if (isNull _object) exitWith {};
@ -10,25 +10,26 @@ if (isNil QGVAR(EHIDArray)) then {
};
if (_global && {isMultiplayer} && {{_object in _x} count GVAR(EHIDArray) == 0}) then {
private _ID = [QGVAR(initBox), [_object, _mode, _items, false]] call CBA_fnc_globalEventJIP;
private _ID = [QGVAR(initBox), [_object, _items, false]] call CBA_fnc_globalEventJIP;
[_ID, _object] call CBA_fnc_removeGlobalEventJIP;
GVAR(EHIDArray) pushBack [_ID, _object];
publicVariable QGVAR(EHIDArray);
} else {
if ({(_x select 0) select 0 isEqualTo QGVAR(interaction)} count (_object getVariable [QEGVAR(interact_menu,actions), []]) == 0) then {
private _action = [QGVAR(interaction), "arsenal", "", {
params ["_target", "_player", "_params"];
_params params ["_mode"];
params ["_target", "_player"];
[{[_this select 0, _this select 1, _this select 2] call FUNC(openBox)}, [_mode, _target, _player]] call CBA_fnc_execNextFrame;
[{[_this select 0, _this select 1] call FUNC(openBox)}, [_target, _player]] call CBA_fnc_execNextFrame;
},
{
params ["_target", "_player"];
[_player, _target, ["isNotSwimming", "isNotCarrying", "isNotDragging", "notOnMap", "isNotEscorting", "isNotOnLadder"]] call EFUNC(common,canInteractWith)
}, {},[_mode]] call EFUNC(interact_menu,createAction);
}, {},[]] call EFUNC(interact_menu,createAction);
[_object, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToObject);
[_object, _items, false] call FUNC(addVirtualItems);

View File

@ -10,9 +10,6 @@ if (isNil QGVAR(center)) then {
};
GVAR(mouseButtonState) = [[],[]];
if (isNil QGVAR(mode)) then {
GVAR(mode) = 1;
};
if (isNil QGVAR(sharedLoadoutsNamespace)) then {
GVAR(sharedLoadoutsNamespace) = true call CBA_fnc_createNamespace;
@ -238,20 +235,6 @@ GVAR(leftTabFocus) = false;
GVAR(rightTabFocus) = false;
GVAR(rightTabLnBFocus) = false;
if (GVAR(mode) != 0) then {
{
_x = _display displayCtrl _x;
_x ctrlSetFade 1;
_x ctrlShow false;
_x ctrlCommit 0;
} foreach [
IDC_buttonFace,
IDC_buttonVoice,
IDC_buttonInsigna
];
};
{
private _panel = _display displayCtrl _x;
_panel ctrlSetFontHeight (GVAR(fontHeight) * GRID_H);

View File

@ -1,25 +1,13 @@
#include "script_component.hpp"
#include "..\defines.hpp"
params [["_mode", 1, [1]], ["_object", objNull, [objNull]], ["_center", objNull, [objNull]]];
params [["_object", objNull, [objNull]], ["_center", objNull, [objNull]], ["_mode", false, [false]]];
if (isNull _object || {isNull _center}) exitWith {};
if (isNil {_object getVariable [QGVAR(virtualItems), nil]}) exitWith {};
if (isNil {_object getVariable [QGVAR(virtualItems), nil]} && {!_mode}) exitWith {};
private _displayToUse = nil;
switch _mode do {
case 0 : {
_displayToUse = [findDisplay 46, findDIsplay 312] select (!isNull findDisplay 312);
_displayToUse = [_displayToUse, findDisplay 313] select (is3DEN);
};
case 1 : {
_displayToUse = [findDisplay 46, findDIsplay 312] select (!isNull findDisplay 312);
};
case 2 : {
_displayToUse = [findDisplay 46, findDIsplay 312] select (!isNull findDisplay 312);
};
default {};
};
private _displayToUse = [findDisplay 46, findDIsplay 312] select (!isNull findDisplay 312);
_displayToUse = [_displayToUse, findDisplay 313] select (is3DEN);
if (isNil "_displayToUse" || {!isnull GVAR(camera)}) exitWith {
hint "No display or arsenal already opened"; // TBR
@ -27,7 +15,13 @@ if (isNil "_displayToUse" || {!isnull GVAR(camera)}) exitWith {
GVAR(mode) = _mode;
GVAR(center) = _center;
GVAR(virtualItems) = +(_object getVariable [QGVAR(virtualItems), [
[[], [], []], [[], [], [], []], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []
]]);
if (_mode) then {
GVAR(virtualItems) = uiNamespace getVariable QGVAR(configItems);
} else {
GVAR(virtualItems) = +(_object getVariable [QGVAR(virtualItems), [
[[], [], []], [[], [], [], []], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []
]]);
};
_displayToUse createDisplay QGVAR(display);