2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-05-09 02:47:15 +00:00
|
|
|
/*
|
2017-06-02 21:50:53 +00:00
|
|
|
* Author: commy2, Phyma
|
2015-09-28 15:11:53 +00:00
|
|
|
* Find door.
|
2015-05-09 02:47:15 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Distance <NUMBER>
|
|
|
|
*
|
2015-09-28 15:11:53 +00:00
|
|
|
* Return Value:
|
2015-05-09 02:47:15 +00:00
|
|
|
* House objects and door <ARRAY>
|
|
|
|
* 0: House <OBJECT>
|
|
|
|
* 1: Door Name <STRING>
|
|
|
|
*
|
|
|
|
* Example:
|
2015-05-14 18:00:56 +00:00
|
|
|
* [player, target] call ace_interaction_fnc_getDoor
|
2015-05-09 02:47:15 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-09-28 15:11:53 +00:00
|
|
|
params ["_distance"];
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _position0 = positionCameraToWorld [0, 0, 0];
|
|
|
|
private _position1 = positionCameraToWorld [0, 0, _distance];
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _intersections = lineIntersectsSurfaces [AGLToASL _position0, AGLToASL _position1, cameraOn, objNull, true, 1, "GEOM"];
|
2015-01-11 19:32:51 +00:00
|
|
|
|
2015-09-28 16:45:10 +00:00
|
|
|
if (_intersections isEqualTo []) exitWith {[objNull, ""]};
|
2015-09-28 15:11:53 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _house = _intersections select 0 select 2;
|
2015-01-11 19:32:51 +00:00
|
|
|
|
|
|
|
// shithouse is bugged
|
|
|
|
if (typeOf _house == "") exitWith {[objNull, ""]};
|
|
|
|
|
|
|
|
_intersections = [_house, "GEOM"] intersect [_position0, _position1];
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _door = toLower (_intersections select 0 select 0);
|
2017-06-02 21:50:53 +00:00
|
|
|
|
|
|
|
if (isNil "_door") exitWith {[_house, ""]};
|
|
|
|
|
|
|
|
//Check if door is glass because then we need to find the proper location of the door so we can use it
|
|
|
|
if ((_door find "glass") != -1) then {
|
|
|
|
_door = [_distance, _house, _door] call FUNC(getGlassDoor);
|
|
|
|
};
|
2015-09-28 15:11:53 +00:00
|
|
|
|
2015-01-11 19:32:51 +00:00
|
|
|
if (isNil "_door") exitWith {[_house, ""]};
|
2015-05-09 20:14:00 +00:00
|
|
|
|
2015-01-11 19:32:51 +00:00
|
|
|
[_house, _door]
|