Skip to content

Commit

Permalink
Repair - Allow setting spare wheels/tracks count in config (#9481)
Browse files Browse the repository at this point in the history
* Allow setting spare wheels/tracks count in config

* Update repair framework docs
  • Loading branch information
tbeswick96 authored Oct 12, 2023
1 parent 2eb9148 commit bd377c4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
6 changes: 4 additions & 2 deletions addons/repair/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,17 @@

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);
};

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);
Expand Down
25 changes: 22 additions & 3 deletions docs/wiki/framework/repair-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bd377c4

Please sign in to comment.