mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Quickmount - Improve interactu menu getIn for static weapon (#7090)
For small static weapons getInNearest would sometimes not detect the vehicle as the `getCameraViewDirection` may be pointing at the interaction node and not the vehicle
This commit is contained in:
parent
fa910a7fd8
commit
1534f8cd8d
@ -4,7 +4,7 @@ if (!hasInterface) exitWith {};
|
|||||||
|
|
||||||
["ACE3 Movement", QGVAR(mount), [localize LSTRING(KeybindName), localize LSTRING(KeybindDescription)], "", {
|
["ACE3 Movement", QGVAR(mount), [localize LSTRING(KeybindName), localize LSTRING(KeybindDescription)], "", {
|
||||||
if (!dialog) then {
|
if (!dialog) then {
|
||||||
call FUNC(getInNearest);
|
[] call FUNC(getInNearest);
|
||||||
};
|
};
|
||||||
false
|
false
|
||||||
}] call CBA_fnc_addKeybind;
|
}] call CBA_fnc_addKeybind;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Mount the player in the vehicle they are directly looking at based on their distance.
|
* Mount the player in the vehicle they are directly looking at based on their distance.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* 0: Target <OBJECT>(Optional)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -22,17 +22,27 @@ if (!GVAR(enabled) ||
|
|||||||
{ACE_player getVariable ["ace_unconscious", false]}
|
{ACE_player getVariable ["ace_unconscious", false]}
|
||||||
) exitWith {};
|
) exitWith {};
|
||||||
|
|
||||||
|
params [["_interactionTarget", objNull, [objNull]]];
|
||||||
|
TRACE_1("getInNearest",_interactionTarget);
|
||||||
|
|
||||||
private _start = AGLtoASL (ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"));
|
private _start = AGLtoASL (ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"));
|
||||||
private _end = (_start vectorAdd (getCameraViewDirection ACE_player vectorMultiply GVAR(distance)));
|
private _end = (_start vectorAdd (getCameraViewDirection ACE_player vectorMultiply GVAR(distance)));
|
||||||
private _objects = lineIntersectsSurfaces [_start, _end, ACE_player];
|
private _objects = lineIntersectsSurfaces [_start, _end, ACE_player];
|
||||||
private _target = (_objects param [0, []]) param [2, objNull];
|
private _target = (_objects param [0, []]) param [2, objNull];
|
||||||
|
|
||||||
|
if ((isNull _target) && {alive _interactionTarget}) then {
|
||||||
|
_end = _start vectorAdd ((_start vectorFromTo (aimPos _interactionTarget)) vectorMultiply GVAR(distance));
|
||||||
|
_objects = lineIntersectsSurfaces [_start, _end, ACE_player];
|
||||||
|
TRACE_1("2nd ray attempt at interaction target aim pos",_objects);
|
||||||
|
_target = (_objects param [0, []]) param [2, objNull];
|
||||||
|
};
|
||||||
|
|
||||||
if (locked _target in [2,3]) exitWith {
|
if (locked _target in [2,3]) exitWith {
|
||||||
[localize LSTRING(VehicleLocked)] call EFUNC(common,displayTextStructured);
|
[localize LSTRING(VehicleLocked)] call EFUNC(common,displayTextStructured);
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
|
|
||||||
TRACE_1("",_target);
|
TRACE_2("",_target,typeOf _target);
|
||||||
|
|
||||||
if (!isNull _target &&
|
if (!isNull _target &&
|
||||||
{alive _target} &&
|
{alive _target} &&
|
||||||
|
Loading…
Reference in New Issue
Block a user