From bd377c49fce7c185445f4674568f68d35565908c Mon Sep 17 00:00:00 2001 From: Tim Beswick Date: Thu, 12 Oct 2023 17:45:56 +0100 Subject: [PATCH] Repair - Allow setting spare wheels/tracks count in config (#9481) * Allow setting spare wheels/tracks count in config * Update repair framework docs --- addons/repair/XEH_postInit.sqf | 6 ++++-- docs/wiki/framework/repair-framework.md | 25 ++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/addons/repair/XEH_postInit.sqf b/addons/repair/XEH_postInit.sqf index f717e56651..58bb1be6e5 100644 --- a/addons/repair/XEH_postInit.sqf +++ b/addons/repair/XEH_postInit.sqf @@ -64,7 +64,8 @@ private _spareTracks = _vehicle getVariable QGVAR(editorLoadedTracks); if (isNil "_spareTracks") then { - _spareTracks = parseNumber (_vehicle isKindOf "Tank"); // must match eden attribute default + private _defaultCount = parseNumber (_vehicle isKindOf "Tank"); // must match eden attribute default + _spareTracks = [configOf _vehicle >> QGVAR(spareTracks), "NUMBER", _defaultCount] call CBA_fnc_getConfigEntry; }; if (_spareTracks > 0) then { [_vehicle, _spareTracks, "ACE_Track"] call FUNC(addSpareParts); @@ -72,7 +73,8 @@ private _spareWheels = _vehicle getVariable QGVAR(editorLoadedWheels); if (isNil "_spareWheels") then { - _spareWheels = parseNumber (_vehicle isKindOf "Car"); // must match eden attribute default + private _defaultCount = parseNumber (_vehicle isKindOf "Car"); // must match eden attribute default + _spareWheels = [configOf _vehicle >> QGVAR(spareWheels), "NUMBER", _defaultCount] call CBA_fnc_getConfigEntry; }; if (_spareWheels > 0) then { [_vehicle, _spareWheels, "ACE_Wheel"] call FUNC(addSpareParts); diff --git a/docs/wiki/framework/repair-framework.md b/docs/wiki/framework/repair-framework.md index d825aa0372..09e2686411 100644 --- a/docs/wiki/framework/repair-framework.md +++ b/docs/wiki/framework/repair-framework.md @@ -14,19 +14,38 @@ version: ## 1. Config Values -### 1.2 Setting Vehicle As Repair Location +### 1.1 Setting Vehicle As Repair Location A vehicle will be set as a repair truck based on the config `ace_repair_canRepair`. Setting `fullRepairLocation` needs to be enabled and is by *disabled* default. ```cpp -class CfgVehicles: Car_F{ - class MyRepairTruck { +class CfgVehicles { + class Car_F; + class MyTruck: Car_F { ace_repair_canRepair = 1; // Make repair vehicle }; }; ``` +### 1.2 Setting Vehicle Spare Wheels and Tracks + +A vehicle can have a default count of spare wheels/tracks based on the config `ace_repair_spareWheels` and `ace_repair_spareTracks`. +Values set in 3den for a vehicle will be used first. Vehicles with no value set in 3den or config will default to 1 spare wheel/track. + +```cpp +class CfgVehicles { + class Car_F; + class MyTruck: Car_F { + ace_repair_spareWheels = 4; + }; + class Tank_F; + class MyTank: Tank_F { + ace_repair_spareTracks = 4; + }; +}; +``` + ## 2. Variables ## 2.1 Make A Vehicle Into A Repair Truck