R3vo/Sandbox1 – User
Field Repair
Spearhead 1944 introduces a system that allows to execute a field repair from within a vehicle. The hold action is available if the player's vehicle damage exceeds a predefined threshold.
Adding the Action
Scripted
The is added to the vehicle by executing _vehicle call SPE_missionUtilityFunctions_fnc_addRepairAction. The action has local effect which means it needs to be executed locally for every client that should have access to the action. Ideally, this is done by executing aboves code via initPlayerLocal.sqf.
Example:
Module
Customization
The underlying system is quite flexiable and can be configured in multiple ways.
Duration
The base duration of the action can be changed via SPE_RepairAction_BaseDuration = 5; where 5 is the time in seconds the action takes. This base value is then multiplied by a difficutly factor and an engineer bonus.
Engineer Bonus
By default, players who are engineers repair 100% faster. This value can be adjusted by changing SPE_RepairAction_EngineerBonus = 1; //Engineers have no bonus
Interval
The interval defines how many seconds have to pass between two repairs. SPE_RepairAction_Interval = 30;
Damage Thresholds
The damage Thresholds are defined in SPE_RepairAction_DamageThresholds = [0.5, 0]. The first value is the threshold for SPE_CadetMode == true the second one for SPE_CadetMode == false. These values define at which damage level the repair action is available and how much damage can be repaired. The values should be >= 0 and < 1.
What can be repaired?
What and how much can be repaired depends on the difficulty. In cadet mode SPE_CadetMode == true, the vehicle can be fully repaired and all parts can be repaired.
On higher difficulties SPE_CadetMode == false the repair is limited. Only vehicles with damage greater 0.5 can be repaired and only until their damage goes back down to 0.5. Besides that, only the crucial parts, responsible for keeping the vehicle operational, such as the engine, thetracks, the main gun and the turret can be repaired.
Pre-conditions
The following conditions need to be met for the action to show up.
- The vehicle is alive
- Player has to be in the vehicle
- The vehicle has to be slower than 10 km/h
- The vehicle has to be of type "AllVehicles"
- In none cadet mode, the vehicle has to be able to either fire or move
- The vehicle is not burning SPE_Vehicle_OnFire == false
- The time in seconds after the last repair execution is greater than SPE_RepairAction_Interval