2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-08-16 18:14:54 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Returns the damage threshold based on settings and unit type.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit that does the repairing <OBJECT>
|
2023-07-06 03:52:04 +00:00
|
|
|
* 1: Override for full repair <BOOL> (default: false)
|
2015-08-16 18:14:54 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2021-11-11 11:41:25 +00:00
|
|
|
* 0: Repair Damage Threshold <NUMBER>
|
2015-08-16 18:14:54 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [unit] call ace_repair_fnc_getPostRepairDamage
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-22 19:01:22 +00:00
|
|
|
|
2023-07-06 03:52:04 +00:00
|
|
|
params ["_unit", ["_override", false]];
|
|
|
|
TRACE_2("params",_unit,_override);
|
2015-08-09 16:08:53 +00:00
|
|
|
|
2023-07-06 03:52:04 +00:00
|
|
|
//If in facility, near vehicle, or doing full repair then complete repair of hitpoint:
|
|
|
|
if ((_override || {[_unit] call FUNC(isInRepairFacility)} || {[_unit] call FUNC(isNearRepairVehicle)})) exitWith {0};
|
2015-08-09 16:08:53 +00:00
|
|
|
|
2021-02-18 18:58:08 +00:00
|
|
|
private _class = _unit getVariable ["ACE_IsEngineer", getNumber (configOf _unit >> "engineer")];
|
2017-06-08 17:10:35 +00:00
|
|
|
//If advanced or more qualified than min, then use engineer threshold:
|
2015-12-09 02:31:40 +00:00
|
|
|
if ((_class isEqualTo 2) || {[_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer)}) exitWith {
|
|
|
|
(GVAR(repairDamageThreshold_Engineer) min GVAR(repairDamageThreshold))
|
|
|
|
};
|
|
|
|
|
|
|
|
//Return default threshold:
|
|
|
|
GVAR(repairDamageThreshold)
|