From 15b01acd72c963e807fb66019faaa188eba29672 Mon Sep 17 00:00:00 2001 From: jokoho482 Date: Sun, 21 Apr 2024 01:22:15 +0200 Subject: [PATCH] Readd Deploy to Inventory Cargo UI --- addons/cargo/functions/fnc_onOpenInventory.sqf | 16 +++++++++++++++- addons/cargo/functions/fnc_startDeploy.sqf | 7 ++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/addons/cargo/functions/fnc_onOpenInventory.sqf b/addons/cargo/functions/fnc_onOpenInventory.sqf index 59af5966c1..f6af464c73 100644 --- a/addons/cargo/functions/fnc_onOpenInventory.sqf +++ b/addons/cargo/functions/fnc_onOpenInventory.sqf @@ -87,7 +87,7 @@ GVAR(interactionParadrop) = _container isKindOf "Air" && { uiNamespace setVariable [QGVAR(CargoListBox), _list]; private _unloadBtn = _display ctrlCreate ["RscButton", -1, _group]; - _unloadBtn ctrlSetPosition [0.5 * _gX, 20 * _gY, 5.5 * _gX, 1 * _gY]; + _unloadBtn ctrlSetPosition [0.5 * _gX, 20 * _gY, 5.25 * _gX, 1 * _gY]; _unloadBtn ctrlSetText localize ([LSTRING(unloadObject), LSTRING(paradropButton)] select GVAR(interactionParadrop)); _unloadBtn ctrlAddEventHandler ["ButtonClick", { private _index = lbCurSel (uiNamespace getVariable QGVAR(CargoListBox)); @@ -97,6 +97,20 @@ GVAR(interactionParadrop) = _container isKindOf "Air" && { }]; _unloadBtn ctrlCommit 0; + if ((GVAR(enableDeploy) && !GVAR(interactionParadrop) && {isNull curatorCamera})) then { + private _depolyBtn = _display ctrlCreate ["RscButton", -1, _group]; + _depolyBtn ctrlSetPosition [6.25 * _gX, 20 * _gY, 5.25 * _gX, 1 * _gY]; + _depolyBtn ctrlSetText localize LSTRING(deployObject); + _depolyBtn ctrlAddEventHandler ["ButtonClick", { + private _index = lbCurSel (uiNamespace getVariable QGVAR(CargoListBox)); + if (_index == -1) exitWith {}; + closeDialog 602; + [ACE_Player, _index] call FUNC(startDeploy); + }]; + _depolyBtn ctrlCommit 0; + }; + + private _loadBarFrame = _display ctrlCreate ["RscFrame", -1, _group]; _loadBarFrame ctrlSetPosition [0.5 * _gX, 21.5 * _gY, 11 * _gX, 0.5 * _gY]; _loadBarFrame ctrlSetTextColor [0.9, 0.9, 0.9, 0.5]; diff --git a/addons/cargo/functions/fnc_startDeploy.sqf b/addons/cargo/functions/fnc_startDeploy.sqf index 185f71c712..06c9a87428 100644 --- a/addons/cargo/functions/fnc_startDeploy.sqf +++ b/addons/cargo/functions/fnc_startDeploy.sqf @@ -5,12 +5,13 @@ * * Arguments: * 0: Unit deploying + * 1: Index of Unloading Item (default: -1) * * Return Value: * None * * Example: - * player call ace_cargo_fnc_startDeploy + * [player, 1] call ace_cargo_fnc_startDeploy * * Public: No */ @@ -18,13 +19,13 @@ // Deny creating preview item as it will destroy player vehicle instantly by collision if (GVAR(interactionParadrop)) exitWith {}; -params ["_unit"]; +params [["_unit", objNull, [objNull]], ["_selected", -1, [0]]]; // Don't allow deploying if already deploying if (_unit getVariable [QGVAR(isDeploying), false]) exitWith {}; // This can be an object or a classname string -private _item = call FUNC(getSelectedItem); +private _item = _selected call FUNC(getSelectedItem); if (isNil "_item") exitWith {};