2015-02-03 05:37:38 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: esteldunedain
|
2015-02-03 05:37:38 +00:00
|
|
|
* Adds a new setting at runtime, with all it's metadata.
|
|
|
|
* If has only local effects.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-05-14 22:12:40 +00:00
|
|
|
* 0: name <STRING>
|
|
|
|
* 1: typeName <STRING>
|
|
|
|
* 2: isClientSetable <BOOL>
|
|
|
|
* 3: localizedName <STRING>
|
|
|
|
* 4: localizedDescription <STRING>
|
|
|
|
* 5: possibleValues <ARRAY>
|
|
|
|
* 6: isForced <BOOL>
|
2015-09-18 07:38:19 +00:00
|
|
|
* 7: defaultValue <ANY>
|
2015-02-03 05:37:38 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-18 07:38:19 +00:00
|
|
|
params ["_name", "", "", "", "", "", "", "_value"]; //["_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_isForced", "_value"];
|
2015-05-14 22:12:40 +00:00
|
|
|
|
2015-12-14 12:08:19 +00:00
|
|
|
private _settingData = [_name] call FUNC(getSettingData);
|
2015-02-03 05:37:38 +00:00
|
|
|
|
|
|
|
// Exit if the setting already exists
|
|
|
|
if (count _settingData > 0) exitWith {};
|
|
|
|
|
|
|
|
// Update the variable
|
|
|
|
TRACE_2("Setting added",_name,_value);
|
|
|
|
|
|
|
|
// Init the variable
|
|
|
|
missionNamespace setVariable [_name, _value];
|
|
|
|
|
|
|
|
// Add the setting data
|
|
|
|
GVAR(settings) pushBack _this;
|
|
|
|
|
|
|
|
// Raise event locally
|
|
|
|
["SettingChanged", [_name, _value]] call FUNC(localEvent);
|