mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
- ACE_Finger cleanup
- Allow pointing to nearby positions
This commit is contained in:
parent
8f3907c03f
commit
0160ee81a6
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Source Unit (can be self) <OBJECT>
|
||||
* 1: Position being pointed at (from positionCameraToWorld) <ARRAY>
|
||||
* 1: Position being pointed at (ASL) <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -16,18 +16,18 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_data", "_fingerPos"];
|
||||
params ["_sourceUnit", "_fingerPosPrecise", "_distance"];
|
||||
|
||||
params ["_sourceUnit", "_fingerPosPrecise"];
|
||||
|
||||
//add some random float to location if it's not our own finger:
|
||||
_fingerPos = if (_sourceUnit == ACE_player) then {
|
||||
// Add some random float to location if it's not our own finger:
|
||||
private _fingerPos = if (_sourceUnit == ACE_player) then {
|
||||
_fingerPosPrecise
|
||||
} else {
|
||||
_fingerPosPrecise vectorAdd [random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y]
|
||||
_fingerPosPrecise vectorAdd ([random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y] vectorMultiply _distance)
|
||||
};
|
||||
|
||||
_data = [diag_tickTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName))];
|
||||
TRACE_3("incoming finger:", _sourceUnit, _fingerPosPrecise, _fingerPos);
|
||||
|
||||
private _data = [diag_tickTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName))];
|
||||
HASH_SET(GVAR(fingersHash), _sourceUnit, _data);
|
||||
|
||||
if (GVAR(pfeh_id) == -1) then {
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private["_fingerPosPrecise", "_playerEyePos", "_sendFingerToPlayers", "_nearbyMen"];
|
||||
|
||||
if (!alive ACE_player) exitWith {false};
|
||||
// Conditions: canInteract
|
||||
@ -29,23 +28,27 @@ if (diag_tickTime < (GVAR(lastFPTime) + FP_ACTION_TIMEOUT)) exitWith {true};
|
||||
|
||||
GVAR(lastFPTime) = diag_tickTime;
|
||||
|
||||
_fingerPosPrecise = positionCameraToWorld [0, 0, FP_DISTANCE];
|
||||
_playerEyePos = eyePos ACE_player;
|
||||
// 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];
|
||||
if !(_intersections isEqualTo []) then {
|
||||
_fingerPosASL = _intersections select 0 select 0;
|
||||
};
|
||||
|
||||
_sendFingerToPlayers = [];
|
||||
|
||||
|
||||
_nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]);
|
||||
// Find who should the finger be sent to
|
||||
private _playerEyePosASL = eyePos ACE_player;
|
||||
private _sendFingerToPlayers = [];
|
||||
private _nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]);
|
||||
{
|
||||
_nearbyMen append (crew _x);
|
||||
} count (ACE_player nearObjects ["StaticWeapon", (GVAR(maxRange) + 2)]);
|
||||
|
||||
{
|
||||
if ((((eyePos _x) vectorDistance _playerEyePos) < GVAR(maxRange)) &&
|
||||
if ((((eyePos _x) vectorDistance _playerEyePosASL) < GVAR(maxRange)) &&
|
||||
{alive _x} &&
|
||||
{(_x == (vehicle _x)) || {(vehicle _x) isKindOf "StaticWeapon"}} &&
|
||||
{GVAR(indicatorForSelf) || {_x != ACE_player}} &&
|
||||
{!(lineIntersects [(eyePos _x), _playerEyePos, ACE_player, _x])} &&
|
||||
{!(lineIntersects [(eyePos _x), _playerEyePosASL, ACE_player, _x])} &&
|
||||
{[_x] call EFUNC(common,isPlayer)}) then {
|
||||
|
||||
_sendFingerToPlayers pushBack _x;
|
||||
@ -55,7 +58,7 @@ _nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]);
|
||||
|
||||
TRACE_1("sending finger to",_sendFingerToPlayers);
|
||||
|
||||
[QGVAR(fingered), [ACE_player, _fingerPosPrecise], _sendFingerToPlayers] call CBA_fnc_targetEvent;
|
||||
[QGVAR(fingered), [ACE_player, _fingerPosASL, _originASL vectorDistance _fingerPosASL], _sendFingerToPlayers] call CBA_fnc_targetEvent;
|
||||
|
||||
ACE_player playActionNow "GestureGo";
|
||||
|
||||
|
@ -15,33 +15,26 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private["_drawColor", "_fovCorrection", "_iconSize", "_timeLeftToShow", "_cameraOffset"];
|
||||
|
||||
if (!alive ACE_player) then {GVAR(fingersHash) = HASH_CREATE;};
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, ACE_player, ["isNotInside"]] call EFUNC(common,canInteractWith)) then {GVAR(fingersHash) = HASH_CREATE;};
|
||||
//make sure player is dismounted or in a static weapon:
|
||||
// Make sure player is dismounted or in a static weapon:
|
||||
if ((ACE_player != vehicle ACE_player) && {!((vehicle ACE_player) isKindOf "StaticWeapon")}) then {GVAR(fingersHash) = HASH_CREATE;};
|
||||
|
||||
_cameraOffset = worldToScreen (positionCameraToWorld [1000, 0, 10000]);
|
||||
_fovCorrection = 0;
|
||||
if (count _cameraOffset > 0) then {_fovCorrection = (_cameraOffset select 0) - 0.5;};
|
||||
_iconSize = BASE_SIZE * _fovCorrection;
|
||||
private _iconSize = BASE_SIZE * 0.10713 * (call EFUNC(common,getZoom));
|
||||
|
||||
{
|
||||
_data = HASH_GET(GVAR(fingersHash), _x);
|
||||
private _data = HASH_GET(GVAR(fingersHash), _x);
|
||||
_data params ["_lastTime", "_pos", "_name"];
|
||||
_timeLeftToShow = _lastTime + FP_TIMEOUT - diag_tickTime;
|
||||
private _timeLeftToShow = _lastTime + FP_TIMEOUT - diag_tickTime;
|
||||
if (_timeLeftToShow <= 0) then {
|
||||
HASH_REM(GVAR(fingersHash), _x);
|
||||
} else {
|
||||
_drawColor = + GVAR(indicatorColor);
|
||||
//Fade out:
|
||||
if (_timeLeftToShow < 0.5) then {
|
||||
_drawColor set [3, ((_drawColor select 3) * (_timeLeftToShow / 0.5))];
|
||||
};
|
||||
private _drawColor = + GVAR(indicatorColor);
|
||||
// Fade out:
|
||||
_drawColor set [3, ((_drawColor select 3) * ((_timeLeftToShow min 0.5) / 0.5))];
|
||||
|
||||
drawIcon3D [QPATHTOF(UI\fp_icon2.paa), _drawColor, _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "RobotoCondensed"];
|
||||
drawIcon3D [QPATHTOF(UI\fp_icon2.paa), _drawColor, ASLtoAGL _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "RobotoCondensed"];
|
||||
};
|
||||
} count (GVAR(fingersHash) select 0);
|
||||
|
||||
|
@ -22,6 +22,6 @@
|
||||
#define FP_TIMEOUT 2
|
||||
#define FP_ACTION_TIMEOUT 1
|
||||
|
||||
#define FP_DISTANCE 10000
|
||||
#define FP_RANDOMIZATION_X 350
|
||||
#define FP_RANDOMIZATION_Y 100
|
||||
#define FP_DISTANCE 5000
|
||||
#define FP_RANDOMIZATION_X 0.0350
|
||||
#define FP_RANDOMIZATION_Y 0.0100
|
||||
|
Loading…
Reference in New Issue
Block a user