ACE3/addons/interaction/functions/fnc_getDoor.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

48 lines
1.2 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: commy2, Phyma
* Find door.
*
* Arguments:
* 0: Distance <NUMBER>
*
* Return Value:
* House objects and door <ARRAY>
* 0: House <OBJECT>
* 1: Door Name <STRING>
*
* Example:
* [player, target] call ace_interaction_fnc_getDoor
*
* Public: No
*/
params ["_distance"];
private _position0 = positionCameraToWorld [0, 0, 0];
private _position1 = positionCameraToWorld [0, 0, _distance];
private _intersections = lineIntersectsSurfaces [AGLToASL _position0, AGLToASL _position1, cameraOn, objNull, true, 1, "GEOM"];
if (_intersections isEqualTo []) exitWith {[objNull, ""]};
private _house = _intersections select 0 select 2;
// shithouse is bugged
if (typeOf _house == "") exitWith {[objNull, ""]};
_intersections = [_house, "GEOM"] intersect [_position0, _position1];
private _door = toLower (_intersections select 0 select 0);
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);
};
if (isNil "_door") exitWith {[_house, ""]};
[_house, _door]