mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
85c5fbabe9
* Fix incorrect function input for spectator hiding * Remove locations tab from spectator - Doesn't add much value, adds complexity and the implementation is half baked. Would rather add back in at a later date (if at all) with a better implementation. - I have an idea to replace the locations tab with a meta tab so users can toggle things like projectile drawing via the UI and are not forced to use a hotkey. Might also be a good place to display the extended controls.
60 lines
1.5 KiB
Plaintext
60 lines
1.5 KiB
Plaintext
/*
|
|
* 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
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
if !(EGVAR(common,settingsInitFinished)) exitWith {
|
|
EGVAR(common,runAtSettingsInitialized) pushBack [DFUNC(updateCameraModes),_this];
|
|
};
|
|
|
|
params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]];
|
|
private ["_newModes","_currentModes"];
|
|
|
|
_currentModes = GVAR(availableModes);
|
|
|
|
// Restrict additions to only possible values
|
|
_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(camTarget)}) then {
|
|
[true] call FUNC(setFocus);
|
|
};
|
|
|
|
[GVAR(camMode)] call FUNC(cam_setCameraMode);
|
|
};
|
|
|
|
_newModes
|