mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixes
This commit is contained in:
parent
96b7c0d30c
commit
0600a72147
@ -165,9 +165,8 @@ PREP(hashListSelect);
|
||||
PREP(hashListSet);
|
||||
PREP(hashListPush);
|
||||
|
||||
|
||||
// Load settings
|
||||
if (isServer) {}
|
||||
if (isServer) then {
|
||||
call FUNC(loadSettingsOnServer);
|
||||
};
|
||||
|
||||
|
@ -20,11 +20,7 @@ _countOptions = count (configFile >> "ACE_Settings");
|
||||
for "_index" from 0 to (_countOptions - 1) do {
|
||||
_optionEntry = (configFile >> "ACE_Settings") select _index;
|
||||
|
||||
_name = configName _optionEntry;
|
||||
_valueEntry = _optionEntry >> "value";
|
||||
_typeEntry = _optionEntry >> "typeName";
|
||||
|
||||
[_name, _valueEntry, _typeEntry] call FUNC(setSettingFromConfig);
|
||||
[_optionEntry] call FUNC(setSettingFromConfig);
|
||||
};
|
||||
// Check if all settings should be forced
|
||||
if (GVAR(forceAllSettings)) then {
|
||||
@ -36,32 +32,29 @@ if (GVAR(forceAllSettings)) then {
|
||||
} forEach GVAR(settingsList);
|
||||
};
|
||||
|
||||
|
||||
// Load settings from server userconfig
|
||||
DFUNC(common,serverUserConfig) = compile preprocessFileLineNumbers "\userconfig\ACE\ACE_Settings.hpp";
|
||||
if !(isNil QFUNC(common,serverUserConfig)) then {
|
||||
[] call FUNC(serverUserConfig);
|
||||
// Load settings from server userconfig only if the ACE_ServerSettings is loaded
|
||||
if (isClass (configFile >> "CfgPatches" >> "ACE_ServerSettings")) then {
|
||||
DFUNC(serverUserConfig) = compile preprocessFileLineNumbers "\userconfig\ACE\ACE_Settings.hpp";
|
||||
if !(isNil DFUNC(serverUserConfig)) then {
|
||||
[] call FUNC(serverUserConfig);
|
||||
};
|
||||
// Check if all settings should be forced
|
||||
if (GVAR(forceAllSettings)) then {
|
||||
{
|
||||
if !(missionNamespace getVariable format ["%1_forced", _x]) then {
|
||||
missionNamespace setVariable format ["%1_forced", _x, true];
|
||||
publicVariable format ["%1_forced", _name];
|
||||
};
|
||||
} forEach GVAR(settingsList);
|
||||
};
|
||||
};
|
||||
// Check if all settings should be forced
|
||||
if (GVAR(forceAllSettings)) then {
|
||||
{
|
||||
if !(missionNamespace getVariable format ["%1_forced", _x]) then {
|
||||
missionNamespace setVariable format ["%1_forced", _x, true];
|
||||
publicVariable format ["%1_forced", _name];
|
||||
};
|
||||
} forEach GVAR(settingsList);
|
||||
};
|
||||
|
||||
|
||||
// Load settings from mission config
|
||||
_countOptions = count (missionConfigFile >> "ACE_Settings");
|
||||
for "_index" from 0 to (_countOptions - 1) do {
|
||||
_optionEntry = (missionConfigFile >> "ACE_Settings") select _index;
|
||||
|
||||
_name = configName _optionEntry;
|
||||
_valueEntry = _optionEntry >> "value";
|
||||
|
||||
[_name, _valueEntry] call FUNC(setSettingFromConfig);
|
||||
[_optionEntry] call FUNC(setSettingFromConfig);
|
||||
};
|
||||
// Check if all settings should be forced
|
||||
if (GVAR(forceAllSettings)) then {
|
||||
@ -71,4 +64,4 @@ if (GVAR(forceAllSettings)) then {
|
||||
publicVariable format ["%1_forced", _name];
|
||||
};
|
||||
} forEach GVAR(settingsList);
|
||||
};
|
||||
};
|
||||
|
@ -3,9 +3,8 @@
|
||||
* Load a setting from config if it was not previosuly forced. Force if neccesary.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Setting name (String)
|
||||
* 1: Config entry (config entry)
|
||||
*
|
||||
* 0: Config entry (config entry)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
@ -13,33 +12,35 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_2_PVT(_this,_name,_optionEntry);
|
||||
EXPLODE_1_PVT(_this,_optionEntry);
|
||||
|
||||
_fnc_getValueWithType = {
|
||||
EXPLODE_2_PVT(_this,_optionEntry,_typeName);
|
||||
|
||||
_value = getNumber (_optionEntry >> "value");
|
||||
diag_log text format ["%1 %2: %3", configName _optionEntry, _typeName, _value];
|
||||
if (_typeName == "BOOL") exitWith {
|
||||
_value = _value > 0;
|
||||
_value > 0
|
||||
};
|
||||
if (_typeName == "STRING") exitWith {
|
||||
_value = getText (_optionEntry >> "value");
|
||||
getText (_optionEntry >> "value")
|
||||
};
|
||||
if (_typeName == "ARRAY") exitWith {
|
||||
_value = getArray (_optionEntry >> "value");
|
||||
getArray (_optionEntry >> "value")
|
||||
};
|
||||
_value
|
||||
};
|
||||
|
||||
_name = configName _optionEntry;
|
||||
|
||||
// Check if the variable is already defined
|
||||
if (isNil _name) exitWith {
|
||||
if (isNil _name) then {
|
||||
// That setting was not loaded yet
|
||||
|
||||
//diag_log text format ["[ACE]: Mission setting '%1' doesn't exist", _name];
|
||||
|
||||
_typeEntry = _this select 2;
|
||||
_typeName = getText _typeEntry;
|
||||
// Get type from config
|
||||
_typeName = getText (_optionEntry >> "typeName");
|
||||
|
||||
// Read entry and cast it to the correct type
|
||||
_value = [_optionEntry, _typeName] call _fnc_getValueWithType;
|
||||
|
||||
// Init the variable and publish it
|
||||
@ -61,7 +62,9 @@ if (isNil _name) exitWith {
|
||||
// The setting is not forced, so update the value
|
||||
|
||||
// Get the type from the existing variable
|
||||
_typeName = typeName missionNamespace getVariable _name;
|
||||
_typeName = typeName (missionNamespace getVariable _name);
|
||||
|
||||
// Read entry and cast it to the correct type
|
||||
_value = [_optionEntry, _typeName] call _fnc_getValueWithType;
|
||||
|
||||
// Update the variable and publish it
|
||||
|
@ -25,7 +25,7 @@ GVAR(newStrength) = GVAR(newStrength) max _strength;
|
||||
if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {};
|
||||
|
||||
|
||||
if (QGVAR(DisableEarRinging)) exitWith {};
|
||||
if (GVAR(DisableEarRinging)) exitWith {};
|
||||
|
||||
if (_strength > 0.75) exitWith {
|
||||
playSound "ACE_EarRinging_Heavy";
|
||||
|
Loading…
Reference in New Issue
Block a user