mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
23 lines
554 B
Plaintext
23 lines
554 B
Plaintext
/**
|
|
* fn_isInBuilding.sqf
|
|
* @Descr: Check is unit is within a building
|
|
* @Author: Glowbal
|
|
*
|
|
* @Arguments: [unit OBJECT]
|
|
* @Return: BOOL True if unit is under a roof
|
|
* @PublicAPI: true
|
|
*/
|
|
|
|
private ["_unit","_eyePos","_obj","_isInBuilding"];
|
|
_unit = _this select 0;
|
|
|
|
_eyePos = eyePos _unit;
|
|
_isInBuilding = false;
|
|
_obj = (lineIntersectsWith [_unit modelToWorld [0, 0, (_eyePos select 2)], _unit modelToWorld [0, 0, (_eyePos select 2) +10], _unit]);
|
|
{
|
|
if (_x isKindOf "Building") exitwith {
|
|
_isInBuilding = true;
|
|
};
|
|
}foreach _obj;
|
|
|
|
_isInBuilding |