mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Repair - Support all modded toolkits (#8595)
This commit is contained in:
parent
f8e06b49a2
commit
604f169ba5
@ -106,7 +106,6 @@ class CfgVehicles {
|
||||
class values {
|
||||
class None { name = "None"; value = 0; default = 1;};
|
||||
class ToolKit { name = "ToolKit"; value = 1; };
|
||||
class gm_repairkit_01 { name = "GM Repair Kit"; value = 1; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -17,6 +17,7 @@ PREP(doReplaceWheel);
|
||||
PREP(getClaimObjects);
|
||||
PREP(getHitPointString);
|
||||
PREP(getPostRepairDamage);
|
||||
PREP(getRepairItems);
|
||||
PREP(getWheelHitPointsWithSelections);
|
||||
PREP(hasItems);
|
||||
PREP(isEngineer);
|
||||
|
@ -8,6 +8,8 @@ PREP_RECOMPILE_END;
|
||||
|
||||
#include "initSettings.sqf"
|
||||
|
||||
GVAR(allToolKits) = call (uiNamespace getVariable QGVAR(allToolKits));
|
||||
|
||||
["ACE_RepairItem_Base", "killed", {
|
||||
params ["_object"];
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "XEH_PREP.hpp"
|
||||
|
||||
uiNamespace setVariable [
|
||||
QGVAR(allToolKits),
|
||||
compileFinal str (QUOTE(getNumber (_x >> 'ItemInfo' >> 'type') == TYPE_TOOLKIT) configClasses (configFile >> "CfgWeapons") apply {configName _x})
|
||||
];
|
||||
|
@ -37,12 +37,7 @@ private _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then {
|
||||
};
|
||||
if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitWith {false};
|
||||
|
||||
// Items can be an array of required items or a string to a missionNamespace variable
|
||||
private _items = if (isArray (_config >> "items")) then {
|
||||
getArray (_config >> "items");
|
||||
} else {
|
||||
missionNamespace getVariable [getText (_config >> "items"), []]
|
||||
};
|
||||
private _items = _config call FUNC(getRepairItems);
|
||||
if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitWith {false};
|
||||
|
||||
private _return = true;
|
||||
|
@ -7,7 +7,7 @@
|
||||
* 0: Unit that does the repairing <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: Rpair Damage Threshold <NUMBER>
|
||||
* 0: Repair Damage Threshold <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [unit] call ace_repair_fnc_getPostRepairDamage
|
||||
|
37
addons/repair/functions/fnc_getRepairItems.sqf
Normal file
37
addons/repair/functions/fnc_getRepairItems.sqf
Normal file
@ -0,0 +1,37 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: veteran29
|
||||
* Returns the items required for repair.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Repair config <CONFIG>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: Required items <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* [_config] call ace_repair_fnc_getRepairItems
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params [["_config", configNull]];
|
||||
|
||||
// Items can be an array of required items or a string to a missionNamespace variable
|
||||
private _items = if (isArray (_config >> "items")) then {
|
||||
getArray (_config >> "items");
|
||||
} else {
|
||||
missionNamespace getVariable [getText (_config >> "items"), []]
|
||||
};
|
||||
|
||||
// handle "any toolkit" setting
|
||||
if (_items isEqualTo [ANY_TOOLKIT_FAKECLASS]) then {
|
||||
TRACE_1("any toolkit",_items);
|
||||
|
||||
// array element inside items array means "any of these items"
|
||||
_items = [GVAR(allToolKits)];
|
||||
};
|
||||
|
||||
TRACE_2("get repair items",_config,_items);
|
||||
|
||||
_items
|
@ -29,4 +29,4 @@ private _return = true;
|
||||
};
|
||||
} forEach _items;
|
||||
|
||||
_return;
|
||||
_return
|
||||
|
@ -43,12 +43,7 @@ if ((isEngineOn _target) && {!GVAR(autoShutOffEngineWhenStartingRepair)}) exitWi
|
||||
false
|
||||
};
|
||||
|
||||
// Items can be an array of required items or a string to a missionNamespace variable
|
||||
private _items = if (isArray (_config >> "items")) then {
|
||||
getArray (_config >> "items");
|
||||
} else {
|
||||
missionNamespace getVariable [getText (_config >> "items"), []]
|
||||
};
|
||||
private _items = _config call FUNC(getRepairItems);
|
||||
if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitWith {false};
|
||||
|
||||
private _return = true;
|
||||
|
@ -94,7 +94,7 @@
|
||||
"LIST",
|
||||
[LSTRING(WheelRepairRequiredItems_DisplayName), LSTRING(WheelRepairRequiredItems_Description)],
|
||||
[localize ELSTRING(OptionsMenu,CategoryLogistics), localize "str_state_repair"],
|
||||
[[[], ["ToolKit"]], ["STR_A3_None", "STR_A3_CfgWeapons_Toolkit0"], 0],
|
||||
[[[], [ANY_TOOLKIT_FAKECLASS]], ["STR_A3_None", "STR_A3_CfgWeapons_Toolkit0"], 0],
|
||||
true
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
@ -103,7 +103,7 @@
|
||||
"LIST",
|
||||
[LSTRING(MiscRepairRequiredItems_DisplayName), LSTRING(MiscRepairRequiredItems_Description)],
|
||||
[localize ELSTRING(OptionsMenu,CategoryLogistics), localize "str_state_repair"],
|
||||
[[[], ["ToolKit"]], ["STR_A3_None", "STR_A3_CfgWeapons_Toolkit0"], 1],
|
||||
[[[], [ANY_TOOLKIT_FAKECLASS]], ["STR_A3_None", "STR_A3_CfgWeapons_Toolkit0"], 1],
|
||||
true
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
@ -112,7 +112,7 @@
|
||||
"LIST",
|
||||
[LSTRING(FullRepairRequiredItems_DisplayName), LSTRING(FullRepairRequiredItems_Description)],
|
||||
[localize ELSTRING(OptionsMenu,CategoryLogistics), localize "str_state_repair"],
|
||||
[[[], ["ToolKit"]], ["STR_A3_None", "STR_A3_CfgWeapons_Toolkit0"], 1],
|
||||
[[[], [ANY_TOOLKIT_FAKECLASS]], ["STR_A3_None", "STR_A3_CfgWeapons_Toolkit0"], 1],
|
||||
true
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
|
@ -19,3 +19,5 @@
|
||||
#define TRACK_HITPOINTS ["hitltrack", "hitrtrack"]
|
||||
|
||||
#define DAMAGE_COLOR_SCALE ["#FFFFFF", "#FFFF7E", "#FFEC4D", "#FFD52C", "#FCB121", "#FF9916", "#FF7D16", "#FF4400", "#FF0000"]
|
||||
|
||||
#define ANY_TOOLKIT_FAKECLASS QGVAR(anyToolKit)
|
||||
|
@ -97,17 +97,6 @@ class CfgVehicles {
|
||||
EGVAR(dragging,dragDirection) = 0;
|
||||
};
|
||||
|
||||
// TOOLKIT
|
||||
|
||||
class ACE_Module;
|
||||
class ACE_moduleRepairSettings: ACE_Module {
|
||||
class wheelRepairRequiredItems {
|
||||
class values {
|
||||
class gm_repairkit_01 { name = "RepairKit"; value = 1; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// STATIC
|
||||
|
||||
class gm_ge_army_shelteraceII_repair_base;
|
||||
|
Loading…
Reference in New Issue
Block a user