ACE3/addons/viewrestriction/functions/fnc_canChangeCamera.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

32 lines
994 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: Jonpas
* Checks if camera can be changed.
*
* Arguments:
* 0: New Camera View <STRING>
* 1: Vehicle <OBJECT>
* 2: Check gunner view <BOOL> (default: true)
*
* Return Value:
* Can Change Camera <BOOL>
*
* Example:
* ["INTERNAL", vehicle] call ace_viewrestriction_fnc_canChangeCamera
*
* Public: No
*/
params ["_newCameraView", "_cameraOn", ["_checkGunnerView", true]];
// Remote control hates switchCamera (control returns to player, camera is left on remotely controlled object/unit), make sure remote controlled units are not impacted
!(_newCameraView isEqualTo "GUNNER" && {_checkGunnerView}) &&
{_newCameraView isNotEqualTo "GROUP"} &&
{!isNull ACE_player} &&
{player == ACE_player} &&
{alive ACE_player} &&
{ACE_player == _cameraOn || vehicle ACE_player == _cameraOn} &&
{"" isEqualTo call CBA_fnc_getActiveFeatureCamera} &&
{!(_cameraOn isKindOf "UAV" || _cameraOn isKindOf "UAV_01_base_F")} // UAVs are remote controlled