From d92d4a090fc0526eb6726e7fab3395395a3a32ef Mon Sep 17 00:00:00 2001 From: some-evil-kitty <106408180+some-evil-kitty@users.noreply.github.com> Date: Mon, 9 Sep 2024 22:01:24 -0400 Subject: [PATCH 1/7] Update fnc_dropObject_carry.sqf Set box velocity to unit velocity --- addons/dragging/functions/fnc_dropObject_carry.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index ba8cbd09f12..e1b704481e2 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -46,6 +46,7 @@ if (_tryLoad && {!(_target isKindOf "CAManBase")} && {["ace_cargo"] call EFUNC(c } else { // Release object detach _target; + [QEGVAR(common,setVelocity),[_target,getVelocity _unit],_target] call CBA_fnc_targetEvent; }; // Fix anim when aborting carrying persons From 93d916c1c2c539ec36c24052d72238c756739474 Mon Sep 17 00:00:00 2001 From: some-evil-kitty <106408180+some-evil-kitty@users.noreply.github.com> Date: Mon, 9 Sep 2024 22:09:05 -0400 Subject: [PATCH 2/7] fix spacing --- addons/dragging/functions/fnc_dropObject_carry.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index e1b704481e2..20a0ff8f400 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -46,7 +46,7 @@ if (_tryLoad && {!(_target isKindOf "CAManBase")} && {["ace_cargo"] call EFUNC(c } else { // Release object detach _target; - [QEGVAR(common,setVelocity),[_target,getVelocity _unit],_target] call CBA_fnc_targetEvent; + [QEGVAR(common,setVelocity), [_target, getVelocity _unit], _target] call CBA_fnc_targetEvent; }; // Fix anim when aborting carrying persons From 210fa0a452826847b04474b55c66891b8ef89734 Mon Sep 17 00:00:00 2001 From: some-evil-kitty <106408180+some-evil-kitty@users.noreply.github.com> Date: Mon, 9 Sep 2024 22:20:18 -0400 Subject: [PATCH 3/7] Update addons/dragging/functions/fnc_dropObject_carry.sqf Co-authored-by: PabstMirror --- addons/dragging/functions/fnc_dropObject_carry.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 20a0ff8f400..7b019fe6381 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -46,7 +46,7 @@ if (_tryLoad && {!(_target isKindOf "CAManBase")} && {["ace_cargo"] call EFUNC(c } else { // Release object detach _target; - [QEGVAR(common,setVelocity), [_target, getVelocity _unit], _target] call CBA_fnc_targetEvent; + [QEGVAR(common,setVelocity), [_target, velocity _unit], _target] call CBA_fnc_targetEvent; }; // Fix anim when aborting carrying persons From 52003cc7b1512116977802bd6b78981a552439d6 Mon Sep 17 00:00:00 2001 From: some-evil-kitty <106408180+some-evil-kitty@users.noreply.github.com> Date: Tue, 10 Sep 2024 11:33:28 -0400 Subject: [PATCH 4/7] Shift to hookable event --- addons/dragging/functions/fnc_dropObject_carry.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 7b019fe6381..7735b1cda9e 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -46,7 +46,7 @@ if (_tryLoad && {!(_target isKindOf "CAManBase")} && {["ace_cargo"] call EFUNC(c } else { // Release object detach _target; - [QEGVAR(common,setVelocity), [_target, velocity _unit], _target] call CBA_fnc_targetEvent; + [QGVAR(objectDroppedCarry), [_unit, _target]] call CBA_fnc_localEvent; }; // Fix anim when aborting carrying persons From 3b8aa15e09f3f40d412189d83bf87782b7919e65 Mon Sep 17 00:00:00 2001 From: some-evil-kitty <106408180+some-evil-kitty@users.noreply.github.com> Date: Tue, 10 Sep 2024 19:24:28 -0400 Subject: [PATCH 5/7] add event to drag dropObject named in keeping with the func names --- addons/dragging/functions/fnc_dropObject.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 965e3b9efa3..9553bc7b3d2 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -49,6 +49,7 @@ if (_unit call EFUNC(common,isAwake)) then { // Release object detach _target; +[QGVAR(objectDropped), [_unit, _target]] call CBA_fnc_localEvent; if (_target isKindOf "CAManBase") then { if (_target getVariable ["ACE_isUnconscious", false]) then { From 09142495aac97c30302a1c0f02a2917194478995 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:19:09 +0200 Subject: [PATCH 6/7] Added API events for dragging --- addons/dragging/functions/fnc_carryObject.sqf | 3 +++ addons/dragging/functions/fnc_dragObject.sqf | 3 +++ addons/dragging/functions/fnc_dropObject.sqf | 4 +++- addons/dragging/functions/fnc_dropObject_carry.sqf | 7 ++++++- addons/dragging/functions/fnc_startCarryLocal.sqf | 3 +++ addons/dragging/functions/fnc_startDragLocal.sqf | 3 +++ docs/wiki/framework/events-framework.md | 6 ++++++ 7 files changed, 27 insertions(+), 2 deletions(-) diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index 7b2b4faa6b0..d765020f96e 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -71,3 +71,6 @@ if (_UAVCrew isNotEqualTo []) then { // Check everything [LINKFUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler; + +// API +[QGVAR(startedCarry), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/addons/dragging/functions/fnc_dragObject.sqf b/addons/dragging/functions/fnc_dragObject.sqf index a8053b8dfee..3169db26795 100644 --- a/addons/dragging/functions/fnc_dragObject.sqf +++ b/addons/dragging/functions/fnc_dragObject.sqf @@ -87,3 +87,6 @@ if (_UAVCrew isNotEqualTo []) then { // Fixes not being able to move when in combat pace [_unit, "forceWalk", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); + +// API +[QGVAR(startedDrag), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 9553bc7b3d2..049f8228168 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -49,7 +49,6 @@ if (_unit call EFUNC(common,isAwake)) then { // Release object detach _target; -[QGVAR(objectDropped), [_unit, _target]] call CBA_fnc_localEvent; if (_target isKindOf "CAManBase") then { if (_target getVariable ["ACE_isUnconscious", false]) then { @@ -108,3 +107,6 @@ private _mass = _target getVariable [QGVAR(originalMass), 0]; if (_mass != 0) then { [QEGVAR(common,setMass), [_target, _mass]] call CBA_fnc_globalEvent; // Force global sync }; + +// API +[QGVAR(stoppedDrag), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 7735b1cda9e..525a150bcff 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -46,7 +46,6 @@ if (_tryLoad && {!(_target isKindOf "CAManBase")} && {["ace_cargo"] call EFUNC(c } else { // Release object detach _target; - [QGVAR(objectDroppedCarry), [_unit, _target]] call CBA_fnc_localEvent; }; // Fix anim when aborting carrying persons @@ -130,6 +129,12 @@ if (_loadCargo) then { } else { [_unit, _target, _cursorObject] call EFUNC(common,loadPerson); }; + + // Repurpose variable for flag used in event below + _loadCargo = true; }; }; }; + +// API +[QGVAR(stoppedCarry), [_unit, _target, _loadCargo]] call CBA_fnc_localEvent; diff --git a/addons/dragging/functions/fnc_startCarryLocal.sqf b/addons/dragging/functions/fnc_startCarryLocal.sqf index e7d102825aa..cf17dfb311d 100644 --- a/addons/dragging/functions/fnc_startCarryLocal.sqf +++ b/addons/dragging/functions/fnc_startCarryLocal.sqf @@ -99,3 +99,6 @@ if (_mass > 1) then { _target setVariable [QGVAR(originalMass), _mass, true]; [QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // Force global sync }; + +// API +[QGVAR(setupCarry), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/addons/dragging/functions/fnc_startDragLocal.sqf b/addons/dragging/functions/fnc_startDragLocal.sqf index 3abcef44305..f0468f133ba 100644 --- a/addons/dragging/functions/fnc_startDragLocal.sqf +++ b/addons/dragging/functions/fnc_startDragLocal.sqf @@ -116,3 +116,6 @@ if (_mass > 1) then { _target setVariable [QGVAR(originalMass), _mass, true]; [QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // Force global sync }; + +// API +[QGVAR(setupDrag), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index c0aa43a5739..b531387ee79 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -173,6 +173,12 @@ MenuType: 0 = Interaction, 1 = Self Interaction |---------- |------------|----------|------|-------------| | `ace_dragging_cloneCreated` | [_clone, _corpse] | Local | Listen | Called when a clone used for dragging/carrying corpses is created | `ace_dragging_cloneDeleted` | [_clone, _corpse] | Local | Listen | Called when a clone used for dragging/carrying corpses is deleted +| `ace_dragging_setupCarry` | [_unit, _target] | Local | Listen | Called when the unit starts the carrying animation for the target +| `ace_dragging_startedCarry` | [_unit, _target] | Local | Listen | Called when the unit starts successfully carrying the target. This event is called after `ace_dragging_setupCarry`. +| `ace_dragging_stoppedCarry` | [_unit, _target, _loadCargo] | Local | Listen | Called when the unit stops carrying the target. `_loadCargo` says if the target is being loaded as cargo/person or not. +| `ace_dragging_setupDrag` | [_unit, _target] | Local | Listen | Called when the unit starts the dragging animation for the target +| `ace_dragging_startedDrag` | [_unit, _target] | Local | Listen | Called when the unit starts successfully dragging the target. This event is called after `ace_dragging_setupDrag`. +| `ace_dragging_stoppedDrag` | [_unit, _target] | Local | Listen | Called when the unit stops dragging the target ### 2.19 HuntIR (`ace_huntir`) From 82603436e25c7e9f7fa8fc6ebb03b380e5f1b635 Mon Sep 17 00:00:00 2001 From: some-evil-kitty <106408180+some-evil-kitty@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:26:12 -0400 Subject: [PATCH 7/7] move carry drop event to main scope, include _loadCargo --- addons/dragging/functions/fnc_dropObject_carry.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 7735b1cda9e..47e279c2f71 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -46,7 +46,6 @@ if (_tryLoad && {!(_target isKindOf "CAManBase")} && {["ace_cargo"] call EFUNC(c } else { // Release object detach _target; - [QGVAR(objectDroppedCarry), [_unit, _target]] call CBA_fnc_localEvent; }; // Fix anim when aborting carrying persons @@ -133,3 +132,5 @@ if (_loadCargo) then { }; }; }; + +[QGVAR(objectDroppedCarry), [_unit, _target, _loadCargo]] call CBA_fnc_localEvent;