Spectate on death setting

This commit is contained in:
SilentSpike 2015-07-26 13:12:58 +01:00
parent ec6a0da01c
commit e431365586
8 changed files with 31 additions and 8 deletions

View File

@ -1,4 +1,8 @@
class ACE_Settings { class ACE_Settings {
class GVAR(onDeath) {
typeName = "BOOL";
value = 0;
};
class GVAR(filterUnits) { class GVAR(filterUnits) {
typeName = "SCALAR"; typeName = "SCALAR";
value = 1; value = 1;

View File

@ -9,6 +9,12 @@ class CfgVehicles {
isGlobal = 1; isGlobal = 1;
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
class Arguments { class Arguments {
class systemEnable {
displayName = CSTRING(system_DisplayName);
description = CSTRING(system_Description);
typeName = "BOOL";
defaultValue = 0;
};
class unitsFilter { class unitsFilter {
displayName = CSTRING(units_DisplayName); displayName = CSTRING(units_DisplayName);
description = CSTRING(units_Description); description = CSTRING(units_Description);

View File

@ -7,4 +7,11 @@
["SettingsInitialized", { ["SettingsInitialized", {
GVAR(availableModes) = [[0,1,2], [1,2], [0], [1], [2]] select GVAR(restrictModes); 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(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); }] call EFUNC(common,addEventHandler);

View File

@ -1,6 +1,7 @@
/* /*
* Author: SilentSpike * Author: SilentSpike
* Cache necessary details and process unit for spectator on death * Cache necessary details and process unit for spectator on death
* Part of the basic spectator system
* *
* Arguments: * Arguments:
* 0: Corpse <OBJECT> * 0: Corpse <OBJECT>
@ -19,5 +20,8 @@ params ["_unit","_killer"];
// Remove from group to prevent appearing on HUD upon respawn // Remove from group to prevent appearing on HUD upon respawn
[_unit, true, QGVAR(isSpectator), side group _unit] call EFUNC(common,switchToGroupSide); [_unit, true, QGVAR(isSpectator), side group _unit] call EFUNC(common,switchToGroupSide);
GVAR(camUnit) = _killer; if (isNull _killer) then {
GVAR(camMode) = 2; [2,_unit] call FUNC(setCameraAttributes);
} else {
[2,_killer] call FUNC(setCameraAttributes);
};

View File

@ -1,6 +1,7 @@
/* /*
* Author: SilentSpike * Author: SilentSpike
* Start the interface on respawn * Start the interface on respawn
* Part of the basic spectator system
* *
* Arguments: * Arguments:
* 0: New unit <OBJECT> * 0: New unit <OBJECT>

View File

@ -19,6 +19,7 @@ params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {}; if !(_activated) exitWith {};
[_logic, QGVAR(onDeath), "systemEnable"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(filterUnits), "unitsFilter"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(filterUnits), "unitsFilter"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(filterSides), "sidesFilter"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(filterSides), "sidesFilter"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(restrictModes), "cameraModes"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(restrictModes), "cameraModes"] call EFUNC(common,readSettingFromModule);

View File

@ -5,7 +5,6 @@
* Arguments: * Arguments:
* 0: Unit to put into spectator state <OBJECT> * 0: Unit to put into spectator state <OBJECT>
* 1: New spectator state <BOOL> <OPTIONAL> * 1: New spectator state <BOOL> <OPTIONAL>
* 2: Spectator camera target <OBJECT> <OPTIONAL>
* *
* Return Value: * Return Value:
* None <NIL> * None <NIL>
@ -44,11 +43,6 @@ if (_set) then {
[_unit, QGVAR(isSpectator)] call EFUNC(common,hideUnit); [_unit, QGVAR(isSpectator)] call EFUNC(common,hideUnit);
[_unit, QGVAR(isSpectator)] call EFUNC(common,muteUnit); [_unit, QGVAR(isSpectator)] call EFUNC(common,muteUnit);
if !(isNull _target) then {
GVAR(camPos) = getPosASL _target;
GVAR(camUnit) = _target;
};
["open"] call FUNC(handleInterface); ["open"] call FUNC(handleInterface);
} else { } else {
["close"] call FUNC(handleInterface); ["close"] call FUNC(handleInterface);

View File

@ -7,6 +7,12 @@
<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>
</Key> </Key>
<Key ID="STR_ACE_Spectator_system_DisplayName">
<English>Spectate on death</English>
</Key>
<Key ID="STR_ACE_Spectator_system_Description">
<English>Enables spectator upon death.</English>
</Key>
<Key ID="STR_ACE_Spectator_units_DisplayName"> <Key ID="STR_ACE_Spectator_units_DisplayName">
<English>Unit filter</English> <English>Unit filter</English>
</Key> </Key>