2018-09-17 19:19:29 +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:
|
|
|
|
* [unit] call ace_repair_fnc_isInRepairFacility
|
|
|
|
*
|
2015-07-03 21:14:23 +00:00
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
2023-07-06 03:52:04 +00:00
|
|
|
#define CHECK_OBJECTS(var) ((var) findIf {(_x getVariable ["ACE_isRepairFacility", getNumber (configOf _x >> QGVAR(canRepair))] > 0) && {!(_x isKindOf "AllVehicles")} && {alive _x}} != -1)
|
|
|
|
|
2019-12-07 20:58:21 +00:00
|
|
|
params [["_object", objNull, [objNull]]];
|
2015-08-09 06:54:44 +00:00
|
|
|
TRACE_1("params",_object);
|
|
|
|
|
|
|
|
|
2023-07-06 03:52:04 +00:00
|
|
|
private _fnc_check = {
|
|
|
|
private _position = _object modelToWorldVisual [0, 0, eyePos _object select 2];
|
|
|
|
CHECK_OBJECTS(lineIntersectsWith [ARR_3(_position, _position vectorAdd [ARR_3(0, 0, 10)], _object)]) || {CHECK_OBJECTS(_object nearObjects 7.5)}
|
2015-07-03 21:14:23 +00:00
|
|
|
};
|
2018-08-06 16:27:14 +00:00
|
|
|
|
2023-07-06 03:52:04 +00:00
|
|
|
[[], _fnc_check, _object, QGVAR(inRepairFacilityCache), IN_REPAIR_FACILITY_CACHE_EXPIRY] call EFUNC(common,cachedCall);
|