2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-06-09 01:34:29 +00:00
|
|
|
/*
|
2015-06-09 05:00:00 +00:00
|
|
|
* Author: TheDrill, PabstMirror
|
2015-06-09 01:34:29 +00:00
|
|
|
* On keypress, point and send position to nearby players
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Key Handeled <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [] call ace_finger_fnc_keyPress;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
if (!alive ACE_player) exitWith {false};
|
|
|
|
// Conditions: canInteract
|
2017-08-22 18:30:56 +00:00
|
|
|
if !([ACE_player, ACE_player, ["isNotInside", "isNotSwimming"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-06-09 01:34:29 +00:00
|
|
|
//make sure player is dismounted or in a static weapon:
|
|
|
|
if ((ACE_player != vehicle ACE_player) && {!((vehicle ACE_player) isKindOf "StaticWeapon")}) exitWith {false};
|
|
|
|
//Check camera view (not in GUNNER)
|
|
|
|
if !(cameraView in ["INTERNAL", "EXTERNAL"]) exitWith {false};
|
|
|
|
//Exit if run recently (run every 1 seconds)
|
2016-03-02 10:01:39 +00:00
|
|
|
if (diag_tickTime < (GVAR(lastFPTime) + FP_ACTION_TIMEOUT)) exitWith {true};
|
2015-06-09 01:34:29 +00:00
|
|
|
|
2016-03-02 10:01:39 +00:00
|
|
|
GVAR(lastFPTime) = diag_tickTime;
|
2015-06-09 01:34:29 +00:00
|
|
|
|
2016-06-25 19:02:06 +00:00
|
|
|
// Find where is the finger pointing
|
|
|
|
private _originASL = AGLtoASL positionCameraToWorld [0, 0, 0];
|
|
|
|
private _fingerPosASL = AGLtoASL positionCameraToWorld [0, 0, FP_DISTANCE];
|
|
|
|
private _intersections = lineIntersectsSurfaces [_originASL, _fingerPosASL, ACE_player, vehicle ACE_player, true, 1];
|
2021-02-27 17:05:05 +00:00
|
|
|
if (_intersections isNotEqualTo []) then {
|
2016-06-25 19:02:06 +00:00
|
|
|
_fingerPosASL = _intersections select 0 select 0;
|
|
|
|
};
|
2015-06-09 01:34:29 +00:00
|
|
|
|
2016-06-25 19:02:06 +00:00
|
|
|
// Find who should the finger be sent to
|
|
|
|
private _playerEyePosASL = eyePos ACE_player;
|
|
|
|
private _sendFingerToPlayers = [];
|
|
|
|
private _nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]);
|
2015-06-09 19:02:19 +00:00
|
|
|
{
|
|
|
|
_nearbyMen append (crew _x);
|
2024-04-04 11:15:26 +00:00
|
|
|
} forEach (ACE_player nearObjects ["StaticWeapon", (GVAR(maxRange) + 2)]);
|
2015-06-09 01:34:29 +00:00
|
|
|
{
|
2016-06-25 19:02:06 +00:00
|
|
|
if ((((eyePos _x) vectorDistance _playerEyePosASL) < GVAR(maxRange)) &&
|
2015-06-09 01:34:29 +00:00
|
|
|
{alive _x} &&
|
|
|
|
{(_x == (vehicle _x)) || {(vehicle _x) isKindOf "StaticWeapon"}} &&
|
|
|
|
{GVAR(indicatorForSelf) || {_x != ACE_player}} &&
|
2019-12-07 20:58:21 +00:00
|
|
|
{((lineIntersectsSurfaces [(eyePos _x), _playerEyePosASL, vehicle ACE_player, vehicle _x]) isEqualTo [])} &&
|
2015-06-09 01:34:29 +00:00
|
|
|
{[_x] call EFUNC(common,isPlayer)}) then {
|
|
|
|
|
|
|
|
_sendFingerToPlayers pushBack _x;
|
|
|
|
};
|
2024-04-04 11:15:26 +00:00
|
|
|
} forEach _nearbyMen;
|
2015-06-09 01:34:29 +00:00
|
|
|
|
|
|
|
TRACE_1("sending finger to",_sendFingerToPlayers);
|
|
|
|
|
2016-06-25 19:02:06 +00:00
|
|
|
[QGVAR(fingered), [ACE_player, _fingerPosASL, _originASL vectorDistance _fingerPosASL], _sendFingerToPlayers] call CBA_fnc_targetEvent;
|
2015-06-09 01:34:29 +00:00
|
|
|
|
2017-08-22 18:30:56 +00:00
|
|
|
// BI gestures do not work underwater, play custom "point" gesture if loaded
|
|
|
|
if (["ace_gestures"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
QEGVAR(gestures,point) call EFUNC(gestures,playSignal); // Works underwater
|
|
|
|
} else {
|
|
|
|
[ACE_player, "GestureGo"] call EFUNC(common,doGesture); // Does not work underwater
|
|
|
|
};
|
2015-06-09 01:34:29 +00:00
|
|
|
|
|
|
|
true
|