mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Zeus - Add Repair and Rearm interactions (#6632)
* Add Repair and Rearm interaction to zeus * Optimize remoteControl statement
This commit is contained in:
parent
6ad28439b0
commit
d7c7ead574
@ -3,10 +3,11 @@ class ACE_ZeusActions {
|
||||
class ZeusUnits {
|
||||
displayName = "$STR_A3_RscDisplayCurator_ModeUnits_tooltip";
|
||||
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 {
|
||||
displayName = "$STR_A3_RscAttributeUnitPos_Title";
|
||||
condition = QUOTE(-1 < (curatorSelected select 0) findIf {_x isKindOf 'CAManBase'});
|
||||
|
||||
class prone {
|
||||
displayName = "$STR_Pos_Down";
|
||||
@ -33,14 +34,33 @@ class ACE_ZeusActions {
|
||||
class remoteControl {
|
||||
displayName = "$STR_A3_CfgVehicles_ModuleRemoteControl_F";
|
||||
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 {
|
||||
displayName = "$STR_A3_RscDisplayCurator_ModeGroups_tooltip";
|
||||
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 {
|
||||
displayName = "$STR_Combat_Mode";
|
||||
@ -145,7 +165,7 @@ class ACE_ZeusActions {
|
||||
class ZeusWaypoints {
|
||||
displayName = "Waypoints";
|
||||
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 {
|
||||
displayName = "$STR_Combat_Mode";
|
||||
@ -250,6 +270,6 @@ class ACE_ZeusActions {
|
||||
class ZeusMarkers {
|
||||
displayName = "$STR_A3_RscDisplayCurator_ModeMarkers_tooltip";
|
||||
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeMarkers_ca.paa";
|
||||
condition = QUOTE((count (curatorSelected select 3)) > 0);
|
||||
condition = QUOTE(!([] isEqualTo (curatorSelected select 3)));
|
||||
};
|
||||
};
|
||||
|
16
addons/rearm/ACE_ZeusActions.hpp
Normal file
16
addons/rearm/ACE_ZeusActions.hpp
Normal 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); \
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
@ -15,6 +15,7 @@ class CfgPatches {
|
||||
};
|
||||
|
||||
#include "ACE_Settings.hpp"
|
||||
#include "ACE_ZeusActions.hpp"
|
||||
#include "CfgEventHandlers.hpp"
|
||||
|
||||
#include "CfgAmmo.hpp"
|
||||
|
@ -23,7 +23,7 @@ TRACE_3("rearmEntireVehicle",_truck,_player,_vehicle);
|
||||
[
|
||||
TIME_PROGRESSBAR(10),
|
||||
[_truck, _vehicle, _player],
|
||||
FUNC(rearmEntireVehicleSuccess),
|
||||
{(_this select 0) call FUNC(rearmEntireVehicleSuccess)},
|
||||
"",
|
||||
format [localize LSTRING(BasicRearmAction), getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")],
|
||||
{
|
||||
|
@ -4,21 +4,19 @@
|
||||
* Rearm an entire vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Rearm information <ARRAY>
|
||||
* 0: Ammo Truck <OBJECT>
|
||||
* 1: Vehicle <OBJECT>
|
||||
* 0: Ammo Truck <OBJECT>
|
||||
* 1: Vehicle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [[ammo_truck, tank]] call ace_rearm_fnc_rearmEntireVehicleSuccess
|
||||
* [ammo_truck, tank] call ace_rearm_fnc_rearmEntireVehicleSuccess
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_args"];
|
||||
_args params ["_truck", "_vehicle"];
|
||||
params ["_truck", "_vehicle"];
|
||||
TRACE_2("rearmEntireVehicleSuccess",_truck,_vehicle);
|
||||
|
||||
if (isServer) then {
|
||||
|
@ -24,30 +24,38 @@ TRACE_3("rearmEntireVehicleSuccessLocal",_truck,_vehicle,_turretPath);
|
||||
private _magazines = ([_vehicle] call FUNC(getNeedRearmMagazines)) select {(_x select 1) isEqualTo _turretPath};
|
||||
{
|
||||
_x params ["_magazineClass", "_magTurretPath", "_isPylonMag", "_pylonIndex", "_maxMagazines", "_currentMagazines", "_maxRoundsPerMag", "_currentRounds"];
|
||||
|
||||
|
||||
// Array of planned ammo counts in every magazine after the rearm is complete
|
||||
private _plannedRounds = +_currentRounds;
|
||||
|
||||
|
||||
// Trying to fill all existing magazines.
|
||||
{
|
||||
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];
|
||||
};
|
||||
};
|
||||
} forEach _currentRounds;
|
||||
|
||||
|
||||
// Trying to add new full magazines, if there is space left.
|
||||
if (_currentMagazines < _maxMagazines) then {
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
TRACE_2("rearming",_x,_plannedRounds);
|
||||
|
||||
|
||||
// Updating new ammo counts to vehicle.
|
||||
if (_isPylonMag) then {
|
||||
_vehicle setAmmoOnPylon [_pylonIndex, (_plannedRounds select 0)];
|
||||
|
Loading…
Reference in New Issue
Block a user