Skip to content

Commit

Permalink
Carrying - Add hookable events to dropping objects (#10304)
Browse files Browse the repository at this point in the history
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 11, 2024
1 parent 33f2143 commit fef34a8
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions addons/dragging/functions/fnc_carryObject.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 3 additions & 0 deletions addons/dragging/functions/fnc_dragObject.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 3 additions & 0 deletions addons/dragging/functions/fnc_dropObject.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -107,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;
6 changes: 6 additions & 0 deletions addons/dragging/functions/fnc_dropObject_carry.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -129,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;
3 changes: 3 additions & 0 deletions addons/dragging/functions/fnc_startCarryLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 3 additions & 0 deletions addons/dragging/functions/fnc_startDragLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 6 additions & 0 deletions docs/wiki/framework/events-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)

Expand Down

0 comments on commit fef34a8

Please sign in to comment.