From 558849b91ce10430aabb8b4273d393759c6b1101 Mon Sep 17 00:00:00 2001 From: Sotirios Pupakis Date: Wed, 3 Apr 2024 22:47:51 +0200 Subject: [PATCH] Interaction - Add door events (#9910) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jouni Järvinen --- addons/interaction/functions/fnc_openDoor.sqf | 10 ++++++++-- docs/wiki/framework/events-framework.md | 10 +++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/addons/interaction/functions/fnc_openDoor.sqf b/addons/interaction/functions/fnc_openDoor.sqf index 540712ef41..2afb438a60 100644 --- a/addons/interaction/functions/fnc_openDoor.sqf +++ b/addons/interaction/functions/fnc_openDoor.sqf @@ -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; diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index d8d8674218..37daa148fc 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -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; -``` +``` \ No newline at end of file