mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Safeguard against removal of all modes
This commit is contained in:
parent
53dc519336
commit
9f0415b9fa
@ -27,9 +27,9 @@
|
|||||||
|
|
||||||
params [["_newMode",GVAR(camMode)], ["_newUnit",GVAR(camUnit)], ["_newVision",GVAR(camVision)]];
|
params [["_newMode",GVAR(camMode)], ["_newUnit",GVAR(camUnit)], ["_newVision",GVAR(camVision)]];
|
||||||
|
|
||||||
// If new mode isn't available then keep current
|
// If new mode isn't available then keep current (unless current also isn't)
|
||||||
if !(_newMode in GVAR(availableModes)) then {
|
if !(_newMode in GVAR(availableModes)) then {
|
||||||
_newMode = GVAR(camMode);
|
_newMode = GVAR(availableModes) select ((GVAR(availableModes) find GVAR(camMode)) max 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
// When no units available to spectate, exit to freecam
|
// When no units available to spectate, exit to freecam
|
||||||
@ -55,6 +55,11 @@ if (_newMode == 0) then { // Free
|
|||||||
showCinemaBorder false;
|
showCinemaBorder false;
|
||||||
cameraEffectEnableHUD false;
|
cameraEffectEnableHUD false;
|
||||||
|
|
||||||
|
// If new vision isn't available then keep current (unless current also isn't)
|
||||||
|
if !(_newVision in GVAR(availableVisions)) then {
|
||||||
|
_newVision = GVAR(availableVisions) select ((GVAR(availableVisions) find GVAR(camVision)) max 0);
|
||||||
|
};
|
||||||
|
|
||||||
// Vision mode only applies to free cam
|
// Vision mode only applies to free cam
|
||||||
if (_newVision < 0) then {
|
if (_newVision < 0) then {
|
||||||
false setCamUseTi 0;
|
false setCamUseTi 0;
|
||||||
|
@ -22,16 +22,27 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]];
|
params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]];
|
||||||
|
private ["_newModes","_currentModes"];
|
||||||
|
|
||||||
|
_currentModes = GVAR(availableModes);
|
||||||
|
|
||||||
// Restrict additions to only possible values
|
// Restrict additions to only possible values
|
||||||
_addModes = _addModes arrayIntersect [0,1,2];
|
_newModes = _addModes arrayIntersect [0,1,2];
|
||||||
_addModes sort true;
|
_newModes append (_currentModes - _removeModes);
|
||||||
|
|
||||||
// Remove and add new modes
|
_newModes arrayIntersect _newModes;
|
||||||
GVAR(availableModes) = GVAR(availableModes) - _removeModes;
|
_newModes sort true;
|
||||||
|
|
||||||
GVAR(availableModes) append _addModes;
|
// Can't become an empty array
|
||||||
GVAR(availableModes) arrayIntersect GVAR(availableModes);
|
if (_newModes isEqualTo []) then {
|
||||||
GVAR(availableModes) sort true;
|
[["[ACE Spectator]","Cannot remove all camera modes"],true,10] call EFUNC(common,displayStructuredText);
|
||||||
|
} else {
|
||||||
|
GVAR(availableModes) = _newModes;
|
||||||
|
};
|
||||||
|
|
||||||
GVAR(availableModes)
|
// Update camera in case of change
|
||||||
|
if !(isNil QGVAR(camera)) then {
|
||||||
|
[] call FUNC(transitionCamera);
|
||||||
|
};
|
||||||
|
|
||||||
|
_newModes
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
* - 1: Black hot
|
* - 1: Black hot
|
||||||
* - 2: Light Green Hot / Darker Green cold
|
* - 2: Light Green Hot / Darker Green cold
|
||||||
* - 3: Black Hot / Darker Green cold
|
* - 3: Black Hot / Darker Green cold
|
||||||
* - 4: Light Red Hot /Darker Red Cold
|
* - 4: Light Red Hot / Darker Red Cold
|
||||||
* - 5: Black Hot / Darker Red Cold
|
* - 5: Black Hot / Darker Red Cold
|
||||||
* - 6: White Hot . Darker Red Col
|
* - 6: White Hot / Darker Red Cold
|
||||||
* - 7: Thermal (Shade of Red and Green, Bodies are white)
|
* - 7: Thermal (Shade of Red and Green, Bodies are white)
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -30,15 +30,27 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]];
|
params [["_addModes",[],[[]]], ["_removeModes",[],[[]]]];
|
||||||
|
private ["_newModes","_currentModes"];
|
||||||
|
|
||||||
|
_currentModes = GVAR(availableVisions);
|
||||||
|
|
||||||
// Restrict additions to only possible values
|
// Restrict additions to only possible values
|
||||||
_addModes = _addModes arrayIntersect [-2,-1,0,1,2,3,4,5,6,7];
|
_newModes = _addModes arrayIntersect [-2,-1,0,1,2,3,4,5,6,7];
|
||||||
|
_newModes append (_currentModes - _removeModes);
|
||||||
|
|
||||||
// Remove and add new modes
|
_newModes arrayIntersect _newModes;
|
||||||
GVAR(availableVisions) = GVAR(availableVisions) - _removeModes;
|
_newModes sort true;
|
||||||
|
|
||||||
GVAR(availableVisions) append _addModes;
|
// Can't become an empty array
|
||||||
GVAR(availableVisions) arrayIntersect GVAR(availableVisions);
|
if (_newModes isEqualTo []) then {
|
||||||
GVAR(availableVisions) sort true;
|
[["[ACE Spectator]","Cannot remove all vision modes"],true,10] call EFUNC(common,displayStructuredText);
|
||||||
|
} else {
|
||||||
|
GVAR(availableVisions) = _newModes;
|
||||||
|
};
|
||||||
|
|
||||||
GVAR(availableVisions)
|
// Update camera in case of change
|
||||||
|
if !(isNil QGVAR(camera)) then {
|
||||||
|
[] call FUNC(transitionCamera);
|
||||||
|
};
|
||||||
|
|
||||||
|
_newModes
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Project name="ACE">
|
<Project name="ACE">
|
||||||
<Package name="Spectator">
|
<Package name="Spectator">
|
||||||
<Key ID="STR_ACE_Spectator_Settings_DisplayName">
|
<Key ID="STR_ACE_Spectator_Settings_DisplayName">
|
||||||
<English>Spectator Setings</English>
|
<English>Spectator Settings</English>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Spectator_Settings_Descripton">
|
<Key ID="STR_ACE_Spectator_Settings_Descripton">
|
||||||
<English>Configure how the spectator system will operate by default.</English>
|
<English>Configure how the spectator system will operate by default.</English>
|
||||||
|
Loading…
Reference in New Issue
Block a user