Zeus - Add Repair and Rearm interactions (#6632)

* Add Repair and Rearm interaction to zeus

* Optimize remoteControl statement
This commit is contained in:
Dystopian 2018-10-13 20:07:32 +03:00 committed by PabstMirror
parent 6ad28439b0
commit d7c7ead574
6 changed files with 62 additions and 19 deletions

View File

@ -3,10 +3,11 @@ class ACE_ZeusActions {
class ZeusUnits { class ZeusUnits {
displayName = "$STR_A3_RscDisplayCurator_ModeUnits_tooltip"; displayName = "$STR_A3_RscDisplayCurator_ModeUnits_tooltip";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeUnits_ca.paa"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeUnits_ca.paa";
condition = QUOTE((count (curatorSelected select 0)) > 0); condition = QUOTE(!([] isEqualTo (curatorSelected select 0)));
class stance { class stance {
displayName = "$STR_A3_RscAttributeUnitPos_Title"; displayName = "$STR_A3_RscAttributeUnitPos_Title";
condition = QUOTE(-1 < (curatorSelected select 0) findIf {_x isKindOf 'CAManBase'});
class prone { class prone {
displayName = "$STR_Pos_Down"; displayName = "$STR_Pos_Down";
@ -33,14 +34,33 @@ class ACE_ZeusActions {
class remoteControl { class remoteControl {
displayName = "$STR_A3_CfgVehicles_ModuleRemoteControl_F"; displayName = "$STR_A3_CfgVehicles_ModuleRemoteControl_F";
icon = "\A3\Modules_F_Curator\Data\portraitRemoteControl_ca.paa"; icon = "\A3\Modules_F_Curator\Data\portraitRemoteControl_ca.paa";
statement = "_unit = objNull; { if ((side _x in [east,west,resistance,civilian]) && !(isPlayer _x)) exitWith { _unit = _x; }; } forEach (curatorSelected select 0); bis_fnc_curatorObjectPlaced_mouseOver = ['OBJECT',_unit]; (group _target) createUnit ['ModuleRemoteControl_F',[0,0,0],[],0,'NONE'];"; condition = QUOTE(-1 < (curatorSelected select 0) findIf {_x isKindOf 'CAManBase'});
statement = QUOTE( \
private _units = curatorSelected select 0; \
private _unit = _units param [ARR_2( \
_units findIf { \
side _x in [ARR_4(east,west,resistance,civilian)] \
&& !(isPlayer _x) \
}, \
objNull \
)]; \
bis_fnc_curatorObjectPlaced_mouseOver = [ARR_2('OBJECT',_unit)]; \
group _target createUnit [ARR_5('ModuleRemoteControl_F',[ARR_3(0,0,0)],[],0,'NONE')]; \
);
};
class GVAR(repair) {
displayName = "$STR_repair";
icon = "\A3\ui_f\data\igui\cfg\actions\repair_ca.paa";
condition = QUOTE(-1 < (curatorSelected select 0) findIf {_x isKindOf 'AllVehicles' && {!(_x isKindOf 'Man')}});
statement = QUOTE({if (_x isKindOf 'AllVehicles' && {!(_x isKindOf 'Man')}) then {_x setDamage 0}} forEach (curatorSelected select 0));
}; };
}; };
class ZeusGroups { class ZeusGroups {
displayName = "$STR_A3_RscDisplayCurator_ModeGroups_tooltip"; displayName = "$STR_A3_RscDisplayCurator_ModeGroups_tooltip";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeGroups_ca.paa"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeGroups_ca.paa";
condition = QUOTE((count (curatorSelected select 1)) > 0); condition = QUOTE(!([] isEqualTo (curatorSelected select 1)));
class behaviour { class behaviour {
displayName = "$STR_Combat_Mode"; displayName = "$STR_Combat_Mode";
@ -145,7 +165,7 @@ class ACE_ZeusActions {
class ZeusWaypoints { class ZeusWaypoints {
displayName = "Waypoints"; displayName = "Waypoints";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeRecent_ca.paa"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeRecent_ca.paa";
condition = QUOTE((count (curatorSelected select 2)) > 0); condition = QUOTE(!([] isEqualTo (curatorSelected select 2)));
class behaviour { class behaviour {
displayName = "$STR_Combat_Mode"; displayName = "$STR_Combat_Mode";
@ -250,6 +270,6 @@ class ACE_ZeusActions {
class ZeusMarkers { class ZeusMarkers {
displayName = "$STR_A3_RscDisplayCurator_ModeMarkers_tooltip"; displayName = "$STR_A3_RscDisplayCurator_ModeMarkers_tooltip";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeMarkers_ca.paa"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeMarkers_ca.paa";
condition = QUOTE((count (curatorSelected select 3)) > 0); condition = QUOTE(!([] isEqualTo (curatorSelected select 3)));
}; };
}; };

View File

@ -0,0 +1,16 @@
class ACE_ZeusActions {
class ZeusUnits {
class GVAR(rearm) {
displayName = CSTRING(Rearm);
icon = "\z\ace\addons\rearm\ui\icon_rearm_interact.paa";
condition = QUOTE(-1 < (curatorSelected select 0) findIf {_x isKindOf 'AllVehicles' && {!(_x isKindOf 'Man')}});
statement = QUOTE( \
{ \
if (_x isKindOf 'AllVehicles' && {!(_x isKindOf 'Man')}) then { \
[ARR_2(objNull,_x)] call ace_rearm_fnc_rearmEntireVehicleSuccess; \
}; \
} forEach (curatorSelected select 0); \
);
};
};
};

View File

@ -15,6 +15,7 @@ class CfgPatches {
}; };
#include "ACE_Settings.hpp" #include "ACE_Settings.hpp"
#include "ACE_ZeusActions.hpp"
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
#include "CfgAmmo.hpp" #include "CfgAmmo.hpp"

View File

@ -23,7 +23,7 @@ TRACE_3("rearmEntireVehicle",_truck,_player,_vehicle);
[ [
TIME_PROGRESSBAR(10), TIME_PROGRESSBAR(10),
[_truck, _vehicle, _player], [_truck, _vehicle, _player],
FUNC(rearmEntireVehicleSuccess), {(_this select 0) call FUNC(rearmEntireVehicleSuccess)},
"", "",
format [localize LSTRING(BasicRearmAction), getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")], format [localize LSTRING(BasicRearmAction), getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")],
{ {

View File

@ -4,7 +4,6 @@
* Rearm an entire vehicle. * Rearm an entire vehicle.
* *
* Arguments: * Arguments:
* 0: Rearm information <ARRAY>
* 0: Ammo Truck <OBJECT> * 0: Ammo Truck <OBJECT>
* 1: Vehicle <OBJECT> * 1: Vehicle <OBJECT>
* *
@ -12,13 +11,12 @@
* None * None
* *
* Example: * Example:
* [[ammo_truck, tank]] call ace_rearm_fnc_rearmEntireVehicleSuccess * [ammo_truck, tank] call ace_rearm_fnc_rearmEntireVehicleSuccess
* *
* Public: No * Public: No
*/ */
params ["_args"]; params ["_truck", "_vehicle"];
_args params ["_truck", "_vehicle"];
TRACE_2("rearmEntireVehicleSuccess",_truck,_vehicle); TRACE_2("rearmEntireVehicleSuccess",_truck,_vehicle);
if (isServer) then { if (isServer) then {

View File

@ -31,7 +31,11 @@ private _magazines = ([_vehicle] call FUNC(getNeedRearmMagazines)) select {(_x s
// Trying to fill all existing magazines. // Trying to fill all existing magazines.
{ {
if (_x < _maxRoundsPerMag) then { if (_x < _maxRoundsPerMag) then {
if ((GVAR(supply) == 0) || {[_truck, _magazineClass, (_maxRoundsPerMag - _x)] call FUNC(removeMagazineFromSupply)}) then { if (
GVAR(supply) == 0
|| {isNull _truck} // zeus rearm
|| {[_truck, _magazineClass, (_maxRoundsPerMag - _x)] call FUNC(removeMagazineFromSupply)}
) then {
_plannedRounds set [_forEachIndex, _maxRoundsPerMag]; _plannedRounds set [_forEachIndex, _maxRoundsPerMag];
}; };
}; };
@ -40,7 +44,11 @@ private _magazines = ([_vehicle] call FUNC(getNeedRearmMagazines)) select {(_x s
// Trying to add new full magazines, if there is space left. // Trying to add new full magazines, if there is space left.
if (_currentMagazines < _maxMagazines) then { if (_currentMagazines < _maxMagazines) then {
for "_idx" from 1 to (_maxMagazines - _currentMagazines) do { for "_idx" from 1 to (_maxMagazines - _currentMagazines) do {
if ((GVAR(supply) == 0) || {[_truck, _magazineClass, _maxRoundsPerMag] call FUNC(removeMagazineFromSupply)}) then { if (
GVAR(supply) == 0
|| {isNull _truck} // zeus rearm
|| {[_truck, _magazineClass, _maxRoundsPerMag] call FUNC(removeMagazineFromSupply)}
) then {
_plannedRounds pushBack _maxRoundsPerMag; _plannedRounds pushBack _maxRoundsPerMag;
}; };
}; };