mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add Feature Camera Player EH and Handling (#6573)
* Switch to CBA Feature Camera handling * Register ACE3's Feature Cameras * Backwards compatiblity for old ace event * Require CBA 3.9
This commit is contained in:
parent
0633b807fa
commit
4ff01967b6
@ -31,7 +31,7 @@ GVAR(enabled) &&
|
||||
{_unit getVariable [QGVAR(lastThrownTime), CBA_missionTime - 3] < CBA_missionTime - 2} && // Prevent throwing in quick succession
|
||||
#endif
|
||||
|
||||
{!(call EFUNC(common,isFeatureCameraActive))} &&
|
||||
{(call CBA_fnc_getActiveFeatureCamera) isEqualTo ""} &&
|
||||
{[_unit, objNull, ["isNotInside", "isNotSwimming", "isNotSitting"/*, "isNotOnLadder"*/]] call EFUNC(common,canInteractWith)} && // Ladder needs positioning fixes on throw
|
||||
{_unit call CBA_fnc_canUseWeapon} && // Disable in non-FFV seats due to surface detection issues
|
||||
{"" == currentWeapon _unit || {currentWeapon _unit != secondaryWeapon _unit}} &&
|
||||
|
@ -266,21 +266,13 @@ TRACE_1("adding unit playerEH to set ace_player",isNull cba_events_oldUnit);
|
||||
GVAR(uniqueItemsCache) = nil;
|
||||
}] call CBA_fnc_addPlayerEventHandler;
|
||||
|
||||
// Backwards compatiblity for old ace event
|
||||
GVAR(OldIsCamera) = false;
|
||||
|
||||
[{
|
||||
BEGIN_COUNTER(stateChecker);
|
||||
|
||||
// "activeCameraChanged" event
|
||||
private _data = call FUNC(isfeatureCameraActive);
|
||||
if !(_data isEqualTo GVAR(OldIsCamera)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldIsCamera) = _data;
|
||||
["ace_activeCameraChanged", [ACE_player, _data]] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
END_COUNTER(stateChecker);
|
||||
}, 0.5, []] call CBA_fnc_addPerFrameHandler;
|
||||
["featureCamera", {
|
||||
params ["_player", "_cameraName"];
|
||||
GVAR(OldIsCamera) = _cameraName != "";
|
||||
["ace_activeCameraChanged", [_player, GVAR(OldIsCamera)]] call CBA_fnc_localEvent;
|
||||
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||
|
||||
// Add event handler for UAV control change
|
||||
ACE_controlledUAV = [objNull, objNull, [], ""];
|
||||
|
@ -24,6 +24,8 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
ACE_DEPRECATED(QFUNC(isFeatureCameraActive),"3.14.0","CBA_fnc_getActiveFeatureCamera");
|
||||
|
||||
!(
|
||||
isNull curatorCamera && // Curator
|
||||
{!GETMVAR(EGVAR(spectator,isSet),false)} && // ACE Spectator
|
||||
|
@ -80,7 +80,7 @@ if (!hasInterface) exitWith {};
|
||||
};
|
||||
|
||||
["cameraView", _fnc_checkGoggles] call CBA_fnc_addPlayerEventHandler;
|
||||
["ace_activeCameraChanged", _fnc_checkGoggles] call CBA_fnc_addEventHandler;
|
||||
["featureCamera", _fnc_checkGoggles] call CBA_fnc_addPlayerEventHandler;
|
||||
|
||||
|
||||
|
||||
|
@ -18,8 +18,9 @@
|
||||
// Handle the ThreeDen Editor Camera
|
||||
if (is3DEN) exitWith {true};
|
||||
|
||||
private _isFeatureCamera = call CBA_fnc_getFeatureCameraActive != "";
|
||||
if (GVAR(showInThirdPerson)) then {
|
||||
cameraView in ["GROUP"] || EFUNC(common,isFeatureCameraActive)
|
||||
cameraView in ["GROUP"] || _isFeatureCamera
|
||||
} else {
|
||||
cameraView in ["EXTERNAL", "GROUP"] || EFUNC(common,isFeatureCameraActive)
|
||||
cameraView in ["EXTERNAL", "GROUP"] || _isFeatureCamera
|
||||
};
|
||||
|
@ -11,3 +11,5 @@ GVAR(ELEVAT) = 0.01;
|
||||
// Register fire event handler
|
||||
// Don't run for non players, as they are too dumb to launch huntirs anyway
|
||||
["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler;
|
||||
|
||||
["ace_huntir", {!GETMVAR(GVAR(stop),true)}] call CBA_fnc_registerFeatureCamera;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
// MINIMAL required version for the Mod. Components can specify others..
|
||||
#define REQUIRED_VERSION 1.84
|
||||
#define REQUIRED_CBA_VERSION {3,8,0}
|
||||
#define REQUIRED_CBA_VERSION {3,9,0}
|
||||
|
||||
#ifdef COMPONENT_BEAUTIFIED
|
||||
#define COMPONENT_NAME QUOTE(ACE3 - COMPONENT_BEAUTIFIED)
|
||||
|
@ -13,11 +13,11 @@ GVAR(camera) = objNull;
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
// camera has to be re-created every time another camera is created. Otherwise r2t is either black or transparent. @todo Add popular custom cameras to the event in ACE_common.
|
||||
["ace_activeCameraChanged", {
|
||||
params ["", "_isfeatureCameraActive"];
|
||||
TRACE_1("ace_activeCameraChanged",_isfeatureCameraActive);
|
||||
if (!_isfeatureCameraActive) then {
|
||||
// camera has to be re-created every time another camera is created. Otherwise r2t is either black or transparent..
|
||||
["featureCamera", {
|
||||
params ["_player", "_featureCamera"];
|
||||
TRACE_1("featureCamera",_featureCamera);
|
||||
if (_featureCamera isEqualTo "") then {
|
||||
// Destroy the camera, and it will be re-created in the onDrawScope2d helper
|
||||
if (!isNull GVAR(camera)) then {
|
||||
GVAR(camera) cameraEffect ["TERMINATE", "BACK"];
|
||||
@ -25,7 +25,7 @@ GVAR(camera) = objNull;
|
||||
TRACE_1("destroying pip camera for restart",GVAR(camera));
|
||||
};
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
}] call CBA_fnc_addPlayerEventHandler;
|
||||
|
||||
// Register fire event handler
|
||||
["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler;
|
||||
|
@ -34,3 +34,5 @@ if (hasInterface) then {
|
||||
}
|
||||
] call CBA_fnc_waitUntilAndExecute;
|
||||
};
|
||||
|
||||
["ace_spectator", {GETMVAR(GVAR(isSet),false)}] call CBA_fnc_registerFeatureCamera;
|
||||
|
Loading…
Reference in New Issue
Block a user