Zeus - Add Zeus modules for unloading cargo (#9661)

Added unload cargo zeus module

Co-authored-by: LinkIsGrim <salluci.lovi@gmail.com>
This commit is contained in:
johnb432 2023-11-22 00:44:08 +01:00 committed by GitHub
parent 73807c261f
commit bae63636b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 77 additions and 1 deletions

View File

@ -44,7 +44,11 @@ if (GVAR(interactionParadrop)) then {
!alive _vehicle || !alive _vehicle ||
{locked _vehicle >= 2} || {locked _vehicle >= 2} ||
{!(_vehicle getVariable [QGVAR(hasCargo), true])} || // if the cargo menu could be opened, the vehicle has QGVAR(hasCargo) in its config or the variable is set using FUNC(setSpace) {!(_vehicle getVariable [QGVAR(hasCargo), true])} || // if the cargo menu could be opened, the vehicle has QGVAR(hasCargo) in its config or the variable is set using FUNC(setSpace)
{(([ACE_player, _vehicle] call EFUNC(interaction,getInteractionDistance)) >= MAX_LOAD_DISTANCE) && {(vehicle ACE_player) != _vehicle}} {
isNull findDisplay 312 && // if in Zeus, ignore the following checks
{([ACE_player, _vehicle] call EFUNC(interaction,getInteractionDistance)) >= MAX_LOAD_DISTANCE} &&
{(vehicle ACE_player) != _vehicle}
}
) exitWith { ) exitWith {
closeDialog 0; closeDialog 0;

View File

@ -73,6 +73,19 @@ if (GVAR(interactionParadrop)) exitWith {
]] call CBA_fnc_execNextFrame; ]] call CBA_fnc_execNextFrame;
}; };
// If in zeus
if (!isNull findDisplay 312) exitWith {
// Do not check distance to unit, but do check for valid position
if !([_item, GVAR(interactionVehicle), objNull, true] call FUNC(canUnloadItem)) exitWith {
[[LSTRING(unloadingFailed), [_item, true] call FUNC(getNameItem)], 3] call EFUNC(common,displayTextStructured);
};
// Close the cargo menu
closeDialog 1;
["ace_unloadCargo", [_item, GVAR(interactionVehicle)]] call CBA_fnc_localEvent;
};
// Start progress bar - normal ground unload // Start progress bar - normal ground unload
if ([_item, GVAR(interactionVehicle), _unit] call FUNC(canUnloadItem)) then { if ([_item, GVAR(interactionVehicle), _unit] call FUNC(canUnloadItem)) then {
// Close the cargo menu // Close the cargo menu

View File

@ -191,6 +191,13 @@ class CfgVehicles {
function = QFUNC(moduleLoadIntoCargo); function = QFUNC(moduleLoadIntoCargo);
icon = "a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa"; icon = "a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa";
}; };
class GVAR(moduleUnloadFromCargo): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Utility);
displayName = CSTRING(ModuleUnloadFromCargo_DisplayName);
function = QFUNC(moduleUnloadFromCargo);
icon = "a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa";
};
class GVAR(moduleCargoParadrop): GVAR(moduleBase) { class GVAR(moduleCargoParadrop): GVAR(moduleBase) {
curatorCanAttach = 1; curatorCanAttach = 1;
category = QGVAR(AI); category = QGVAR(AI);

View File

@ -43,6 +43,7 @@ PREP(moduleToggleFlashlight);
PREP(moduleToggleNvg); PREP(moduleToggleNvg);
PREP(moduleUnconscious); PREP(moduleUnconscious);
PREP(moduleUnGarrison); PREP(moduleUnGarrison);
PREP(moduleUnloadFromCargo);
PREP(moduleZeusSettings); PREP(moduleZeusSettings);
PREP(showMessage); PREP(showMessage);
PREP(ui_attributeCargo); PREP(ui_attributeCargo);

View File

@ -56,6 +56,7 @@ class CfgPatches {
class GVAR(cargo): ADDON { class GVAR(cargo): ADDON {
units[] = { units[] = {
QGVAR(moduleLoadIntoCargo), QGVAR(moduleLoadIntoCargo),
QGVAR(moduleUnloadFromCargo),
QGVAR(moduleCargoParadrop) QGVAR(moduleCargoParadrop)
}; };
}; };

View File

@ -0,0 +1,47 @@
#include "..\script_component.hpp"
/*
* Author: johnb43
* Loads the object module is placed on into selected vehicle.
*
* Arguments:
* 0: Module logic <OBJECT>
* 1: Synchronized units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Example:
* [LOGIC, [bob, kevin], true] call ace_zeus_fnc_moduleUnloadFromCargo
*
* Public: No
*/
if (canSuspend) exitWith {
[FUNC(moduleUnloadFromCargo), _this] call CBA_fnc_directCall;
};
params ["_logic"];
if !(local _logic) exitWith {};
private _vehicle = attachedTo _logic;
deleteVehicle _logic;
if !(missionNamespace getVariable [QEGVAR(cargo,enable), false]) exitWith {
[LSTRING(RequiresAddon)] call FUNC(showMessage);
};
if (isNull _vehicle) exitWith {
[LSTRING(NothingSelected)] call FUNC(showMessage);
};
if (!alive _vehicle) exitWith {
[LSTRING(OnlyAlive)] call FUNC(showMessage);
};
if ((_vehicle getVariable [QEGVAR(cargo,loaded), []]) isEqualTo []) exitWith {
[LSTRING(paradrop_noCargoLoaded)] call FUNC(showMessage);
};
EGVAR(cargo,interactionVehicle) = _vehicle;
EGVAR(cargo,interactionParadrop) = false;
createDialog QEGVAR(cargo,menu);

View File

@ -1314,6 +1314,9 @@
<French>Charger dans le véhicule</French> <French>Charger dans le véhicule</French>
<Spanish>Cargar en la carga</Spanish> <Spanish>Cargar en la carga</Spanish>
</Key> </Key>
<Key ID="STR_ACE_Zeus_ModuleUnloadFromCargo_DisplayName">
<English>Unload from cargo</English>
</Key>
<Key ID="STR_ACE_Zeus_ModuleToggleNVG_DisplayName"> <Key ID="STR_ACE_Zeus_ModuleToggleNVG_DisplayName">
<English>Toggle NVGs</English> <English>Toggle NVGs</English>
<German>Nachtsichtgeräte Hinzufügen/Entfernen</German> <German>Nachtsichtgeräte Hinzufügen/Entfernen</German>