Interaction - Add door events (#9910)

Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
This commit is contained in:
Sotirios Pupakis 2024-04-03 22:47:51 +02:00 committed by GitHub
parent 020d21d562
commit 558849b91c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View File

@ -63,8 +63,11 @@ GVAR(doorTargetPhase) = _house animationPhase (_animations select 0);
GVAR(isOpeningDoor) = true;
GVAR(usedScrollWheel) = false;
// Raise local started opening event
[QGVAR(doorOpeningStarted), [_house, _door, _animations]] call CBA_fnc_localEvent;
[{
(_this select 0) params ["_house", "_animations", "_position", "_time", "_frame"];
(_this select 0) params ["_house", "_animations", "_position", "_time", "_frame", "_door"];
if !(GVAR(isOpeningDoor)) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
@ -75,6 +78,9 @@ GVAR(usedScrollWheel) = false;
{_house animate [_x, _phase]; false} count _animations;
};
// Raise local stopped opening event
[QGVAR(doorOpeningStopped), [_house, _door, _animations]] call CBA_fnc_localEvent;
};
// check if player moved too far away
@ -88,4 +94,4 @@ GVAR(usedScrollWheel) = false;
};
// do incremental door opening
{_house animate [_x, GVAR(doorTargetPhase)]; false} count _animations;
}, 0.1, [_house, _animations, getPosASL ACE_player, CBA_missionTime + 0.2, diag_frameno + 2]] call CBA_fnc_addPerFrameHandler;
}, 0.1, [_house, _animations, getPosASL ACE_player, CBA_missionTime + 0.2, diag_frameno + 2, _door]] call CBA_fnc_addPerFrameHandler;

View File

@ -146,6 +146,14 @@ MenuType: 0 = Interaction, 1 = Self Interaction
|---------- |------------|----------|------|-------------|
| `ace_medical_treatment_fullHealLocalMod` | [_patient] | Local | Listen | Called before a local unit is fully healed, mods can listen and apply their own healing logic
### 2.15 Interaction (`ace_interaction`)
| Event Key | Parameters | Locality | Type | Description |
|---------- |------------|----------|------|-------------|
|---------- |------------|----------|------|-------------|
| `ace_interaction_doorOpeningStarted` | [_house, _door, _animations] | Local | Listen | Called when local unit starts interacting with doors
| `ace_interaction_doorOpeningStopped` | [_house, _door, _animations] | Local | Listen | Called when local unit stopps interacting with doors
## 3. Usage
Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation.
@ -263,4 +271,4 @@ Calls a globally synchronized event, which will also be run on JIP players unles
// Event called on another machine (tapping above target machine)
["ace_interact_tapShoulder", [arguments], [target]] call CBA_fnc_targetEvent;
```
```