diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index e14e070050..ec00693825 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -57,10 +57,14 @@ _unit setVariable [QGVAR(ReleaseActionID), [ ] call EFUNC(common,addActionEventHandler)]; // show mouse hint -[localize LSTRING(Drop), "", localize LSTRING(LowerRaise)] call EFUNC(interaction,showMouseHint); +if (_target isKindOf "CAManBase") then { + [localize LSTRING(Drop), "", ""] call EFUNC(interaction,showMouseHint); +} else { + [localize LSTRING(Drop), "", localize LSTRING(LowerRaise)] call EFUNC(interaction,showMouseHint); +}; // check everything -[FUNC(carryObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler; +[FUNC(carryObjectPFH), 0.5, [_unit, _target, ACE_time]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index ed988b4470..948af15891 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -6,6 +6,7 @@ * 0: ARGS * 0: Unit * 1: Target + * 2: Start time * 1: PFEH Id * * Return Value: @@ -23,7 +24,7 @@ #endif params ["_args", "_idPFH"]; -_args params ["_unit","_target"]; +_args params ["_unit","_target", "_startTime"]; if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { TRACE_2("carry false",_unit,_target); @@ -33,6 +34,11 @@ if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { TRACE_2("dead/distance",_unit,_target); + if ((_unit distance _target > 10) && {(ACE_time - _startTime) < 1}) exitWith { + //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, + //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) + TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,ACE_time); + }; [_unit, _target] call FUNC(dropObject_carry); [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/functions/fnc_dragObject.sqf b/addons/dragging/functions/fnc_dragObject.sqf index 7c9ec8cbf1..3237ddbb07 100644 --- a/addons/dragging/functions/fnc_dragObject.sqf +++ b/addons/dragging/functions/fnc_dragObject.sqf @@ -25,10 +25,13 @@ private _direction = _target getVariable [QGVAR(dragDirection), 0]; // add height offset of model private _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); - +if (_target isKindOf "CAManBase") then { + _offset = 0; +}; _position = _position vectorAdd [0, 0, _offset]; // attach object +TRACE_3("attaching",_position,_offset,_direction); _target attachTo [_unit, _position]; ["setDir", _target, [_target, _direction]] call EFUNC(common,targetEvent); @@ -50,7 +53,7 @@ _unit setVariable [QGVAR(ReleaseActionID), [ [localize LSTRING(Drop), ""] call EFUNC(interaction,showMouseHint); // check everything -[FUNC(dragObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler; +[FUNC(dragObjectPFH), 0.5, [_unit, _target, ACE_time]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; diff --git a/addons/dragging/functions/fnc_dragObjectPFH.sqf b/addons/dragging/functions/fnc_dragObjectPFH.sqf index e73d48b8b6..ab117e90fd 100644 --- a/addons/dragging/functions/fnc_dragObjectPFH.sqf +++ b/addons/dragging/functions/fnc_dragObjectPFH.sqf @@ -6,6 +6,7 @@ * 0: ARGS * 0: Unit * 1: Target + * 2: Start time * 1: PFEH Id * * Return Value: @@ -23,7 +24,7 @@ #endif params ["_args", "_idPFH"]; -_args params ["_unit", "_target"]; +_args params ["_unit","_target", "_startTime"]; if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { TRACE_2("drag false",_unit,_target); @@ -33,6 +34,11 @@ if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { TRACE_2("dead/distance",_unit,_target); + if ((_unit distance _target > 10) && {(ACE_time - _startTime) < 1}) exitWith { + //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, + //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) + TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,ACE_time); + }; [_unit, _target] call FUNC(dropObject); [_idPFH] call CBA_fnc_removePerFrameHandler; };