mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
58 lines
1.5 KiB
Plaintext
58 lines
1.5 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: SilentSpike
|
|
* Adds or removes spectator camera modes from the selection available to the local player.
|
|
* Possible camera modes are:
|
|
* - 0: Free
|
|
* - 1: First person
|
|
* - 2: Follow
|
|
*
|
|
* Default selection is [0,1,2]
|
|
*
|
|
* Arguments:
|
|
* 0: Camera modes to add <ARRAY>
|
|
* 1: Camera modes to remove <ARRAY>
|
|
*
|
|
* Return Value:
|
|
* Available camera modes <ARRAY>
|
|
*
|
|
* Example:
|
|
* [[0], [1,2]] call ace_spectator_fnc_updateCameraModes
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
if !(EGVAR(common,settingsInitFinished)) exitWith {
|
|
EGVAR(common,runAtSettingsInitialized) pushBack [DFUNC(updateCameraModes),_this];
|
|
};
|
|
|
|
params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]];
|
|
|
|
private _currentModes = GVAR(availableModes);
|
|
|
|
// Restrict additions to only possible values
|
|
private _newModes = _addModes arrayIntersect ALL_MODES;
|
|
_newModes append (_currentModes - _removeModes);
|
|
|
|
_newModes = _newModes arrayIntersect _newModes;
|
|
_newModes sort true;
|
|
|
|
// Can't become an empty array
|
|
if (_newModes isEqualTo []) then {
|
|
WARNING("Cannot remove all spectator camera modes");
|
|
} else {
|
|
GVAR(availableModes) = _newModes;
|
|
};
|
|
|
|
// Update camera in case of change
|
|
if !(isNil QGVAR(camera)) then {
|
|
// If mode was free and no longer available, find a focus
|
|
if (!(MODE_FREE in _newModes) && {GVAR(camMode) == MODE_FREE} && {isNull GVAR(camFocus)}) then {
|
|
[true] call FUNC(setFocus);
|
|
};
|
|
|
|
[GVAR(camMode)] call FUNC(cam_setCameraMode);
|
|
};
|
|
|
|
_newModes
|