2015-08-11 19:35:13 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Check if the unit can replace given wheel of the vehicle.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-16 18:14:54 +00:00
|
|
|
* 0: Unit that does the repairing <OBJECT>
|
|
|
|
* 1: Vehicle to repair <OBJECT>
|
|
|
|
* 2: Selected hitpoint <STRING>
|
2015-08-11 19:35:13 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-16 18:14:54 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [unit, vehicle, "hitpoint"] call ace_repair_fnc_canRepairTrack
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-08-11 19:35:13 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
params ["_unit", "_target", "_hitPoint", ["_wheel",false]];
|
|
|
|
TRACE_4("params",_unit,_target,_hitPoint,_wheel);
|
|
|
|
// TODO [_unit, _wheel] call EFUNC(common,claim); on start of action
|
|
|
|
|
2015-09-19 16:07:03 +00:00
|
|
|
if !([_unit, _target, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
|
|
|
2015-08-11 19:35:13 +00:00
|
|
|
if (typeName _wheel == "OBJECT") then {
|
|
|
|
// not near interpret as objNull
|
|
|
|
if !(_wheel in nearestObjects [_unit, ["ACE_Track"], 5]) then {
|
|
|
|
_wheel = objNull;
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
_wheel = objNull;
|
|
|
|
|
|
|
|
{
|
2015-08-31 19:22:22 +00:00
|
|
|
if ([_unit, _x, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith)) exitWith {
|
2015-08-11 19:35:13 +00:00
|
|
|
_wheel = _x;
|
|
|
|
};
|
|
|
|
} forEach nearestObjects [_unit, ["ACE_Track"], 5];
|
|
|
|
};
|
|
|
|
|
|
|
|
if (isNull _wheel || damage _wheel >= 1) exitWith {false};
|
|
|
|
|
|
|
|
alive _target && {_target getHitPointDamage _hitPoint > 0}
|