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
|
|
|
|
*/
|
|
|
|
|
2019-12-07 20:58:21 +00:00
|
|
|
params [["_object", objNull, [objNull]]];
|
2015-08-09 06:54:44 +00:00
|
|
|
TRACE_1("params",_object);
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _position = getPosASL _object;
|
|
|
|
private _isInBuilding = false;
|
2015-08-09 06:54:44 +00:00
|
|
|
|
2018-08-06 16:27:14 +00:00
|
|
|
private _checkObject = {
|
|
|
|
if (
|
|
|
|
_x getVariable ["ACE_isRepairFacility", getNumber (configFile >> "CfgVehicles" >> typeOf _x >> QGVAR(canRepair))] > 0
|
|
|
|
&& {!(_x isKindOf "AllVehicles")} // check if it's not repair vehicle
|
|
|
|
&& {alive _x}
|
|
|
|
) exitWith {
|
2015-07-03 21:14:23 +00:00
|
|
|
_isInBuilding = true;
|
|
|
|
};
|
|
|
|
};
|
2018-08-06 16:27:14 +00:00
|
|
|
|
|
|
|
private _objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position select 2)], _object modelToWorldVisual [0, 0, (_position select 2) +10], _object]);
|
|
|
|
_checkObject forEach _objects;
|
|
|
|
|
|
|
|
if (_isInBuilding) exitWith {true};
|
|
|
|
|
2018-09-03 02:59:32 +00:00
|
|
|
_objects = _object nearObjects 7.5;
|
2018-08-06 16:27:14 +00:00
|
|
|
_checkObject forEach _objects;
|
|
|
|
|
|
|
|
_isInBuilding
|