Fix for vehicles returning empty array with getAllHitPointsDamage

This commit is contained in:
Ivanowicz
2023-11-26 18:23:04 +01:00
parent bdc83f5205
commit 011cc6a1cc
3 changed files with 35 additions and 1 deletions

View File

@ -87,7 +87,7 @@ class ACE_Repair {
requiredEngineer = QGVAR(engineerSetting_fullRepair);
repairLocations[] = {QGVAR(fullRepairLocation)};
repairingTime = QFUNC(getFullRepairTime);
condition = "((getAllHitPointsDamage _target) select 2) findIf {_x > 0} != -1";
condition = QFUNC(canFullRepair);
callbackSuccess = QFUNC(doFullRepair);
callbackProgress = QFUNC(fullRepairProgress);
items = QGVAR(fullRepairRequiredItems);

View File

@ -9,6 +9,7 @@ PREP(canRepair);
PREP(canRepairTrack);
PREP(canReplaceTrack);
PREP(canReplaceWheel);
PREP(canFullRepair);
PREP(doFullRepair);
PREP(doPatchWheelProgress);
PREP(doRemoveTrack);

View File

@ -0,0 +1,33 @@
#include "..\script_component.hpp"
/*
* Author: Ivanowicz
* Check if vehicle has non-empty hitpoint damage array and if any of the hitpoints has damage.
*
* Arguments:
* 0: Unit that does the repairing <OBJECT>
* 1: Vehicle to repair <OBJECT>
*
* Return Value:
* Can Full Repair <BOOL>
*
* Example:
* [unit, vehicle] call ace_repair_fnc_canFullRepair
*
* Public: No
*/
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);
private _return = false;
if ((getAllHitPointsDamage _target) isNotEqualTo []) then {
if (((getAllHitPointsDamage _target) select 2) findIf {_x > 0} != -1) then {
_return = true;
};
};
_return