From a421a63eea03bde943bdd0f636a5a3a7c52885f9 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Sat, 20 Aug 2022 22:43:50 +0200 Subject: [PATCH] Trenches - Add "placed" and "finished" events (#8998) * Add trench placed and finished global events * Docs --- addons/trenches/functions/fnc_continueDiggingTrench.sqf | 2 ++ addons/trenches/functions/fnc_placeConfirm.sqf | 2 ++ docs/wiki/framework/events-framework.md | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/addons/trenches/functions/fnc_continueDiggingTrench.sqf b/addons/trenches/functions/fnc_continueDiggingTrench.sqf index 4c6c6f9546..8380a83af9 100644 --- a/addons/trenches/functions/fnc_continueDiggingTrench.sqf +++ b/addons/trenches/functions/fnc_continueDiggingTrench.sqf @@ -48,6 +48,8 @@ private _fnc_onFinish = { private _progress = _trench getVariable [QGVAR(progress), 0]; _trench setVariable [QGVAR(progress), _progress, true]; + [QGVAR(finished), [_unit, _trench]] call CBA_fnc_globalEvent; + // Reset animation [_unit, "", 1] call EFUNC(common,doAnimation); }; diff --git a/addons/trenches/functions/fnc_placeConfirm.sqf b/addons/trenches/functions/fnc_placeConfirm.sqf index 867b034679..43fad843ee 100644 --- a/addons/trenches/functions/fnc_placeConfirm.sqf +++ b/addons/trenches/functions/fnc_placeConfirm.sqf @@ -44,6 +44,8 @@ GVAR(trenchPlacementData) params ["_dx", "_dy", "_offset"]; private _basePos = GVAR(trenchPos); private _angle = (GVAR(digDirection) + getDir _unit); +[QGVAR(placed), [_unit, _trench]] call CBA_fnc_globalEvent; + // _v1 forward from the player, _v2 to the right, _v3 points away from the ground private _v3 = surfaceNormal _basePos; private _v2 = [sin _angle, +cos _angle, 0] vectorCrossProduct _v3; diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index 7b41f19ae7..706ffeea72 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -118,6 +118,13 @@ MenuType: 0 = Interaction, 1 = Self Interaction |`ace_attach_attached` | [_attachedObject, _itemClassname, _temporary] | Local | Listen | After an item was attached to a unit/vehicle. _temporary flag means a item is being re-attached after the player exits a vehicle |`ace_attach_detaching` | [_attachedObject, _itemName, _temporary] | Local | Listen | Just before an item gets detached/removed from a unit/vehicle. _temporary flag means its detached because the player unit entered a vehicle. +### 2.12 Trenches (`ace_trenches`) + +| Event Key | Parameters | Locality | Type | Description | +|---------- |------------|----------|------|-------------| +| `ace_trenches_placed` | [_unit, _trench] | Global | Listen | After trench object is placed by unit. +| `ace_trenches_finished` | [_unit, _trench] | Global | Listen | After trench object is fully dug up by unit (100% progress). + ## 3. Usage Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation.