Add "Load Into Cargo" Zeus Module (#5528)

* Initial commit

* Finish TODOs

* Remove "<BR/>" from showing up on zeus messages

* Add check for scheduled environment, cargo enabled
This commit is contained in:
Ozan Eğitmen 2017-09-21 17:19:49 +03:00 committed by jonpas
parent 40e4ad3f5a
commit 21e9674ab7
8 changed files with 105 additions and 21 deletions

Binary file not shown.

View File

@ -66,7 +66,7 @@ private _statement = {
[_player, _target] call FUNC(startLoadIn);
};
private _text = localize LSTRING(loadObject);
private _icon = QPATHTOF(UI\Icon_load.paa);
private _icon = "a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa";
private _action = [QGVAR(load), _text, _icon, _statement, _condition, {call FUNC(addCargoVehiclesActions)}] call EFUNC(interact_menu,createAction);
if (_canLoadConfig) then {

View File

@ -98,14 +98,14 @@ class CfgVehicles {
category = QGVAR(Repair);
displayName = CSTRING(ModuleAddSpareTrack_DisplayName);
function = QFUNC(moduleAddSpareTrack);
icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);//@todo
icon = "a3\ui_f\data\IGUI\Cfg\Actions\repair_ca.paa";
};
class GVAR(moduleAddSpareWheel): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Repair);
displayName = CSTRING(ModuleAddSpareWheel_DisplayName);
function = QFUNC(moduleAddSpareWheel);
icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);//@todo
icon = "a3\ui_f\data\IGUI\Cfg\Actions\repair_ca.paa";
};
class GVAR(moduleAddOrRemoveFRIES): GVAR(moduleBase) {
curatorCanAttach = 1;
@ -143,6 +143,13 @@ class CfgVehicles {
displayName = CSTRING(ModuleGroupSide_DisplayName);
curatorInfoType = QGVAR(RscGroupSide);
};
class GVAR(moduleLoadIntoCargo): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Utility);
displayName = CSTRING(ModuleLoadIntoCargo_DisplayName);
function = QFUNC(moduleLoadIntoCargo);
icon = "a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa";
};
class GVAR(modulePatrolArea): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(AI);
@ -217,13 +224,13 @@ class CfgVehicles {
class GVAR(AddFullArsenal): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Utility);
displayName = CSTRING(moduleAddFullArsenal_displayName);
displayName = CSTRING(ModuleAddFullArsenal_DisplayName);
function = QFUNC(moduleAddArsenal);
};
class GVAR(RemoveFullArsenal): GVAR(moduleBase) {
curatorCanAttach = 1;
category = QGVAR(Utility);
displayName = CSTRING(moduleRemoveArsenal_displayName);
displayName = CSTRING(ModuleRemoveArsenal_DisplayName);
function = QFUNC(moduleRemoveArsenal);
};
};

View File

@ -13,6 +13,7 @@ PREP(moduleAddOrRemoveFRIES);
PREP(moduleCaptive);
PREP(moduleGlobalSetSkill);
PREP(moduleGroupSide);
PREP(moduleLoadIntoCargo);
PREP(moduleRemoveArsenal);
PREP(moduleSearchNearby);
PREP(moduleSetMedic);

View File

@ -8,6 +8,7 @@ class CfgPatches {
QGVAR(moduleEditableObjects),
QGVAR(moduleGlobalSetSkill),
QGVAR(moduleGroupSide),
QGVAR(moduleLoadIntoCargo),
QGVAR(modulePatrolArea),
QGVAR(moduleSearchArea),
QGVAR(moduleSearchNearby),
@ -25,6 +26,7 @@ class CfgPatches {
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
// Use additional CfgPatches to contextually remove modules from zeus
class GVAR(captives): ADDON {
units[] = {
@ -40,6 +42,11 @@ class CfgPatches {
QGVAR(moduleSetMedicalFacility)
};
};
class GVAR(cargo): ADDON {
units[] = {
QGVAR(moduleLoadIntoCargo)
};
};
class GVAR(cargoAndRepair): ADDON {
units[] = {
QGVAR(moduleAddSpareTrack),
@ -56,6 +63,7 @@ class CfgPatches {
class ACE_Curator {
GVAR(captives) = "ace_captives";
GVAR(medical) = "ace_medical";
GVAR(cargo) = "ace_cargo";
GVAR(cargoAndRepair)[] = {"ace_cargo", "ace_repair"};
GVAR(fastroping) = "ace_fastroping";
};

View File

@ -0,0 +1,66 @@
/*
* Author: 654wak654
* 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_moduleLoadIntoCargo
*
* Public: No
*/
#include "script_component.hpp"
if (canSuspend) exitWith {[FUNC(moduleSuppressiveFire), _this] call CBA_fnc_directCall;};
params ["_logic", "_units", "_activated"];
if !(_activated && {local _logic}) exitWith {};
private _cargo = attachedTo _logic;
deleteVehicle _logic;
if !(missionNamespace getVariable [QEGVAR(cargo,enable), false]) exitWith {
[LSTRING(RequiresAddon)] call FUNC(showMessage);
};
if (isNull _cargo) exitWith {
[LSTRING(NothingSelected)] call FUNC(showMessage);
};
if (!alive _cargo) exitWith {
[LSTRING(OnlyAlive)] call FUNC(showMessage);
};
[
_cargo,
{
params ["_successful", "_cargo", "_mousePosASL"];
if (!_successful) exitWith {};
private _holder = (nearestObjects [ASLToAGL _mousePosASL, EGVAR(cargo,cargoHolderTypes), 5]) param [0, objNull];
if (isNull _holder) exitWith {
[LSTRING(NothingSelected)] call FUNC(showMessage);
};
if (!alive _holder) exitWith {
[LSTRING(OnlyAlive)] call FUNC(showMessage);
};
private _displayName = [_cargo] call EFUNC(common,getName);
if ([_cargo, _holder] call EFUNC(cargo,loadItem)) then {
private _loadedItem = [localize ELSTRING(cargo,LoadedItem), "<br/>", " "] call CBA_fnc_replace;
private _holderDisplayName = [_holder] call EFUNC(common,getName);
[_loadedItem, _displayName, _holderDisplayName] call FUNC(showMessage);
} else {
private _loadingFailed = [localize ELSTRING(cargo,LoadingFailed), "<br/>", " "] call CBA_fnc_replace;
[_loadingFailed, _displayName] call FUNC(showMessage);
};
},
localize LSTRING(ModuleLoadIntoCargo_DisplayName),
"a3\ui_f\data\IGUI\Cfg\Actions\loadVehicle_ca.paa"
] call FUNC(getModuleDestination);

View File

@ -3,7 +3,7 @@
* Commands the selected unit or group to start suppressive fire on the unit, group or location the module is placed on
*
* Arguments:
* 0: The module logic <OBJECT>
* 0: Module logic <OBJECT>
* 1: Synchronized units <ARRAY>
* 2: Activated <BOOL>
*
@ -22,7 +22,7 @@ if (canSuspend) exitWith {[FUNC(moduleSuppressiveFire), _this] call CBA_fnc_dire
params ["_logic", "_units", "_activated"];
if !(_activated && local _logic) exitWith {};
if !(_activated && {local _logic}) exitWith {};
// Validate the module target
private _unit = effectiveCommander (attachedTo _logic);
@ -34,7 +34,7 @@ if (isNull _unit) exitWith {
[LSTRING(NothingSelected)] call FUNC(showMessage);
};
if (!alive _unit) exitWith {
[localize LSTRING(OnlyAlive)] call FUNC(showMessage);
[LSTRING(OnlyAlive)] call FUNC(showMessage);
};
if ([_unit] call EFUNC(common,isPlayer)) exitWith {
["str_a3_cfgvehicles_moduleremotecontrol_f_errorPlayer"] call FUNC(showMessage);
@ -43,8 +43,7 @@ if ([_unit] call EFUNC(common,isPlayer)) exitWith {
[_unit, {
params ["_successful", "_unit", "_mousePosASL"];
TRACE_3("getModuleDestination return",_successful,_unit,_mousePosASL);
if (!_successful) exitWith {};
if (!alive _unit) exitWith {};
if !(_successful && {alive _unit}) exitWith {};
private _vehicle = vehicle _unit;
private _targetASL = _mousePosASL vectorAdd [0,0,0.6]; // mouse pos is at ground level zero, raise up a bit;
@ -117,4 +116,4 @@ if ([_unit] call EFUNC(common,isPlayer)) exitWith {
};
#endif
}, (localize LSTRING(ModuleSuppressiveFire_DisplayName))] call FUNC(getModuleDestination);
}, localize LSTRING(ModuleSuppressiveFire_DisplayName)] call FUNC(getModuleDestination);

View File

@ -1017,23 +1017,26 @@
<Chinese>火力壓制</Chinese>
<Polish>Ogień zaporowy</Polish>
</Key>
<Key ID="STR_ACE_Zeus_moduleAddFullArsenal_displayName">
<English>Add full arsenal to object</English>
<French>Ajouter arsenal complet à l'objet</French>
<Italian>Aggiunge arsenale completo all'oggetto</Italian>
<Key ID="STR_ACE_Zeus_ModuleAddFullArsenal_DisplayName">
<English>Add Full Arsenal</English>
<French>Ajouter Arsenal Complet</French>
<Italian>Aggiunge Arsenale Completo</Italian>
<Japanese>オブジェクトに完全なアーセナルを追加</Japanese>
<Chinesesimp>增加完整的虚拟军火库到物件上</Chinesesimp>
<Chinese>增加完整的虛擬軍火庫到物件上</Chinese>
<Polish>Dodaj Wirtualny Arsenał do obiektu</Polish>
<Polish>Dodaj Wirtualny Arsenał</Polish>
</Key>
<Key ID="STR_ACE_Zeus_moduleRemoveArsenal_displayName">
<English>Remove arsenal from object</English>
<French>Retirer arsenal de l'objet</French>
<Italian>Rimuove arsenale completo dall'oggetto</Italian>
<Key ID="STR_ACE_Zeus_ModuleRemoveArsenal_DisplayName">
<English>Remove Arsenal</English>
<French>Retirer Arsenal</French>
<Italian>Rimuove Arsenale</Italian>
<Japanese>オブジェクトからアーセナルを削除</Japanese>
<Chinesesimp>移除物件上的虚拟军火库</Chinesesimp>
<Chinese>移除物件上的虛擬軍火庫</Chinese>
<Polish>Usuń Wirtualny Arsenał z obiektu</Polish>
<Polish>Usuń Wirtualny Arsenał</Polish>
</Key>
<Key ID="STR_ACE_Zeus_ModuleLoadIntoCargo_DisplayName">
<English>Load into Cargo</English>
</Key>
</Package>
</Project>