mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2438 from acemod/wheelRepairSettingToolkit
Add Setting for toolkit requirement for wheel repair
This commit is contained in:
commit
3cc2ccf025
@ -8,7 +8,7 @@ class ACE_Repair {
|
||||
requiredEngineer = QGVAR(engineerSetting_Wheel);
|
||||
repairingTime = 10;
|
||||
repairingTimeSelfCoef = 1;
|
||||
items[] = {"ToolKit"};
|
||||
items = QGVAR(wheelRepairRequiredItems);
|
||||
condition = QUOTE(call FUNC(canReplaceWheel));
|
||||
itemConsumed = 0;
|
||||
|
||||
@ -35,6 +35,7 @@ class ACE_Repair {
|
||||
requiredEngineer = 0;
|
||||
repairingTime = 15;
|
||||
callbackSuccess = QUOTE(call FUNC(doRepair));
|
||||
items[] = {"ToolKit"};
|
||||
};
|
||||
class RepairTrack: MiscRepair {
|
||||
displayName = CSTRING(Repairing);
|
||||
|
@ -68,4 +68,13 @@ class ACE_Settings {
|
||||
value = 1;
|
||||
category = ECSTRING(OptionsMenu,CategoryLogistics);
|
||||
};
|
||||
class GVAR(wheelRepairRequiredItems) {
|
||||
displayName = CSTRING(wheelRepairRequiredItems_name);
|
||||
description = CSTRING(wheelRepairRequiredItems_description);
|
||||
category = ECSTRING(OptionsMenu,CategoryLogistics);
|
||||
typeName = "SCALAR";
|
||||
value = 0;
|
||||
values[] = {"None", "ToolKit"};
|
||||
_values[] = {{}, {"ToolKit"}};
|
||||
};
|
||||
};
|
||||
|
@ -97,6 +97,15 @@ class CfgVehicles {
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class wheelRepairRequiredItems {
|
||||
displayName = CSTRING(wheelRepairRequiredItems_name);
|
||||
description = CSTRING(wheelRepairRequiredItems_description);
|
||||
typeName = "NUMBER";
|
||||
class values {
|
||||
class None { name = "None"; value = 0; default = 1;};
|
||||
class ToolKit { name = "ToolKit"; value = 1; };
|
||||
};
|
||||
};
|
||||
};
|
||||
class ModuleDescription {
|
||||
description = CSTRING(moduleDescription);
|
||||
|
@ -21,7 +21,7 @@
|
||||
params ["_caller", "_target", "_hitPoint", "_className"];
|
||||
TRACE_4("params",_caller,_target,_hitPoint,_className);
|
||||
|
||||
private ["_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition"];
|
||||
private ["_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition", "_settingName", "_settingItemsArray"];
|
||||
|
||||
_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className);
|
||||
if !(isClass _config) exitwith {false}; // or go for a default?
|
||||
@ -38,7 +38,17 @@ _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then {
|
||||
};
|
||||
if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitwith {false};
|
||||
|
||||
_items = getArray (_config >> "items");
|
||||
//Items can be an array of required items or a string to a ACE_Setting array
|
||||
_items = if (isArray (_config >> "items")) then {
|
||||
getArray (_config >> "items");
|
||||
} else {
|
||||
_settingName = getText (_config >> "items");
|
||||
_settingItemsArray = getArray (configFile >> "ACE_Settings" >> _settingName >> "_values");
|
||||
if ((isNil _settingName) || {(missionNamespace getVariable _settingName) >= (count _settingItemsArray)}) exitWith {
|
||||
ERROR("bad setting"); ["BAD"]
|
||||
};
|
||||
_settingItemsArray select (missionNamespace getVariable _settingName);
|
||||
};
|
||||
if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitwith {false};
|
||||
|
||||
_return = true;
|
||||
|
@ -33,4 +33,6 @@ if (!isServer) exitWith {};
|
||||
|
||||
[_logic, QGVAR(addSpareParts), "addSpareParts"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
[_logic, QGVAR(wheelRepairRequiredItems), "wheelRepairRequiredItems"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
ACE_LOGINFO("Repair Module Initialized.");
|
||||
|
@ -21,7 +21,7 @@
|
||||
params ["_caller", "_target", "_hitPoint", "_className"];
|
||||
TRACE_4("params",_calller,_target,_hitPoint,_className);
|
||||
|
||||
private["_callbackProgress", "_callerAnim", "_calller", "_condition", "_config", "_consumeItems", "_displayText", "_engineerRequired", "_iconDisplayed", "_items", "_locations", "_repairTime", "_repairTimeConfig", "_return", "_usersOfItems", "_vehicleStateCondition", "_wpn"];
|
||||
private["_callbackProgress", "_callerAnim", "_calller", "_condition", "_config", "_consumeItems", "_displayText", "_engineerRequired", "_iconDisplayed", "_items", "_locations", "_repairTime", "_repairTimeConfig", "_return", "_usersOfItems", "_vehicleStateCondition", "_wpn", "_settingName", "_settingItemsArray"];
|
||||
|
||||
_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className);
|
||||
if !(isClass _config) exitwith {false}; // or go for a default?
|
||||
@ -37,7 +37,18 @@ _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then {
|
||||
};
|
||||
if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitwith {false};
|
||||
if (isEngineOn _target) exitwith {false};
|
||||
_items = getArray (_config >> "items");
|
||||
|
||||
//Items can be an array of required items or a string to a ACE_Setting array
|
||||
_items = if (isArray (_config >> "items")) then {
|
||||
getArray (_config >> "items");
|
||||
} else {
|
||||
_settingName = getText (_config >> "items");
|
||||
_settingItemsArray = getArray (configFile >> "ACE_Settings" >> _settingName >> "_values");
|
||||
if ((isNil _settingName) || {(missionNamespace getVariable _settingName) >= (count _settingItemsArray)}) exitWith {
|
||||
ERROR("bad setting"); ["BAD"]
|
||||
};
|
||||
_settingItemsArray select (missionNamespace getVariable _settingName);
|
||||
};
|
||||
if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitwith {false};
|
||||
|
||||
_return = true;
|
||||
|
@ -901,5 +901,11 @@
|
||||
<Polish>Ilość wybranych części zamiennych.</Polish>
|
||||
<Portuguese>Número de partes sobressalentes.</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_wheelRepairRequiredItems_name">
|
||||
<English>Wheel repair requirements</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_wheelRepairRequiredItems_description">
|
||||
<English>Items required to remove/replace wheels</English>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user