ACE3/addons/common/functions/fnc_loadSettingsOnServer.sqf

57 lines
1.6 KiB
Plaintext
Raw Normal View History

2015-01-30 21:56:45 +00:00
/*
2015-03-24 04:18:00 +00:00
* Author: esteldunedain
2015-01-30 21:56:45 +00:00
* Load the parameters on the server.
* Config < Server UserConfig < Mission Config
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
GVAR(settings) = [];
2015-01-30 21:56:45 +00:00
private _fnc_parseConfigForSettings = {
2015-12-12 16:26:47 +00:00
params ["_config"];
private _countOptions = count _config;
2015-09-18 16:28:19 +00:00
2015-03-27 15:26:18 +00:00
for "_index" from 0 to (_countOptions - 1) do {
private _optionEntry = _config select _index;
2015-03-27 15:26:18 +00:00
[_optionEntry] call FUNC(setSettingFromConfig);
2015-02-03 00:13:31 +00:00
};
2015-09-18 16:28:19 +00:00
2015-02-03 00:13:31 +00:00
// Check if all settings should be forced
if (GVAR(forceAllSettings)) then {
{
2015-03-27 15:26:18 +00:00
_x set [6, true];
2015-09-18 16:28:19 +00:00
false
} count GVAR(settings);
2015-02-03 00:13:31 +00:00
};
2015-03-27 15:26:18 +00:00
};
2015-01-30 21:56:45 +00:00
// Order is this way because:
// ACE_Settings should never force any setting by default. Loading it first ensures that all settings from ACE_Settings exist.
// This way, ACE_ServerSettings will override ACE_Settings, even if no force is used.
// Mission settings will override the server config settings, if no force is used.
// This ensures that all settings are of their correct type, in case an outdated or corrupt server config is used , as well as have their correct localized display name and description
2015-01-30 21:56:45 +00:00
2015-03-27 15:26:18 +00:00
// Regular config
2015-09-18 16:28:19 +00:00
[configFile >> "ACE_Settings"] call _fnc_parseConfigForSettings;
2015-03-27 15:26:18 +00:00
// Server config
2015-09-18 16:28:19 +00:00
[configFile >> "ACE_ServerSettings"] call _fnc_parseConfigForSettings;
2015-03-27 15:26:18 +00:00
// mission side settings
2015-09-18 16:28:19 +00:00
[missionConfigFile >> "ACE_Settings"] call _fnc_parseConfigForSettings;
// Publish all setting values
{
publicVariable (_x select 0);
2015-09-18 16:28:19 +00:00
false
} count GVAR(settings);