ACE3/addons/common/functions/fnc_loadSettingsFromProfile.sqf

39 lines
1.1 KiB
Plaintext
Raw Normal View History

/*
2015-03-24 04:18:00 +00:00
* Author: esteldunedain
* Load the user setable settings from the user profile.
* Config < Server UserConfig < Mission Config < Client settings
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
// Iterate through settings
{
2015-09-18 16:28:19 +00:00
_x params ["_name", "", "_isClientSetable", "", "", "", "_isForced"];
// If setting is user setable
if (_isClientSetable) then {
// If setting is not forced
if !(_isForced) then {
2015-09-18 16:28:19 +00:00
private "_profileValue";
_profileValue = profileNamespace getVariable _name;
// If the setting is stored on the profile
2015-02-03 19:49:40 +00:00
if !(isNil "_profileValue") then {
// If the profile variable has the correct type
2015-09-18 16:28:19 +00:00
if (typeName _profileValue == typeName (missionNamespace getVariable _name)) then {
// Load the setting from the profile
2015-09-18 16:28:19 +00:00
missionNamespace setVariable [_name, _profileValue];
};
};
};
};
2015-09-18 16:28:19 +00:00
false
} count GVAR(settings);