mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'checkpboSettings' of github.com:usecforce/ACE3
Conflicts: addons/common/CfgVehicles.hpp addons/common/config.cpp
This commit is contained in:
commit
7f2ada38a2
75
addons/common/ACE_Settings.hpp
Normal file
75
addons/common/ACE_Settings.hpp
Normal file
@ -0,0 +1,75 @@
|
||||
class ACE_Settings {
|
||||
/*
|
||||
* class GVAR(sampleSetting) {
|
||||
* value = 1; // Value
|
||||
* typeName = "SCALAR"; // Type (SCALAR, BOOL, STRING, ARRAY, COLOR)
|
||||
* force = 0; // Force the setting?
|
||||
* isClientSettable = 1; // Does it appear on the options menu?
|
||||
*
|
||||
* // The following settings only apply when isClientSettable == 1
|
||||
* displayName = "$STR_ACE_Common_SettingName"; // Stringtable entry with the setting name
|
||||
* description = "$STR_ACE_Common_SettingDescription"; // Stringtable entry with the setting description
|
||||
*
|
||||
* // Only applies if typeName == "SCALAR";
|
||||
* values[] = {"Disabled", "Enabled", "Only Cursor", "Only On Keypress", "Only Cursor and KeyPress"}; // Stringtable entries that describe the options
|
||||
* };
|
||||
*/
|
||||
class GVAR(forceAllSettings) {
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
};
|
||||
class GVAR(checkPBOsAction) {
|
||||
value = 0;
|
||||
typeName = "SCALAR";
|
||||
isClientSettable = 0;
|
||||
values[] = {"$STR_ACE_Common_CheckPBO_Action_WarnOnce", "$STR_ACE_Common_CheckPBO_Action_WarnPerm", "$STR_ACE_Common_CheckPBO_Action_Kick"};
|
||||
};
|
||||
class GVAR(checkPBOsCheckAll) {
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
isClientSettable = 0;
|
||||
};
|
||||
class GVAR(checkPBOsWhitelist) {
|
||||
value = "[]";
|
||||
typeName = "STRING";
|
||||
isClientSettable = 0;
|
||||
};
|
||||
/*class GVAR(enableNumberHotkeys) {
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
isClientSettable = 1;
|
||||
displayName = "$STR_ACE_Common_EnableNumberHotkeys";
|
||||
};*/
|
||||
class GVAR(settingFeedbackIcons) {
|
||||
value = 1;
|
||||
typeName = "SCALAR";
|
||||
force = 0;
|
||||
isClientSettable = 1;
|
||||
displayName = CSTRING(SettingFeedbackIconsName);
|
||||
description = CSTRING(SettingFeedbackIconsDesc);
|
||||
values[] = {ECSTRING(optionsmenu,Hide), ECSTRING(optionsmenu,TopRightDown), ECSTRING(optionsmenu,TopRightLeft), ECSTRING(optionsmenu,TopLeftDown), ECSTRING(optionsmenu,TopLeftRight)};
|
||||
};
|
||||
class GVAR(SettingProgressBarLocation) {
|
||||
value = 0;
|
||||
typeName = "SCALAR";
|
||||
force = 0;
|
||||
isClientSettable = 1;
|
||||
displayName = CSTRING(SettingProgressbarLocationName);
|
||||
description = CSTRING(SettingProgressbarLocationDesc);
|
||||
values[] = {ECSTRING(optionsmenu,Top), ECSTRING(optionsmenu,Bottom)};
|
||||
};
|
||||
class GVAR(displayTextColor) {
|
||||
value[] = {0,0,0,0.1};
|
||||
typeName = "COLOR";
|
||||
isClientSettable = 1;
|
||||
displayName = CSTRING(SettingDisplayTextColorName);
|
||||
description = CSTRING(SettingDisplayTextColorDesc);
|
||||
};
|
||||
class GVAR(displayTextFontColor) {
|
||||
value[] = {1,1,1,1};
|
||||
typeName = "COLOR";
|
||||
isClientSettable = 1;
|
||||
displayName = CSTRING(SettingDisplayTextFontColorName);
|
||||
description = CSTRING(SettingDisplayTextFontColorDesc);
|
||||
};
|
||||
};
|
@ -40,6 +40,7 @@ class CfgVehicles {
|
||||
class Action {
|
||||
displayName = CSTRING(CheckPBO_Action_DisplayName);
|
||||
description = CSTRING(CheckPBO_Action_Description);
|
||||
typeName = "NUMBER";
|
||||
class values {
|
||||
class WarnOnce {
|
||||
default = 1;
|
||||
|
@ -248,6 +248,14 @@ if(isMultiplayer && { ACE_time > 0 || isNull player } ) then {
|
||||
}, 0, []] call cba_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
["SettingsInitialized", {
|
||||
[
|
||||
GVAR(checkPBOsAction),
|
||||
GVAR(checkPBOsCheckAll),
|
||||
call compile GVAR(checkPBOsWhitelist)
|
||||
] call FUNC(checkPBOs)
|
||||
}] call FUNC(addEventHandler);
|
||||
|
||||
GVAR(commonPostInited) = true;
|
||||
|
||||
// Create a pfh to wait until all postinits are ready and settings are initialized
|
||||
|
@ -57,77 +57,7 @@ class ACE_Rsc_Control_Base {
|
||||
h = 0;
|
||||
};
|
||||
|
||||
class ACE_Settings {
|
||||
/*
|
||||
*class GVAR(sampleSetting) {
|
||||
* Value
|
||||
* value = 1;
|
||||
*
|
||||
* Type (SCALAR, BOOL, STRING, ARRAY, COLOR)
|
||||
* typeName = "SCALAR";
|
||||
*
|
||||
* Force the setting?
|
||||
* force = 0;
|
||||
*
|
||||
* Does it appear on the options menu?
|
||||
* isClientSettable = 1;
|
||||
*
|
||||
* The following settings only apply when isClientSettable == 1
|
||||
* Stringtable entry with the setting name
|
||||
* displayName = CSTRING(SettingName);
|
||||
*
|
||||
* Stringtable entry with the setting description
|
||||
* description = CSTRING(SettingDescription);
|
||||
*
|
||||
* Stringtable entries that describe the options
|
||||
* Only applies if typeName == "SCALAR";
|
||||
* values[] = {"Disabled", "Enabled", "Only Cursor", "Only On Keypress", "Only Cursor and KeyPress"};
|
||||
*};
|
||||
*/
|
||||
class GVAR(forceAllSettings) {
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
};
|
||||
/*class GVAR(enableNumberHotkeys) {
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
isClientSettable = 1;
|
||||
displayName = CSTRING(EnableNumberHotkeys);
|
||||
};*/
|
||||
class GVAR(settingFeedbackIcons) {
|
||||
value = 1;
|
||||
typeName = "SCALAR";
|
||||
force = 0;
|
||||
isClientSettable = 1;
|
||||
displayName = CSTRING(SettingFeedbackIconsName);
|
||||
description = CSTRING(SettingFeedbackIconsDesc);
|
||||
values[] = {ECSTRING(optionsmenu,Hide), ECSTRING(optionsmenu,TopRightDown), ECSTRING(optionsmenu,TopRightLeft), ECSTRING(optionsmenu,TopLeftDown), ECSTRING(optionsmenu,TopLeftRight)};
|
||||
};
|
||||
class GVAR(SettingProgressBarLocation) {
|
||||
value = 0;
|
||||
typeName = "SCALAR";
|
||||
force = 0;
|
||||
isClientSettable = 1;
|
||||
displayName = CSTRING(SettingProgressbarLocationName);
|
||||
description = CSTRING(SettingProgressbarLocationDesc);
|
||||
values[] = {ECSTRING(optionsmenu,Top), ECSTRING(optionsmenu,Bottom)};
|
||||
};
|
||||
class GVAR(displayTextColor) {
|
||||
value[] = {0,0,0,0.1};
|
||||
typeName = "COLOR";
|
||||
isClientSettable = 1;
|
||||
displayName = CSTRING(SettingDisplayTextColorName);
|
||||
description = CSTRING(SettingDisplayTextColorDesc);
|
||||
};
|
||||
class GVAR(displayTextFontColor) {
|
||||
value[] = {1,1,1,1};
|
||||
typeName = "COLOR";
|
||||
isClientSettable = 1;
|
||||
displayName = CSTRING(SettingDisplayTextFontColorName);
|
||||
description = CSTRING(SettingDisplayTextFontColorDesc);
|
||||
};
|
||||
};
|
||||
|
||||
#include "ACE_Settings.hpp"
|
||||
#include "define.hpp"
|
||||
#include <ProgressScreen.hpp>
|
||||
#include <HintConfig.hpp>
|
||||
|
@ -1,38 +1,95 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Used to execute the checkPBOs module without placing the module. Don't use this together with the module.
|
||||
* Checks PBO versions and compares to the one running on server.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Mode (Number)
|
||||
* Arguments:
|
||||
* 0: Mode <NUMBER>
|
||||
* 0: Warn once
|
||||
* 1: Warn permanently
|
||||
* 2: Kick
|
||||
* 1: Check all PBOs? (Boolean, optional default: "[]")
|
||||
* 2: Whitelist (String, optinal default: false)
|
||||
* 1: Check all PBOs? <BOOL> (Optional - default: "[]")
|
||||
* 2: Whitelist <STRING> (Optinal - default: false)
|
||||
*
|
||||
* Return value:
|
||||
* None.
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic"];
|
||||
private ["_mode", "_checkAll", "_whitelist"];
|
||||
|
||||
_this resize 3;
|
||||
_mode = _this select 0;
|
||||
_checkAll = if (count _this > 1) then {_this select 1} else {false};
|
||||
_whitelist = if (count _this > 2) then {_this select 2} else {"[]"};
|
||||
|
||||
PARAMS_3(_mode,_checkAll,_whitelist);
|
||||
_whitelist = [_whitelist, {toLower _this}] call FUNC(map);
|
||||
|
||||
if (isNil "_checkAll") then {
|
||||
_checkAll = false;
|
||||
ACE_Version_CheckAll = _checkAll;
|
||||
ACE_Version_Whitelist = _whitelist;
|
||||
|
||||
if (!isServer) then {
|
||||
[_mode, _checkAll, _whitelist] spawn {
|
||||
private ["_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer", "_text", "_error", "_rscLayer", "_ctrlHint"];
|
||||
PARAMS_3(_mode,_checkAll,_whitelist);
|
||||
|
||||
waitUntil {
|
||||
sleep 1;
|
||||
!isNil "ACE_Version_ClientErrors"
|
||||
};
|
||||
|
||||
_missingAddon = ACE_Version_ClientErrors select 0;
|
||||
_missingAddonServer = ACE_Version_ClientErrors select 1;
|
||||
_oldVersionClient = ACE_Version_ClientErrors select 2;
|
||||
_oldVersionServer = ACE_Version_ClientErrors select 3;
|
||||
|
||||
// Display error message.
|
||||
if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then {
|
||||
_text = "[ACE] Version mismatch:<br/><br/>";
|
||||
_error = format ["ACE version mismatch: %1: ", profileName];
|
||||
|
||||
if (_missingAddon) then {
|
||||
_text = _text + "Detected missing addon on client<br/>";
|
||||
_error = _error + "Missing file(s); ";
|
||||
};
|
||||
if (_missingAddonServer) then {
|
||||
_text = _text + "Detected missing addon on server<br/>";
|
||||
_error = _error + "Additional file(s); ";
|
||||
};
|
||||
if (_oldVersionClient) then {
|
||||
_text = _text + "Detected old client version<br/>";
|
||||
_error = _error + "Older version; ";
|
||||
};
|
||||
if (_oldVersionServer) then {
|
||||
_text = _text + "Detected old server version<br/>";
|
||||
_error = _error + "Newer version; ";
|
||||
};
|
||||
|
||||
//[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
|
||||
diag_log text _error;
|
||||
|
||||
_text = composeText [lineBreak, parseText format ["<t align='center'>%1</t>", _text]];
|
||||
|
||||
_rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer;
|
||||
_rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true];
|
||||
|
||||
disableSerialization;
|
||||
_ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint";
|
||||
_ctrlHint ctrlSetStructuredText _text;
|
||||
|
||||
if (_mode == 0) then {
|
||||
sleep 10;
|
||||
_rscLayer cutFadeOut 0.2;
|
||||
};
|
||||
|
||||
if (_mode == 2) then {
|
||||
sleep 10;
|
||||
waitUntil {alive player};
|
||||
[player] call FUNC(adminKick);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (isNil "_whitelist") then {
|
||||
_whitelist = "[]";
|
||||
if (_checkAll) then {
|
||||
0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber);
|
||||
};
|
||||
|
||||
_logic = "Logic" createVehicleLocal [0,0,0];
|
||||
_logic setVariable ["Action", _mode];
|
||||
_logic setVariable ["CheckAll", _checkAll];
|
||||
_logic setVariable ["Whitelist", _whitelist];
|
||||
[_logic, [], true] call FUNC(moduleCheckPBOs);
|
||||
deleteVehicle _logic;
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
*
|
||||
* Initializes the check-PBOs module.
|
||||
*
|
||||
* Arguments:
|
||||
@ -11,92 +10,14 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
if !(isServer) exitWith {};
|
||||
|
||||
private ["_mode", "_checkAll", "_whitelist"];
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
_mode = parseNumber (_logic getVariable "Action");
|
||||
_checkAll = _logic getVariable ["CheckAll", false];
|
||||
_whitelist = call compile (_logic getVariable ["Whitelist", "[]"]);
|
||||
[_logic, QGVAR(checkPBOsAction), "Action" ] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(checkPBOsCheckAll), "CheckAll" ] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(checkPBOsWhitelist), "Whitelist" ] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
if (isNil "_whitelist") then {
|
||||
_whitelist = [];
|
||||
};
|
||||
|
||||
_whitelist = [_whitelist, {toLower _this}] call FUNC(map);
|
||||
|
||||
ACE_Version_CheckAll = _checkAll;
|
||||
ACE_Version_Whitelist = _whitelist;
|
||||
|
||||
if (!isServer) then {
|
||||
[_mode, _checkAll, _whitelist] spawn {
|
||||
private ["_mode", "_checkAll", "_whitelist", "_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer", "_text", "_error", "_rscLayer", "_ctrlHint"];
|
||||
_mode = _this select 0;
|
||||
_checkAll = _this select 1;
|
||||
_whitelist = _this select 2;
|
||||
|
||||
waitUntil {
|
||||
sleep 1;
|
||||
!isNil "ACE_Version_ClientErrors"
|
||||
};
|
||||
|
||||
_missingAddon = ACE_Version_ClientErrors select 0;
|
||||
_missingAddonServer = ACE_Version_ClientErrors select 1;
|
||||
_oldVersionClient = ACE_Version_ClientErrors select 2;
|
||||
_oldVersionServer = ACE_Version_ClientErrors select 3;
|
||||
|
||||
// Display error message.
|
||||
if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then {
|
||||
_text = "[ACE] Version mismatch:<br/><br/>";
|
||||
_error = format ["ACE version mismatch: %1: ", profileName];
|
||||
|
||||
if (_missingAddon) then {
|
||||
_text = _text + "Detected missing addon on client<br/>";
|
||||
_error = _error + "Missing file(s); ";
|
||||
};
|
||||
if (_missingAddonServer) then {
|
||||
_text = _text + "Detected missing addon on server<br/>";
|
||||
_error = _error + "Additional file(s); ";
|
||||
};
|
||||
if (_oldVersionClient) then {
|
||||
_text = _text + "Detected old client version<br/>";
|
||||
_error = _error + "Older version; ";
|
||||
};
|
||||
if (_oldVersionServer) then {
|
||||
_text = _text + "Detected old server version<br/>";
|
||||
_error = _error + "Newer version; ";
|
||||
};
|
||||
|
||||
//[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
|
||||
diag_log text _error;
|
||||
|
||||
_text = composeText [lineBreak, parseText format ["<t align='center'>%1</t>", _text]];
|
||||
|
||||
_rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer;
|
||||
_rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true];
|
||||
|
||||
disableSerialization;
|
||||
_ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint";
|
||||
_ctrlHint ctrlSetStructuredText _text;
|
||||
|
||||
if (_mode == 0) then {
|
||||
sleep 10;
|
||||
_rscLayer cutFadeOut 0.2;
|
||||
};
|
||||
|
||||
if (_mode == 2) then {
|
||||
sleep 10;
|
||||
waitUntil {alive player};
|
||||
[player] call FUNC(adminKick);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
diag_log text format ["[ACE]: Check-PBOs Module Initialized. Mode: %1.", _mode];
|
||||
|
||||
if (_checkAll) then {
|
||||
0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber);
|
||||
};
|
||||
diag_log text format ["[ACE]: Check-PBOs Module Initialized. Mode: %1.", GVAR(checkPBOsAction)];
|
||||
|
Loading…
Reference in New Issue
Block a user