2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-07-21 19:19:54 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
|
|
|
* Adds or removes spectator vision modes from the selection available to the local player.
|
2017-08-12 13:25:48 +00:00
|
|
|
*
|
2015-07-21 19:19:54 +00:00
|
|
|
* Possible vision modes are:
|
|
|
|
* - -2: Normal
|
|
|
|
* - -1: Night vision
|
|
|
|
* - 0: White hot
|
|
|
|
* - 1: Black hot
|
|
|
|
* - 2: Light Green Hot / Darker Green cold
|
|
|
|
* - 3: Black Hot / Darker Green cold
|
2015-07-21 20:51:32 +00:00
|
|
|
* - 4: Light Red Hot / Darker Red Cold
|
2015-07-21 19:19:54 +00:00
|
|
|
* - 5: Black Hot / Darker Red Cold
|
2015-07-21 20:51:32 +00:00
|
|
|
* - 6: White Hot / Darker Red Cold
|
2015-07-21 19:19:54 +00:00
|
|
|
* - 7: Thermal (Shade of Red and Green, Bodies are white)
|
|
|
|
*
|
2017-08-12 13:25:48 +00:00
|
|
|
* Default selection is [-2,-1,0,1]
|
|
|
|
*
|
2015-07-21 19:19:54 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Vision modes to add <ARRAY>
|
|
|
|
* 1: Vision modes to remove <ARRAY>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Available vision modes <ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [[0], [1,2]] call ace_spectator_fnc_updateVisionModes
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
2017-04-15 14:32:05 +00:00
|
|
|
if !(EGVAR(common,settingsInitFinished)) exitWith {
|
|
|
|
EGVAR(common,runAtSettingsInitialized) pushBack [DFUNC(updateVisionModes),_this];
|
|
|
|
};
|
|
|
|
|
2015-07-21 19:19:54 +00:00
|
|
|
params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]];
|
2015-07-21 20:51:32 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _currentModes = GVAR(availableVisions);
|
2015-07-21 19:19:54 +00:00
|
|
|
|
|
|
|
// Restrict additions to only possible values
|
2017-10-10 14:39:59 +00:00
|
|
|
private _newModes = _addModes arrayIntersect [-2,-1,0,1,2,3,4,5,6,7];
|
2015-07-21 20:51:32 +00:00
|
|
|
_newModes append (_currentModes - _removeModes);
|
|
|
|
|
2015-07-27 17:32:21 +00:00
|
|
|
_newModes = _newModes arrayIntersect _newModes;
|
2015-07-21 20:51:32 +00:00
|
|
|
_newModes sort true;
|
2015-07-21 19:19:54 +00:00
|
|
|
|
2015-07-21 20:51:32 +00:00
|
|
|
// Can't become an empty array
|
|
|
|
if (_newModes isEqualTo []) then {
|
2017-08-12 13:25:48 +00:00
|
|
|
WARNING("Cannot remove all spectator vision modes");
|
2015-07-21 20:51:32 +00:00
|
|
|
} else {
|
|
|
|
GVAR(availableVisions) = _newModes;
|
|
|
|
};
|
2015-07-21 19:19:54 +00:00
|
|
|
|
2015-07-21 20:51:32 +00:00
|
|
|
// Update camera in case of change
|
2017-08-12 13:25:48 +00:00
|
|
|
if !(isNil QGVAR(camera)) then {
|
|
|
|
[GVAR(camVision)] call FUNC(cam_setVisionMode);
|
2015-07-21 20:51:32 +00:00
|
|
|
};
|
2015-07-21 19:19:54 +00:00
|
|
|
|
2015-07-21 20:51:32 +00:00
|
|
|
_newModes
|