2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-07-03 21:14:23 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2015-08-16 18:14:54 +00:00
|
|
|
* Checks if a unit is in a repair facility.
|
2015-07-03 21:14:23 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-16 18:14:54 +00:00
|
|
|
* 0: Unit <OBJECT>
|
2015-07-03 21:14:23 +00:00
|
|
|
*
|
2015-08-16 18:14:54 +00:00
|
|
|
* Return Value:
|
2015-08-15 13:49:41 +00:00
|
|
|
* Is inside a repair facility <BOOL>
|
2015-07-03 21:14:23 +00:00
|
|
|
*
|
2015-08-16 18:14:54 +00:00
|
|
|
* Example:
|
2023-07-29 04:53:05 +00:00
|
|
|
* player call ace_repair_fnc_isInRepairFacility
|
2015-08-16 18:14:54 +00:00
|
|
|
*
|
2015-07-03 21:14:23 +00:00
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
2023-07-29 04:53:05 +00:00
|
|
|
#define CHECK_OBJECTS(var) ((var) findIf _checkObject != -1)
|
2023-07-06 03:52:04 +00:00
|
|
|
|
2023-07-29 04:53:05 +00:00
|
|
|
params [["_unit", objNull, [objNull]]];
|
|
|
|
TRACE_1("params",_unit);
|
2015-08-09 06:54:44 +00:00
|
|
|
|
2023-07-29 04:53:05 +00:00
|
|
|
private _checkObject = {
|
|
|
|
private _config = configOf _x;
|
|
|
|
private _canRepair = getNumber (_config >> QGVAR(canRepair));
|
|
|
|
if (_canRepair == 0) then {
|
|
|
|
_canRepair = getNumber (_config >> "transportRepair");
|
|
|
|
};
|
|
|
|
|
|
|
|
_x getVariable ["ACE_isRepairFacility", _canRepair > 0] in [1, true] // can be integer or boolean
|
|
|
|
&& {!(_x isKindOf "AllVehicles")} // check if it's not repair vehicle
|
|
|
|
&& {alive _x}
|
|
|
|
};
|
2015-08-09 06:54:44 +00:00
|
|
|
|
2023-07-06 03:52:04 +00:00
|
|
|
private _fnc_check = {
|
2023-07-29 04:53:05 +00:00
|
|
|
private _position = _unit modelToWorldVisual [0, 0, eyePos _unit select 2];
|
2024-02-05 17:04:24 +00:00
|
|
|
CHECK_OBJECTS(lineIntersectsWith [ARR_3(_position,_position vectorAdd [ARR_3(0,0,10)],_unit)])
|
2023-07-29 04:53:05 +00:00
|
|
|
|| {CHECK_OBJECTS(_unit nearObjects 7.5)}
|
2015-07-03 21:14:23 +00:00
|
|
|
};
|
2018-08-06 16:27:14 +00:00
|
|
|
|
2023-07-29 04:53:05 +00:00
|
|
|
[[], _fnc_check, _unit, QGVAR(inRepairFacilityCache), IN_REPAIR_FACILITY_CACHE_EXPIRY] call EFUNC(common,cachedCall);
|