diff --git a/addons/spectator/ACE_Settings.hpp b/addons/spectator/ACE_Settings.hpp index 539f7cef2d..5e7907d19f 100644 --- a/addons/spectator/ACE_Settings.hpp +++ b/addons/spectator/ACE_Settings.hpp @@ -1,4 +1,8 @@ class ACE_Settings { + class GVAR(onDeath) { + typeName = "BOOL"; + value = 0; + }; class GVAR(filterUnits) { typeName = "SCALAR"; value = 1; diff --git a/addons/spectator/CfgVehicles.hpp b/addons/spectator/CfgVehicles.hpp index 8e685dae07..7067257f23 100644 --- a/addons/spectator/CfgVehicles.hpp +++ b/addons/spectator/CfgVehicles.hpp @@ -9,6 +9,12 @@ class CfgVehicles { isGlobal = 1; author = ECSTRING(common,ACETeam); class Arguments { + class systemEnable { + displayName = CSTRING(system_DisplayName); + description = CSTRING(system_Description); + typeName = "BOOL"; + defaultValue = 0; + }; class unitsFilter { displayName = CSTRING(units_DisplayName); description = CSTRING(units_Description); diff --git a/addons/spectator/XEH_postInit.sqf b/addons/spectator/XEH_postInit.sqf index b0a8be6fdc..b0fe9d60b2 100644 --- a/addons/spectator/XEH_postInit.sqf +++ b/addons/spectator/XEH_postInit.sqf @@ -7,4 +7,11 @@ ["SettingsInitialized", { 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); + + if !(hasInterface) exitWith {}; + + if (GVAR(enableSystem)) then { + player addEventHandler ["Killed",FUNC(handleKilled)]; + player addEventHandler ["Respawn",FUNC(handleRespawn)]; + }; }] call EFUNC(common,addEventHandler); diff --git a/addons/spectator/functions/fnc_handleKilled.sqf b/addons/spectator/functions/fnc_handleKilled.sqf index adae56f8cd..67c556cc3f 100644 --- a/addons/spectator/functions/fnc_handleKilled.sqf +++ b/addons/spectator/functions/fnc_handleKilled.sqf @@ -1,6 +1,7 @@ /* * Author: SilentSpike * Cache necessary details and process unit for spectator on death + * Part of the basic spectator system * * Arguments: * 0: Corpse @@ -19,5 +20,8 @@ params ["_unit","_killer"]; // Remove from group to prevent appearing on HUD upon respawn [_unit, true, QGVAR(isSpectator), side group _unit] call EFUNC(common,switchToGroupSide); -GVAR(camUnit) = _killer; -GVAR(camMode) = 2; +if (isNull _killer) then { + [2,_unit] call FUNC(setCameraAttributes); +} else { + [2,_killer] call FUNC(setCameraAttributes); +}; diff --git a/addons/spectator/functions/fnc_handleRespawn.sqf b/addons/spectator/functions/fnc_handleRespawn.sqf index 6fc14b7fce..9b6b0bb802 100644 --- a/addons/spectator/functions/fnc_handleRespawn.sqf +++ b/addons/spectator/functions/fnc_handleRespawn.sqf @@ -1,6 +1,7 @@ /* * Author: SilentSpike * Start the interface on respawn + * Part of the basic spectator system * * Arguments: * 0: New unit diff --git a/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf b/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf index c23fb7ad20..1fd20f50e4 100644 --- a/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf +++ b/addons/spectator/functions/fnc_moduleSpectatorSettings.sqf @@ -19,6 +19,7 @@ params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; +[_logic, QGVAR(onDeath), "systemEnable"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(filterUnits), "unitsFilter"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(filterSides), "sidesFilter"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(restrictModes), "cameraModes"] call EFUNC(common,readSettingFromModule); diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index 74834f5606..fd3dd9861c 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -5,7 +5,6 @@ * Arguments: * 0: Unit to put into spectator state * 1: New spectator state - * 2: Spectator camera target * * Return Value: * None @@ -44,11 +43,6 @@ if (_set) then { [_unit, QGVAR(isSpectator)] call EFUNC(common,hideUnit); [_unit, QGVAR(isSpectator)] call EFUNC(common,muteUnit); - if !(isNull _target) then { - GVAR(camPos) = getPosASL _target; - GVAR(camUnit) = _target; - }; - ["open"] call FUNC(handleInterface); } else { ["close"] call FUNC(handleInterface); diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index 840e4338e1..8b91608981 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -7,6 +7,12 @@ Configure how the spectator system will operate by default. + + Spectate on death + + + Enables spectator upon death. + Unit filter