From 07e09b60faa7b4b09663d53cb7baa414259bdbb8 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Wed, 5 Aug 2015 13:19:47 +0100 Subject: [PATCH] Stop spectator camera unit changing on corpses Previously the camera would be automatically moved away from corpses (when the unit currently being watched dies). This changes it to stay on them until the view is manually switched as users might want to stick around and watch whatever was going on at the time of death. --- addons/spectator/functions/fnc_handleInterface.sqf | 1 + addons/spectator/functions/fnc_handleUnits.sqf | 6 ++++-- addons/spectator/functions/fnc_transitionCamera.sqf | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 777e8d2ea9..b85e73dabb 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -78,6 +78,7 @@ switch (toLower _mode) do { camDestroy GVAR(camera); // Return to player view + clearRadio; _unit switchCamera "internal"; // Re-enable BI damage effects diff --git a/addons/spectator/functions/fnc_handleUnits.sqf b/addons/spectator/functions/fnc_handleUnits.sqf index b64a1a2717..e8cd561da0 100644 --- a/addons/spectator/functions/fnc_handleUnits.sqf +++ b/addons/spectator/functions/fnc_handleUnits.sqf @@ -26,9 +26,11 @@ if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHand // Remove all dead and null units from the list [] call FUNC(updateUnits); -// Camera shouldn't stay on unit that isn't in the list +// Camera shouldn't stay on unit that isn't in the list (unless dead) if !(GVAR(camUnit) in GVAR(unitList)) then { - [nil,1] call FUNC(cycleCamera); + if (alive GVAR(camUnit) || isNull GVAR(camUnit)) then { + [nil,1] call FUNC(cycleCamera); + }; }; // Reduce overhead when unit tree is hidden diff --git a/addons/spectator/functions/fnc_transitionCamera.sqf b/addons/spectator/functions/fnc_transitionCamera.sqf index a4d99445fb..4957540fa4 100644 --- a/addons/spectator/functions/fnc_transitionCamera.sqf +++ b/addons/spectator/functions/fnc_transitionCamera.sqf @@ -33,7 +33,7 @@ if !(_newMode in GVAR(availableModes)) then { }; // When no units available to spectate, exit to freecam -if (GVAR(unitList) isEqualTo []) then { +if ((GVAR(unitList) isEqualTo []) && (alive _newUnit || isNull _newUnit)) then { _newMode = 0; _newUnit = objNull; };