Trenches - Add "placed" and "finished" events (#8998)

* Add trench placed and finished global events

* Docs
This commit is contained in:
Filip Maciejewski 2022-08-20 22:43:50 +02:00 committed by GitHub
parent f3c66e83b4
commit a421a63eea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -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);
};

View File

@ -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;

View File

@ -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.