From a1b921e3d41bdb44653f7bfa43df5a478ca0e6d2 Mon Sep 17 00:00:00 2001 From: Josuan Albin Date: Fri, 3 Nov 2017 10:13:09 +0100 Subject: [PATCH] Remove mode, add arg to openBox to have arsenal prefilled --- addons/arsenal/functions/fnc_initBox.sqf | 13 ++++---- .../arsenal/functions/fnc_onArsenalOpen.sqf | 17 ---------- addons/arsenal/functions/fnc_openBox.sqf | 32 ++++++++----------- 3 files changed, 20 insertions(+), 42 deletions(-) diff --git a/addons/arsenal/functions/fnc_initBox.sqf b/addons/arsenal/functions/fnc_initBox.sqf index 7c36d9e5c6..2d261e6f0d 100644 --- a/addons/arsenal/functions/fnc_initBox.sqf +++ b/addons/arsenal/functions/fnc_initBox.sqf @@ -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); diff --git a/addons/arsenal/functions/fnc_onArsenalOpen.sqf b/addons/arsenal/functions/fnc_onArsenalOpen.sqf index 474cd4b559..e57ff89c89 100644 --- a/addons/arsenal/functions/fnc_onArsenalOpen.sqf +++ b/addons/arsenal/functions/fnc_onArsenalOpen.sqf @@ -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); diff --git a/addons/arsenal/functions/fnc_openBox.sqf b/addons/arsenal/functions/fnc_openBox.sqf index 7ff15d4c14..f99c45e2eb 100644 --- a/addons/arsenal/functions/fnc_openBox.sqf +++ b/addons/arsenal/functions/fnc_openBox.sqf @@ -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);