mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Updating ace settings
This commit is contained in:
parent
6de18416bc
commit
cfcb9fedb6
@ -1,26 +1,20 @@
|
||||
class ACE_Settings {
|
||||
class GVAR(enabled) {
|
||||
value = 0;
|
||||
class GVAR(enabledSystem) {
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
};
|
||||
class GVAR(limitSide) {
|
||||
class GVAR(filterUnits) {
|
||||
typeName = "SCALAR";
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
values[] = {"$STR_Special_None", CSTRING(units_players), CSTRING(units_all)};
|
||||
};
|
||||
class GVAR(allowAI) {
|
||||
class GVAR(filterSides) {
|
||||
typeName = "SCALAR";
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
};
|
||||
class GVAR(tracking) {
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
};
|
||||
class GVAR(modulePos) {
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
values[] = {"$STR_Special_None", CSTRING(sides_player), CSTRING(sides_friendly), CSTRING(sides_all)};
|
||||
};
|
||||
class GVAR(endMission) {
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
};
|
||||
};
|
||||
|
@ -1,53 +1,67 @@
|
||||
class CfgVehicles {
|
||||
class ACE_Module;
|
||||
class ACE_ModuleSpectator: ACE_Module {
|
||||
author = ECSTRING(common,ACETeam);
|
||||
category = "ACE";
|
||||
displayName = CSTRING(Module_DisplayName);
|
||||
function = QFUNC(moduleSpectator);
|
||||
class GVAR(moduleSettings): ACE_Module {
|
||||
scope = 2;
|
||||
isGlobal = 1;
|
||||
displayName = CSTRING(Settings_DisplayName);
|
||||
icon = PATHTOF(UI\Icon_Module_Spectator_ca.paa);
|
||||
category = "ACE";
|
||||
function = QFUNC(moduleSpectatorSettings);
|
||||
isGlobal = 1;
|
||||
author = ECSTRING(common,ACETeam);
|
||||
class Arguments {
|
||||
class SpectatorEnabled {
|
||||
displayName = CSTRING(Enabled_DisplayName);
|
||||
description = CSTRING(Enabled_Description);
|
||||
class spectatorSystem {
|
||||
displayName = CSTRING(system_DisplayName);
|
||||
description = CSTRING(system_Description);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};
|
||||
class SpectatorPlayerSide {
|
||||
displayName = CSTRING(PlayerSide_DisplayName);
|
||||
description = CSTRING(PlayerSide_Description);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
class spectatorUnits {
|
||||
displayName = CSTRING(units_DisplayName);
|
||||
description = CSTRING(units_Description);
|
||||
typeName = "NUMBER";
|
||||
class values {
|
||||
class none {
|
||||
name = "$STR_Special_None";
|
||||
value = 0;
|
||||
default = 1;
|
||||
};
|
||||
class players {
|
||||
name = CSTRING(units_players);
|
||||
value = 1;
|
||||
};
|
||||
class all {
|
||||
name = CSTRING(units_all);
|
||||
value = 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
class SpectatorAI {
|
||||
displayName = CSTRING(AI_DisplayName);
|
||||
description = CSTRING(AI_Description);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};
|
||||
class SpectatorTracking {
|
||||
displayName = CSTRING(Tracking_DisplayName);
|
||||
description = CSTRING(Tracking_Description);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};
|
||||
class SpectatorPos {
|
||||
displayName = CSTRING(Pos_DisplayName);
|
||||
description = CSTRING(Pos_Description);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};
|
||||
class SpectatorEnd {
|
||||
displayName = CSTRING(End_DisplayName);
|
||||
description = CSTRING(End_Description);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
class spectatorSides {
|
||||
displayName = CSTRING(sides_DisplayName);
|
||||
description = CSTRING(sides_Description);
|
||||
typeName = "NUMBER";
|
||||
class values {
|
||||
class none {
|
||||
name = "$STR_Special_None";
|
||||
value = 0;
|
||||
default = 1;
|
||||
};
|
||||
class player {
|
||||
name = CSTRING(sides_player);
|
||||
value = 1;
|
||||
};
|
||||
class friendly {
|
||||
name = CSTRING(sides_friendly);
|
||||
value = 2;
|
||||
};
|
||||
class all {
|
||||
name = CSTRING(sides_all);
|
||||
value = 3;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
class ModuleDescription {
|
||||
description = CSTRING(Module_Description);
|
||||
description = CSTRING(Settings_Description);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
class RscButtonMenu;
|
||||
class RscControlsGroupNoScrollbars;
|
||||
class RscFrame;
|
||||
class RscMapControl;
|
||||
class RscPicture;
|
||||
class RscStructuredText;
|
||||
@ -65,15 +66,16 @@ class GVAR(interface) {
|
||||
x = COMPASS_X + COMPASS_W * 2;
|
||||
text = "A3\ui_f_curator\data\cfgIngameUI\compass\texture90_ca.paa";
|
||||
};
|
||||
class compassCaret: compassBack {
|
||||
x = COMPASS_X + COMPASS_W * 0.5 - COMPASS_W / 360;
|
||||
w = COMPASS_W / 180;
|
||||
colorBackground[]={1,0,0,1};
|
||||
class compassCaret: RscFrame {
|
||||
x = COMPASS_X + COMPASS_W * 0.5;
|
||||
y = 0;
|
||||
w = 0;
|
||||
h = TOOL_H;
|
||||
colorText[] = {1,0,0,1};
|
||||
};
|
||||
class compassLeftBlock: compassCaret {
|
||||
class compassLeftBlock: compassBack {
|
||||
x = 0;
|
||||
w = (safeZoneW - COMPASS_W) * 0.5;
|
||||
colorBackground[] = {0.1,0.1,0.1,1};
|
||||
};
|
||||
class compassRightBlock: compassLeftBlock {
|
||||
x = COMPASS_X + COMPASS_W;
|
||||
@ -81,7 +83,7 @@ class GVAR(interface) {
|
||||
class compassFrame: compassBack {
|
||||
style = 64;
|
||||
shadow=2;
|
||||
colorText[]={1,1,1,1};
|
||||
colorText[] = {1,1,1,1};
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -175,7 +177,7 @@ class GVAR(interface) {
|
||||
h = TOOL_H;
|
||||
sizeEx = TOOL_H;
|
||||
text = CSTRING(RefreshList);
|
||||
action = QUOTE([allUnits] call FUNC(updateUnits));
|
||||
action = QUOTE([] call FUNC(updateUnits));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -6,26 +6,6 @@
|
||||
|
||||
// Run spectator framework if enabled
|
||||
["SettingsInitialized", {
|
||||
if !(GVAR(enabled)) exitWith {};
|
||||
|
||||
//check if respawn is set up properly
|
||||
_fail = if (getNumber (missionConfigFile >> "respawn") != 3 && getText (missionConfigFile >> "respawn") != "Base") then {true} else {false};
|
||||
if (_fail) exitWith {
|
||||
_errorMsg = "This mission does not have respawn set up properly. Add 'respawn=3' or 'respawn=""BASE""' to description.ext.";
|
||||
["[ACE_Spectator] ERROR", _errorMsg, {}] call EFUNC(common,errorMessage);
|
||||
diag_log text format ["[ACE_Spectator] ERROR: %1", _errorMsg];
|
||||
};
|
||||
|
||||
// Handle end mission setting
|
||||
if (GVAR(endMission) && isServer) then {
|
||||
[{
|
||||
if ({(isPlayer _x) && (alive _x) && !(_x getVariable [QGVAR(isSpectator), false])} count allUnits == 0) then {
|
||||
[["endDeath", false], "BIS_fnc_endMission"] call BIS_fnc_MP;
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
}, 2] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
if !(hasInterface) exitWith {};
|
||||
|
||||
/*if (GVAR(tracking)) then {
|
||||
@ -33,8 +13,9 @@
|
||||
[FUNC(trackUnits), 20] call CBA_fnc_addPerFrameHandler;
|
||||
};*/
|
||||
|
||||
// Add event handlers to correctly enter spectator upon death
|
||||
player addEventHandler ["Killed", FUNC(handleKilled)];
|
||||
player addEventHandler ["Respawn", FUNC(handleRespawn)];
|
||||
|
||||
if GVAR(system) then {
|
||||
// Add event handlers to correctly enter spectator upon death
|
||||
player addEventHandler ["Killed", FUNC(handleKilled)];
|
||||
player addEventHandler ["Respawn", FUNC(handleRespawn)];
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -8,7 +8,7 @@ PREP(handleKilled);
|
||||
PREP(handleMouse);
|
||||
PREP(handleRespawn);
|
||||
PREP(handleTree);
|
||||
PREP(moduleSpectator);
|
||||
PREP(moduleSpectatorSettings);
|
||||
PREP(setSpectator);
|
||||
PREP(updateUnits);
|
||||
PREP(updateView);
|
||||
|
@ -67,7 +67,7 @@ switch (toLower _mode) do {
|
||||
[FUNC(handleCamera), 0] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// Populate the unit list
|
||||
[allUnits] call FUNC(updateUnits);
|
||||
[] call FUNC(updateUnits);
|
||||
|
||||
// Create the dialog
|
||||
createDialog QGVAR(interface);
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Author: voiper
|
||||
* Read spectator settings from module
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <LOGIC>
|
||||
* 1: units <ARRAY>
|
||||
* 2: activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(enabled), "SpectatorEnabled"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(limitSide), "SpectatorPlayerSide"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(allowAI), "SpectatorAI"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(tracking), "SpectatorTracking"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(modulePos), "SpectatorPos"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(endMission), "SpectatorEnd"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
if (GVAR(modulePos)) then {
|
||||
GVAR(startingPos) = getPosATL _logic;
|
||||
GVAR(startingDir) = getDir _logic;
|
||||
};
|
27
addons/spectator/functions/fnc_moduleSpectatorSettings.sqf
Normal file
27
addons/spectator/functions/fnc_moduleSpectatorSettings.sqf
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Author: SilentSpike
|
||||
* Read spectator settings from module
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <LOGIC>
|
||||
* 1: units <ARRAY>
|
||||
* 2: activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic", "_units", "_activated"];
|
||||
_logic = _this select 0;
|
||||
_units = _this select 1;
|
||||
_activated = _this select 2;
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(enabledSystem), "spectatorSystem"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(filterUnits), "spectatorUnits"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(filterSides), "spectatorSides"] call EFUNC(common,readSettingFromModule);
|
@ -1,11 +1,10 @@
|
||||
/*
|
||||
* Author: SilentSpike
|
||||
* Updates the list of units available to spectate via addition/subtraction
|
||||
* Adds units to spectator whitelist/blacklist and refreshes the filter units
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Units to add to the list <ARRAY>
|
||||
* 1: Add or remove units <BOOL> <OPTIONAL>
|
||||
* 2: Permanent change (force add/remove) <BOOL> <OPTIONAL>
|
||||
* 1: Use blacklist <BOOL> <OPTIONAL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
@ -18,39 +17,34 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_newUnits",[]],["_append",true,[true]],["_permanent",false,[false]]];
|
||||
params [["_newUnits",[],[[]]],["_blacklist",false,[false]]];
|
||||
|
||||
if (_permanent) then {
|
||||
if (_append) then {
|
||||
GVAR(unitBlacklist) = GVAR(unitBlacklist) - _newUnits;
|
||||
GVAR(unitWhitelist) append _newUnits;
|
||||
} else {
|
||||
if !(_newUnits isEqualTo []) then {
|
||||
if (_blacklist) then {
|
||||
GVAR(unitWhitelist) = GVAR(unitWhitelist) - _newUnits;
|
||||
GVAR(unitBlacklist) append _newUnits;
|
||||
} else {
|
||||
GVAR(unitBlacklist) = GVAR(unitBlacklist) - _newUnits;
|
||||
GVAR(unitWhitelist) append _newUnits;
|
||||
};
|
||||
_newUnits = [];
|
||||
};
|
||||
|
||||
if (_append) then {
|
||||
// Append only valid units to the list
|
||||
{
|
||||
if (
|
||||
(alive _x) &&
|
||||
{(_x isKindOf "CAManBase")} &&
|
||||
{(side _x) in [west,east,resistance,civilian]} && // Side filter
|
||||
{(isPlayer _x) || GVAR(allowAI)} && // AI restriction
|
||||
{(simulationEnabled _x) && !isObjectHidden _unit} &&
|
||||
{!(_x getVariable [QGVAR(isSpectator), false])} // Who watches the watchmen?
|
||||
) then {
|
||||
GVAR(unitList) pushBack _x;
|
||||
};
|
||||
} forEach _newUnits;
|
||||
} else {
|
||||
GVAR(unitList) = GVAR(unitList) - _newUnits;
|
||||
};
|
||||
// Get filter units from setting
|
||||
_newUnits = [[],allPlayers,allUnits] select GVAR(filterUnits);
|
||||
|
||||
// Apply whitelist and blacklist
|
||||
// Append only valid units to the list
|
||||
{
|
||||
if (
|
||||
(alive _x) &&
|
||||
{(_x isKindOf "CAManBase")} &&
|
||||
{(side _x) in [west,east,resistance,civilian]} && // Side filter
|
||||
{(simulationEnabled _x)} &&
|
||||
{!(_x getVariable [QGVAR(isSpectator), false])} // Who watches the watchmen?
|
||||
) then {
|
||||
GVAR(unitList) pushBack _x;
|
||||
};
|
||||
} forEach (_newUnits - GVAR(unitBlacklist));
|
||||
|
||||
// Apply whitelist
|
||||
GVAR(unitList) append GVAR(unitWhitelist);
|
||||
GVAR(unitList) = GVAR(unitList) - GVAR(unitBlacklist);
|
||||
|
||||
GVAR(unitList) arrayIntersect GVAR(unitList);
|
||||
GVAR(unitList) = GVAR(unitList) arrayIntersect GVAR(unitList);
|
||||
|
@ -1,61 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project name="ACE">
|
||||
<Package name="Spectator">
|
||||
<Key ID="STR_ACE_Spectator_Module_DisplayName">
|
||||
<English>Spectator</English>
|
||||
<Polish>Obserwator</Polish>
|
||||
<Czech>Pozorovatel</Czech>
|
||||
<Key ID="STR_ACE_Spectator_Settings_DisplayName">
|
||||
<English>Spectator Setings</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_Enabled_DisplayName">
|
||||
<English>Enable Spectator</English>
|
||||
<Polish>Aktywuj obserwatora</Polish>
|
||||
<Czech>Povolit pozorovatele</Czech>
|
||||
<Key ID="STR_ACE_Spectator_Settings_Descripton">
|
||||
<English>Configure how the spectator system will operate by default.</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_Enabled_Description">
|
||||
<English>Begin spectating on player death?</English>
|
||||
<Polish>Włącz obserwatora po śmierci gracza?</Polish>
|
||||
<Czech>Přepnout do pozorovatele po hráčově smrti?</Czech>
|
||||
<Key ID="STR_ACE_Spectator_system_DisplayName">
|
||||
<English>Spectator System</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_PlayerSide_DisplayName">
|
||||
<English>Player Side Only</English>
|
||||
<Polish>Tylko strona gracza</Polish>
|
||||
<Czech>Pouze strana hráče</Czech>
|
||||
<Key ID="STR_ACE_Spectator_system_Description">
|
||||
<English>Enter spectator mode upon respawn.</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_PlayerSide_Description">
|
||||
<English>Only spectate units belonging to player's side?</English>
|
||||
<Polish>Pozwól obserwować jednostki będące tylko po stronie gracza?</Polish>
|
||||
<Czech>Pozorovat pouze jednotky patřící k hráčově straně?</Czech>
|
||||
<Key ID="STR_ACE_Spectator_units_DisplayName">
|
||||
<English>Spectatable Units</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_AI_DisplayName">
|
||||
<English>Spectate AI</English>
|
||||
<Polish>Obserwacja AI</Polish>
|
||||
<Czech>Pozorovat AI</Czech>
|
||||
<Key ID="STR_ACE_Spectator_units_Description">
|
||||
<English>Units automatically made available to spectate.</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_AI_Description">
|
||||
<English>Allow spectating of AI units?</English>
|
||||
<Polish>Pozwól obserwować jednostki AI?</Polish>
|
||||
<Czech>Umožnit pozorovat AI jednotky?</Czech>
|
||||
<Key ID="STR_ACE_Spectator_units_players">
|
||||
<English>Only players</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_Tracking_DisplayName">
|
||||
<English>Track Units</English>
|
||||
<Polish>Śledź jednostki</Polish>
|
||||
<Czech>Sledovat jednotky</Czech>
|
||||
<Key ID="STR_ACE_Spectator_units_all">
|
||||
<English>All units</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_Tracking_Description">
|
||||
<English>Track units' movements throughout mission?</English>
|
||||
<Polish>Śledź ruch jednostek w trakcie misji?</Polish>
|
||||
<Czech>Sledovat pohyby jednotek napříč misí?</Czech>
|
||||
<Key ID="STR_ACE_Spectator_sides_DisplayName">
|
||||
<English>Spectatable Sides</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_Pos_DisplayName">
|
||||
<English>Start Position</English>
|
||||
<Polish>Pozycja startowa</Polish>
|
||||
<Czech>Počáteční pozice</Czech>
|
||||
<Key ID="STR_ACE_Spectator_sides_Description">
|
||||
<English>Sides automatically made available to spectate.</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_Pos_Description">
|
||||
<English>Use this module as a starting position for spectator camera?</English>
|
||||
<Polish>Użyj pozycji modułu jako pozycje startową dla kamery obserwatora?</Polish>
|
||||
<Czech>Použít tento modul jako počáteční pozici pro pozorovací kameru?</Czech>
|
||||
<Key ID="STR_ACE_Spectator_sides_player">
|
||||
<English>Player side</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_sides_friendly">
|
||||
<English>Friendly sides</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Spectator_sides_all">
|
||||
<English>All sides</English>
|
||||
</Key>
|
||||
|
||||
<Key ID="STR_ACE_Spectator_End_DisplayName">
|
||||
<English>End Mission</English>
|
||||
<Polish>Zakończ misję</Polish>
|
||||
|
Loading…
Reference in New Issue
Block a user