HuntIR - Add Events & Animation Disable Flag (#10214)

This commit is contained in:
BrettMayson 2024-08-17 06:42:34 -06:00 committed by GitHub
parent e5178fe6fd
commit 1cd48c52c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 38 additions and 1 deletions

View File

@ -70,6 +70,7 @@ GVAR(no_cams) sort true;
//Close monitor if we no longer have the item:
if ((!([ACE_player, "ACE_HuntIR_monitor"] call EFUNC(common,hasItem))) && {!isNull (uiNameSpace getVariable [QGVAR(monitor), displayNull])}) then {
closeDialog 0;
[QGVAR(monitorClosed), [ACE_player]] call CBA_fnc_localEvent;
};
GVAR(nearHuntIRs) = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE];
@ -113,6 +114,7 @@ GVAR(no_cams) sort true;
if (player != ACE_player) then {
player remoteControl ACE_player;
};
[QGVAR(monitorClosed), [ACE_player]] call CBA_fnc_localEvent;
};
switch (GVAR(ZOOM)) do {

View File

@ -18,16 +18,19 @@
#define __TYPE_WRITER_DELAY 0.05
if ((ACE_player call CBA_fnc_getUnitAnim) select 0 == "stand") then {
if (missionNamespace getVariable [QGVAR(animatePlayer), true] && {(ACE_player call CBA_fnc_getUnitAnim) select 0 == "stand"}) then {
ACE_player playMove "AmovPercMstpSrasWrflDnon_diary";
};
HUNTIR_BACKGROUND_LAYER_ID cutText ["", "BLACK", 0];
createDialog QGVAR(cam_dialog_off);
[QGVAR(monitorOpened), [ACE_player]] call CBA_fnc_localEvent;
[{
if (!dialog) exitWith {
HUNTIR_BACKGROUND_LAYER_ID cutText ["", "PLAIN", 0];
[QGVAR(monitorClosed), [ACE_player]] call CBA_fnc_localEvent;
};
closeDialog 0;
createDialog QGVAR(cam_dialog_inactive);
@ -40,10 +43,12 @@ createDialog QGVAR(cam_dialog_off);
GVAR(message) = [];
GVAR(messageSearching) = toArray "Searching.....";
GVAR(messageConnecting) = toArray "Connecting.....";
[QGVAR(monitorStarted), [ACE_player]] call CBA_fnc_localEvent;
[{
//Close monitor if we no longer have item:
if ((!([ACE_player, "ACE_HuntIR_monitor"] call EFUNC(common,hasItem))) && {!isNull (uiNameSpace getVariable [QGVAR(monitor), displayNull])}) then {
closeDialog 0;
[QGVAR(monitorClosed), [ACE_player]] call CBA_fnc_localEvent;
};
private _elapsedTime = CBA_missionTime - GVAR(startTime);
@ -55,6 +60,7 @@ createDialog QGVAR(cam_dialog_off);
GVAR(done) = false;
GVAR(message) = [];
GVAR(connectionDelay) = 5;
[QGVAR(monitorDisconnected), [ACE_player]] call CBA_fnc_localEvent;
};
if ((!dialog) || GVAR(done)) exitWith {
@ -64,6 +70,7 @@ createDialog QGVAR(cam_dialog_off);
[_nearestHuntIRs select 0] call FUNC(cam);
} else {
HUNTIR_BACKGROUND_LAYER_ID cutText ["", "PLAIN"];
[QGVAR(monitorClosed), [ACE_player]] call CBA_fnc_localEvent;
};
};
switch (GVAR(state)) do {
@ -75,9 +82,11 @@ createDialog QGVAR(cam_dialog_off);
GVAR(message) = [];
if (_elapsedTime > 10) then {
GVAR(state) = "noGDS";
[QGVAR(monitorNoGDS), [ACE_player]] call CBA_fnc_localEvent;
};
if (_elapsedTime > 5 && {{_x getHitPointDamage "HitCamera" < 0.25} count _nearestHuntIRs > 0}) then {
GVAR(state) = "connecting";
[QGVAR(monitorConnecting), [ACE_player]] call CBA_fnc_localEvent;
};
};
};
@ -91,6 +100,7 @@ createDialog QGVAR(cam_dialog_off);
if (GVAR(connectionDelay) <= 0) then {
GVAR(done) = true;
GVAR(state) = "connected";
[QGVAR(monitorConnected), [ACE_player, _nearestHuntIRs select 0]] call CBA_fnc_localEvent;
};
};
};
@ -100,6 +110,7 @@ createDialog QGVAR(cam_dialog_off);
GVAR(done) = true;
closedialog 0;
HUNTIR_BACKGROUND_LAYER_ID cutText ["", "PLAIN"];
[QGVAR(monitorClosed), [ACE_player]] call CBA_fnc_localEvent;
}, [], 3, 0] call CBA_fnc_waitAndExecute;
};
};

View File

@ -167,6 +167,18 @@ MenuType: 0 = Interaction, 1 = Self Interaction
| `ace_headless_groupTransferPre` | [_group, _HC (OBJECT), _previousOwner, _idHC] | Target | Listen | Called just before a group is transferred from any machine to a HC. Called where group currently is local and on the HC, where group is going to be local.
| `ace_headless_groupTransferPost` | [_group, _HC (OBJECT), _previousOwner, _idHC, _transferredSuccessfully] | Target | Listen | Called just after a group is transferred from a machine to a HC. Called where group was local and on the HC, where group is now local. `_transferredSuccessfully` is passed so mods can actually check if the locality was properly transferred, as ownership transfer is not guaranteed.
### 2.18 HuntIR (`ace_huntir`)
| Event Key | Parameters | Locality | Type | Description |
|---------- |------------|----------|------|-------------|
| `ace_huntir_monitorOpened` | [_unit] | Local | Listen | Called when the monitor is opened
| `ace_huntir_monitorClosed` | [_unit] | Local | Listen | Called when the monitor is closed (may be fired multiple times when the monitor is closed by ACE and not the user)
| `ace_huntir_monitorStarted` | [_unit] | Local | Listen | Called when the monitor is started
| `ace_huntir_monitorSearching` | [_unit] | Local | Listen | Called when the monitor is searching
| `ace_huntir_monitorConnecting` | [_unit] | Local | Listen | Called when the monitor is connecting
| `ace_huntir_monitorConnected` | [_unit, _huntir] | Local | Listen | Called when the monitor is connected
| `ace_huntir_monitorNoGDS` | [_unit] | Local | Listen | Called when the monitor found no GDS
## 3. Usage
Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation.

View File

@ -30,3 +30,15 @@ class CfgWeapons {
};
};
```
## 2. Player Animation
Player animation when entering the HuntIR Monitor can be disabled by setting `ace_huntir_animatePlayer` to `false`.
```sqf
// Disable player animation locally
missionNamespace setVariable ["ace_huntir_animatePlayer", false];
// Disable player animation for everyone
missionNamespace setVariable ["ace_huntir_animatePlayer", false, true];
```