mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix Advanced Throwing IR Chemlight and in-hand pick up (#4313)
* Fix IR Chemlights pick up * Fix attached throwable pick up interaction condition * Fix in hand pick up locality
This commit is contained in:
parent
c4d2383005
commit
d3ee125d5e
@ -79,7 +79,8 @@ reverse _pathData;
|
||||
{
|
||||
_x params ["_col", "_newTrajAGL", "_iDim"];
|
||||
drawIcon3D ["\a3\ui_f\data\gui\cfg\hints\icon_text\group_1_ca.paa", _col, _newTrajAGL, _iDim, _iDim, 0, "", 2];
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
|
||||
#ifdef DRAW_THROW_PATH
|
||||
drawIcon3D ["", _col, _newTrajAGL, _iDim, _iDim, 0, str (ACE_player distance _newTrajAGL), 2, 0.05, "RobotoCondensed"];
|
||||
#endif
|
||||
} forEach _pathData;
|
||||
|
@ -88,6 +88,11 @@ if (isNull _activeThrowable) exitWith {
|
||||
[ACE_player, "No active throwable (explosion in hand)"] call FUNC(exitThrowMode);
|
||||
};
|
||||
|
||||
// Exit if locality changed (someone took the throwable from hand)
|
||||
if (!local _activeThrowable && {ACE_player getVariable [QGVAR(localityChanged), true]}) exitWith {
|
||||
[ACE_player, "Throwable locality changed"] call FUNC(exitThrowMode);
|
||||
};
|
||||
|
||||
// Set position
|
||||
private _posHeadRel = ACE_player selectionPosition "head";
|
||||
|
||||
|
@ -41,6 +41,15 @@ if (!isNull _attachedTo) then {
|
||||
// Change locality for manipulation (some commands require local object, such as setVelocity)
|
||||
if (!local _activeThrowable) then {
|
||||
["ace_setOwner", [_activeThrowable, CBA_clientID]] call CBA_fnc_serverEvent;
|
||||
|
||||
// Mark when it's safe to exit throw mode (locality change has delay)
|
||||
_unit setVariable [QGVAR(localityChanged), false];
|
||||
[{
|
||||
// Becomes local or times out
|
||||
local (_this select 0) || {(_this select 1) + 5 < CBA_missionTime}
|
||||
}, {
|
||||
(_this select 2) setVariable [QGVAR(localityChanged), true];
|
||||
}, [_activeThrowable, CBA_missionTime, _unit]] call CBA_fnc_waitUntilAndExecute;
|
||||
};
|
||||
|
||||
// Invoke listenable event
|
||||
|
@ -24,34 +24,35 @@
|
||||
if (EGVAR(interact_menu,keyDown) && {!isNull ACE_player}) then {
|
||||
// Rescan when player moved >5 meters from last pos, nearObjects is costly
|
||||
if ((getPosASL ACE_player) distance _setPosition > 5) then {
|
||||
// IR throwbles inherit from GrenadeCore, others from GrenadeHand
|
||||
_nearThrowables = ACE_player nearObjects ["GrenadeHand", 10];
|
||||
_nearThrowables append (ACE_player nearObjects ["GrenadeCore", 10]);
|
||||
// IR throwbles inherit from GrenadeCore, others from GrenadeHand, IR Chemlights are special snowflakes
|
||||
_nearThrowables = ACE_player nearObjects ["GrenadeHand", PICK_UP_DISTANCE];
|
||||
_nearThrowables append (ACE_player nearObjects ["GrenadeCore", PICK_UP_DISTANCE]);
|
||||
_nearThrowables append (ACE_player nearObjects ["ACE_Chemlight_IR_Dummy", PICK_UP_DISTANCE]);
|
||||
|
||||
{
|
||||
if (_x in _throwablesHelped) exitWith {};
|
||||
if (!(_x in _throwablesHelped) && {GVAR(enablePickUpAttached) || {!GVAR(enablePickUpAttached) && {isNull (attachedTo _x)}}}) then {
|
||||
TRACE_2("Making PickUp Helper",_x,typeOf _x);
|
||||
private _pickUpHelper = QGVAR(pickUpHelper) createVehicleLocal [0, 0, 0];
|
||||
|
||||
TRACE_2("Making PickUp Helper",_x,typeOf _x);
|
||||
private _pickUpHelper = QGVAR(pickUpHelper) createVehicleLocal [0, 0, 0];
|
||||
_pickUpHelper attachTo [_x, [0, 0, 0]];
|
||||
_pickUpHelper setVariable [QGVAR(throwable), _x];
|
||||
|
||||
_pickUpHelper attachTo [_x, [0, 0, 0]];
|
||||
_pickUpHelper setVariable [QGVAR(throwable), _x];
|
||||
|
||||
_addedPickUpHelpers pushBack _pickUpHelper;
|
||||
_throwablesHelped pushBack _x;
|
||||
true
|
||||
_addedPickUpHelpers pushBack _pickUpHelper;
|
||||
_throwablesHelped pushBack _x;
|
||||
};
|
||||
nil
|
||||
} count _nearThrowables;
|
||||
|
||||
_args set [0, getPosASL ACE_player];
|
||||
_args set [3, _nearThrowables];
|
||||
};
|
||||
|
||||
// Make sure helper is on correct location as it will not automatically move
|
||||
// attachTo is not supported with CfgAmmo, it is only used to get location
|
||||
{
|
||||
if (!GVAR(enablePickUpAttached) && {!isNull (attachedTo _x)}) exitWith {};
|
||||
|
||||
// Only handling with attachTo works nicely
|
||||
_x attachTo [_x getVariable [QGVAR(throwable), objNull], [0, 0, 0]];
|
||||
true
|
||||
nil
|
||||
} count _addedPickUpHelpers;
|
||||
} else {
|
||||
TRACE_1("Cleaning Pick Up Helpers",count _addedPickUpHelpers);
|
||||
|
@ -27,3 +27,5 @@
|
||||
#define THROW_TYPE_DEFAULT "normal"
|
||||
#define THROW_SPEED_DEFAULT 18
|
||||
#define DROP_DISTANCE_DEFAULT 0.2
|
||||
|
||||
#define PICK_UP_DISTANCE 10
|
||||
|
Loading…
Reference in New Issue
Block a user