mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Improve handling of invalid modes
This commit is contained in:
parent
dcea8f4929
commit
dc19bff189
@ -6,16 +6,12 @@
|
||||
|
||||
// Run spectator framework if enabled
|
||||
["SettingsInitialized", {
|
||||
if !(hasInterface) exitWith {};
|
||||
|
||||
/*if (GVAR(tracking)) then {
|
||||
[FUNC(checkUnits), 2] call CBA_fnc_addPerFrameHandler;
|
||||
[FUNC(trackUnits), 20] call CBA_fnc_addPerFrameHandler;
|
||||
};*/
|
||||
GVAR(availableModes) = [[0,1,2], [1,2], [0], [1], [2]] select GVAR(restrictModes);
|
||||
GVAR(availableVisions) = [[-2,-1,0,1], [-2,-1], [-2,0,1], [-2]] select GVAR(restrictVisions);
|
||||
GVAR(camMode) = GVAR(availableModes) select 0;
|
||||
|
||||
if !(hasInterface) exitWith {};
|
||||
|
||||
if (GVAR(system)) then {
|
||||
// Add event handlers to correctly enter spectator upon death
|
||||
player addEventHandler ["Killed", FUNC(handleKilled)];
|
||||
|
@ -260,9 +260,7 @@ switch (toLower _mode) do {
|
||||
_newMode = [2,2,1] select GVAR(camMode);
|
||||
};
|
||||
|
||||
if (_newMode in GVAR(availableModes)) then {
|
||||
[_newMode,_newUnit] call FUNC(transitionCamera);
|
||||
};
|
||||
[_newMode,_newUnit] call FUNC(transitionCamera);
|
||||
};
|
||||
};
|
||||
case "onunitsupdate": {
|
||||
|
@ -27,6 +27,11 @@
|
||||
|
||||
params [["_newMode",GVAR(camMode)], ["_newUnit",GVAR(camUnit)], ["_newVision",GVAR(camVision)]];
|
||||
|
||||
// If new mode isn't available then keep current
|
||||
if !(_newMode in GVAR(availableModes)) then {
|
||||
_newMode = GVAR(camMode);
|
||||
};
|
||||
|
||||
// When no units available to spectate, exit to freecam
|
||||
if (GVAR(unitList) isEqualTo []) then {
|
||||
_newMode = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user