Merge pull request #127 from KoffeinFlummi/aceSettings

ACE_Settings system
This commit is contained in:
Nicolás Badano 2015-02-08 18:30:44 -03:00
commit e6bd4c631c
61 changed files with 769 additions and 518 deletions

View File

@ -2,7 +2,6 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
serverInit = QUOTE(call COMPILE_FILE(scripts\readParameters));
disableModuload = true;
};
};

View File

@ -1,6 +1,25 @@
// ACE - Common
#include "script_component.hpp"
// Load settings from profile
if (hasInterface) then {
call FUNC(loadSettingsFromProfile);
};
// Listens for global "SettingChanged" events, to update the force status locally
["SettingChanged", {
PARAMS_2(_name,_value);
if !(count _this > 2) exitWith {};
_force = _this select 2;
if (_force) then {
_settingData = [_name] call FUNC(getSettingData);
if (count _settingData == 0) exitWith {};
_settingData set [6,_force];
};
}] call FUNC(addEventhandler);
// hack to get PFH to work in briefing
[QGVAR(onBriefingPFH), "onEachFrame", {
if (time > 0) exitWith {

View File

@ -11,6 +11,7 @@ PREP(addCustomEventHandler);
PREP(addLineToDebugDraw);
PREP(addMapMarkerCreatedEventHandler);
PREP(addScrollWheelEventHandler);
PREP(addSetting);
PREP(adminKick);
PREP(ambientBrightness);
PREP(applyForceWalkStatus);
@ -56,6 +57,7 @@ PREP(getMarkerType);
PREP(getName);
PREP(getNumberFromMissionSQM);
PREP(getPitchBankYaw);
PREP(getSettingData);
PREP(getStringFromMissionSQM);
PREP(getTargetAzimuthAndInclination);
PREP(getTargetDistance);
@ -86,6 +88,8 @@ PREP(isInBuilding);
PREP(isPlayer);
PREP(isTurnedOut);
PREP(letterToCode);
PREP(loadSettingsFromProfile);
PREP(loadSettingsOnServer);
PREP(map);
PREP(moduleCheckPBOs);
PREP(moduleLSDVehicles);
@ -98,8 +102,7 @@ PREP(player);
PREP(playerSide);
PREP(progressBar);
PREP(queueAnimation);
PREP(readBooleanParameterFromModule);
PREP(readNumericParameterFromModule);
PREP(readSettingFromModule);
PREP(removeActionEventHandler);
PREP(removeActionMenuEventHandler);
PREP(removeCameraEventHandler);
@ -116,6 +119,8 @@ PREP(setName);
PREP(setParameter);
PREP(setPitchBankYaw);
PREP(setVariableJIP);
PREP(setSetting);
PREP(setSettingFromConfig);
PREP(stringToColoredText);
PREP(subString);
PREP(toBin);
@ -163,7 +168,10 @@ PREP(hashListSelect);
PREP(hashListSet);
PREP(hashListPush);
// Load settings
if (isServer) then {
call FUNC(loadSettingsOnServer);
};
ACE_player = player;
@ -184,7 +192,6 @@ if (hasInterface) then {
}, 0, []] call cba_fnc_addPerFrameHandler;
};
PREP(stringCompare);
PREP(string_removeWhiteSpace);
PREP(isHC);

View File

@ -57,10 +57,42 @@ class ACE_canInteractConditions {
};
};
class ACE_Options {
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?
* isClientSetable = 1;
*
* The following settings only apply when isClientSetable == 1
* Stringtable entry with the setting name
* displayName = "$STR_ACE_Common_SettingName";
*
* Stringtable entry with the setting description
* description = "$STR_ACE_Common_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";
isClientSetable = 1;
displayName = "$STR_ACE_Common_EnableNumberHotkeys";
default = 1;
};
};

View File

@ -0,0 +1,40 @@
/*
* Author: CAA-Picard
* Adds a new setting at runtime, with all it's metadata.
* If has only local effects.
*
* Arguments:
* 0: _name (String)
* 1: _typeName (String)
* 2: _isClientSetable (Bool)
* 3: _localizedName (String)
* 4: _localizedDescription (String)
* 5: _possibleValues (Array)
* 6: _isForced (Bool)
* 7: _defaultValue (Any)
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_8_PVT(_this,_name,_typeName,_isClientSetable,_localizedName,_localizedDescription,_possibleValues,_isForced,_value);
_settingData = [_name] call FUNC(getSettingData);
// 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);

View File

@ -0,0 +1,31 @@
/*
* Author: CAA-Picard
* Returns the metadata of a setting if it exists
*
* Arguments:
* 0: Name of the setting (String)
*
* Return Value:
* Setting Data (Array)
* 0: _name
* 1: _typeName
* 2: _isClientSetable
* 3: _localizedName
* 4: _localizedDescription
* 5: _possibleValues
* 6: _isForced
* 7: _defaultValue
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_1_PVT(_this,_name);
private ["_value"];
_value = [];
{
if ((_x select 0) == _name) exitWith {_value = _x};
} forEach GVAR(settings);
_value

View File

@ -0,0 +1,37 @@
/*
* Author: CAA-Picard
* 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
{
_name = _x select 0;
_isClientSetable = _x select 2;
_isForced = _x select 6;
// If setting is user setable
if (_isClientSetable) then {
// If setting is not forced
if !(_isForced) then {
_profileValue = profileNamespace getvariable _name;
// If the setting is stored on the profile
if !(isNil "_profileValue") then {
// If the profile variable has the correct type
if (typeName _profileValue == typeName (missionNamespace getvariable _name)) then {
// Load the setting from the profile
missionNamespace setvariable [_name, _profileValue];
};
};
};
};
} forEach GVAR(settings);

View File

@ -0,0 +1,69 @@
/*
* Author: CAA-Picard
* Load the parameters on the server.
* Config < Server UserConfig < Mission Config
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
GVAR(settings) = [];
// Load settings from main config
_countOptions = count (configFile >> "ACE_Settings");
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = (configFile >> "ACE_Settings") select _index;
[_optionEntry] call FUNC(setSettingFromConfig);
};
// Check if all settings should be forced
if (GVAR(forceAllSettings)) then {
{
_x set [6, true];
} forEach GVAR(settings);
};
// @todo
// 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);
};
};*/
// Load settings from mission config
_countOptions = count (missionConfigFile >> "ACE_Settings");
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = (missionConfigFile >> "ACE_Settings") select _index;
[_optionEntry] call FUNC(setSettingFromConfig);
};
// Check if all settings should be forced
if (GVAR(forceAllSettings)) then {
{
_x set [6, true];
} forEach GVAR(settings);
};
// Publish all settings data
publicVariable QGVAR(settings);
// Publish all setting values
{
publicVariable (_x select 0);
} forEach GVAR(settings);

View File

@ -1,28 +0,0 @@
/*
* Author: CAA-Picard
*
* Reads a boolean value from a module, sets de ACE_Parameter. Logs if parameters are missing in the module.
*
* Arguments:
* 0: Module (Object)
* 1: ACE_Parameter name (string)
* 2: Module parameter name (string)
*
* Return Value:
* None
*/
#include "script_component.hpp"
private ["_logic", "_parameterName", "_moduleParameterName"];
_logic = _this select 0;
_parameterName = _this select 1;
_moduleParameterName = _this select 2;
// Check if the parameter is defined in the module
if (isNil {_logic getVariable _moduleParameterName}) exitWith {
diag_log text format["[ACE]: Warning in %1 module: %2 parameter is missing. Probably an obsolete version of the module is used in the mission.", typeOf _logic, _moduleParameterName];
};
// Set the parameter
[_parameterName , if (_logic getVariable _moduleParameterName) then {1} else {0}] call FUNC(setParameter);

View File

@ -1,34 +0,0 @@
/*
* Author: CAA-Picard
*
* Reads a numeric value from a module, sets de ACE_Parameter. Logs if parameters are missing in the module.
*
* Arguments:
* 0: Module (Object)
* 1: ACE_Parameter name (string)
* 2: Module parameter name (string)
*
* Return Value:
* None
*/
#include "script_component.hpp"
private ["_logic", "_parameterName", "_moduleParameterName", "_value"];
_logic = _this select 0;
_parameterName = _this select 1;
_moduleParameterName = _this select 2;
// Check if the parameter is defined in the module
if (isNil {_logic getVariable _moduleParameterName}) exitWith {
diag_log text format["[ACE]: Warning in %1 module: %2 parameter is missing. Probably an obsolete version of the module is used in the mission.", typeOf _logic, _moduleParameterName]
};
// Check if the value is defined as string for backward compatibility
_value = _logic getVariable _moduleParameterName;
if (typeName _value == "STRING") then {
_value = parseNumber _value;
};
// Set the parameter
[_parameterName, _value] call FUNC(setParameter);

View File

@ -0,0 +1,27 @@
/*
* Author: CAA-Picard
*
* Reads a setting value from a module, set it and force it. Logs if the setting is missing from the module.
* Must be called on the server, effect is global.
*
* Arguments:
* 0: Module (Object)
* 1: ACE_Parameter name (string)
* 2: Module parameter name (string)
*
* Return Value:
* None
*/
#include "script_component.hpp"
if !(isServer) exitWith {};
EXPLODE_3_PVT(_this,_logic,_settingName,_moduleVariable);
// Check if the parameter is defined in the module
if (isNil {_logic getVariable _moduleVariable}) exitWith {
diag_log text format["[ACE]: Warning in %1 module: %2 setting is missing. Probably an obsolete version of the module is used in the mission.", typeOf _logic, _moduleVariable];
};
// Set the setting globally and force it
[_settingName, _logic getVariable _moduleVariable, true, true] call FUNC(setSetting);

View File

@ -0,0 +1,79 @@
/*
* Author: CAA-Picard
* Change the value of an existing setting if it was not previously forced. Force if neccesary.
* If executed on clients it has local effect.
* If executed on server it can have global effect if the last parameter is set to true.
*
* Arguments:
* 0: Setting name (String)
* 1: Value (Any)
* 2: Force it? (Bool) (Optional)
* 3: Broadcast the change to all clients (Bool) (Optional)
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_name","_value"];
_name = _this select 0;
_value = _this select 1;
private ["_force"];
_force = false;
if (count _this > 2) then {
_force = _this select 2;
};
_settingData = [_name] call FUNC(getSettingData);
// Exit if the setting does not exist
if (count _settingData == 0) exitWith {};
// Exit if the setting is already forced
if (_settingData select 6) exitWith {};
// If the type is not equal, try to cast it
_failed = false;
if ((typeName _value) != (_settingData select 1)) then {
_failed = true;
diag_log (typeName _value);
if ((_settingData select 1) == "BOOL" and (typeName _value) == "SCALAR") then {
// If value is not 0 or 1 consider it invalid and don't set anything
if (_value == 0) then {
_value = false;
_failed = false;
};
if (_value == 1) then {
_value = true;
_failed = false;
};
};
if ((_settingData select 1) == "COLOR" and (typeName _value) == "ARRAY") then {
_failed = false;
};
};
if (_failed) exitWith {};
// Force it if it was required
_settingData set [6, _force];
// Exit if the value didn't change
if (_value isEqualTo (missionNamespace getVariable _name)) exitWith {};
// Update the variable
TRACE_2("Variable Updated",_name,_value);
missionNamespace setVariable [_name, _value];
if (isServer && {count _this > 3} && {_this select 3}) then {
// Publicize the new value
publicVariable _name;
// Raise event globally, this publicizes eventual changes in _force status so clients can update it locally
["SettingChanged", [_name, _value, _force]] call FUNC(globalEvent);
} else {
// Raise event locally
["SettingChanged", [_name, _value, _force]] call FUNC(localEvent);
};

View File

@ -0,0 +1,102 @@
/*
* Author: CAA-Picard
* Load a setting from config if it was not previosuly forced. Force if neccesary.
*
* Arguments:
* 0: Config entry (config entry)
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
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 > 0
};
if (_typeName == "STRING") exitWith {
getText (_optionEntry >> "value")
};
if (_typeName == "ARRAY") exitWith {
getArray (_optionEntry >> "value")
};
if (_typeName == "COLOR") exitWith {
getArray (_optionEntry >> "value")
};
_value
};
_name = configName _optionEntry;
// Check if the variable is already defined
if (isNil _name) then {
// That setting was not loaded yet
// Get type from config
_typeName = getText (_optionEntry >> "typeName");
if (_typeName == "") then {
_typeName = "SCALAR";
};
// Read entry and cast it to the correct type
_value = [_optionEntry, _typeName] call _fnc_getValueWithType;
// Init the variable
missionNamespace setVariable [_name, _value];
// Add the setting to a list on the server
// Set the variable to not forced
/*_settingData = [
_name,
_typeName,
_isClientSetable,
_localizedName,
_localizedDescription,
_possibleValues,
_isForced,
_defaultValue
];*/
_settingData = [
_name,
_typeName,
(getNumber (_optionEntry >> "isClientSetable")) > 0,
getText (_optionEntry >> "displayName"),
getText (_optionEntry >> "description"),
getArray (_optionEntry >> "values"),
getNumber (_optionEntry >> "force") > 0,
_value
];
GVAR(settings) pushBack _settingData;
} else {
// The setting already exists.
// Check if it's already forced and quit
_settingData = [_name] call FUNC(getSettingData);
if (_settingData select 6) exitWith {};
// The setting is not forced, so update the value
// Get the type from the existing variable
_typeName = _settingData select 1;
// Read entry and cast it to the correct type
_value = [_optionEntry, _typeName] call _fnc_getValueWithType;
// Update the variable
missionNamespace setVariable [_name, _value];
// Force the setting if requested
if (getNumber (_optionEntry >> "force") > 0) then {
_settingData set [6, true];
};
};

View File

@ -1,55 +0,0 @@
// by CAA-Picard
#include "script_component.hpp"
// Read ACE_Parameters from config and set them on the mission namespace
_config = configFile >> "ACE_Parameters_Numeric";
_count = count _config;
for "_index" from 0 to (_count - 1) do {
_x = _config select _index;
_name = configName _x;
_value = _x call bis_fnc_getcfgdata;
[_name, _value] call FUNC(setParameter);
};
_config = configFile >> "ACE_Parameters_Boolean";
_count = count _config;
for "_index" from 0 to (_count - 1) do {
_x = _config select _index;
_name = configName _x;
_value = _x call bis_fnc_getcfgdata;
[_name, _value > 0] call FUNC(setParameter);
};
// Read ACE_Parameters from mission and set them on the mission namespace, replacing defaults if necesary
_config = missionConfigFile >> "ACE_Parameters";
_count = count _config;
for "_index" from 0 to (_count - 1) do {
_x = _config select _index;
_name = configName _x;
_value = _x call bis_fnc_getcfgdata;
[_name, _value] call FUNC(setParameter);
};
_config = missionConfigFile >> "ACE_Parameters_Numeric";
_count = count _config;
for "_index" from 0 to (_count - 1) do {
_x = _config select _index;
_name = configName _x;
_value = _x call bis_fnc_getcfgdata;
[_name, _value] call FUNC(setParameter);
};
_config = missionConfigFile >> "ACE_Parameters_Boolean";
_count = count _config;
for "_index" from 0 to (_count - 1) do {
_x = _config select _index;
_name = configName _x;
_value = _x call bis_fnc_getcfgdata;
[_name, _value > 0] call FUNC(setParameter);
};

View File

@ -39,7 +39,13 @@ class CfgMineTriggers {
};
};
class ACE_Parameters_Boolean {
GVAR(RequireSpecialist) = 0;
GVAR(PunishNonSpecialists) = 1;
class ACE_Settings {
class GVAR(RequireSpecialist) {
value = 0;
typeName = "BOOL";
};
class GVAR(PunishNonSpecialists) {
value = 1;
typeName = "BOOL";
};
};

View File

@ -20,7 +20,7 @@ _activated = _this select 2;
if !(_activated) exitWith {};
[_logic, QGVAR(RequireSpecialist), "RequireSpecialist" ] call EFUNC(Common,readBooleanParameterFromModule);
[_logic, QGVAR(PunishNonSpecialists), "PunishNonSpecialists" ] call EFUNC(Common,readBooleanParameterFromModule);
[_logic, QGVAR(RequireSpecialist), "RequireSpecialist" ] call EFUNC(Common,readSettingFromModule);
[_logic, QGVAR(PunishNonSpecialists), "PunishNonSpecialists" ] call EFUNC(Common,readSettingFromModule);
diag_log text "[ACE]: Explosive Module Initialized.";

View File

@ -3,13 +3,13 @@
#define COLOUR 8.0
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"Garth 'L-H' de Wet"};
authorUrl = "http://garth.snakebiteink.co.za/";
VERSION_CONFIG;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"Garth 'L-H' de Wet"};
authorUrl = "http://garth.snakebiteink.co.za/";
VERSION_CONFIG;
};
};
@ -243,10 +243,12 @@ class SniperCloud {
ACE_Goggles_BulletCount = 1;
};
class ACE_Options {
class ACE_Settings {
class GVAR(showInThirdPerson) {
displayName = $STR_ACE_Goggles_ShowInThirdPerson;
default = 0;
value = 0;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Goggles_ShowInThirdPerson";
};
};

View File

@ -15,5 +15,5 @@
*/
#include "script_component.hpp"
if ((missionNameSpace getVariable [QGVAR(showInThirdPerson), 0]) == 1) exitWith { false };
if (GVAR(showInThirdPerson)) exitWith { false };
(cameraView == "External")

View File

@ -22,9 +22,11 @@ class CfgPatches {
#include "CfgAmmo.hpp"
class ACE_Options {
class GVAR(Hearing_DisableEarRinging) {
displayName = "$STR_ACE_Hearing_DisableEarRinging";
default = 0;
};
class ACE_Settings {
class GVAR(DisableEarRinging) {
default = 1;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Hearing_DisableEarRinging";
};
};

View File

@ -25,7 +25,7 @@ GVAR(newStrength) = GVAR(newStrength) max _strength;
if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {};
if (profileNamespace getVariable [QGVAR(DisableEarRinging), false]) exitWith {};
if (GVAR(DisableEarRinging)) exitWith {};
if (_strength > 0.75) exitWith {
playSound "ACE_EarRinging_Heavy";

View File

@ -41,7 +41,7 @@ GVAR(isOpeningDoor) = false;
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false};
if !(!isNull (findDisplay 1713999) && {QGVAR(AutoCloseMenu)}) exitWith {false};
// Statement
if (GVAR(MenuType) mod 2 == 0) then {call FUNC(onButtonUp)};
@ -77,7 +77,7 @@ GVAR(isOpeningDoor) = false;
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false};
if !(!isNull (findDisplay 1713999) && {QGVAR(AutoCloseMenu)}) exitWith {false};
// Statement
if (GVAR(MenuType) mod 2 == 1) then {call FUNC(onButtonUp)};

View File

@ -18,23 +18,29 @@ class CfgPatches {
#include <Menu_Config.hpp>
class ACE_Options {
class Interaction_FlowMenu {
class ACE_Settings {
class GVAR(FlowMenu) {
value = 0;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Interaction_FlowMenu";
default = 0;
};
class Interaction_AutoCloseMenu {
class GVAR(AutoCloseMenu) {
value = 0;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Interaction_AutoCloseMenu";
default = 0;
};
class Interaction_AutoCenterCursor {
class GVAR(AutoCenterCursor) {
value = 1;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Interaction_AutoCenterCursor";
default = 1;
};
};
class ACE_Parameters_Boolean {
ACE_Interaction_EnableTeamManagement = 1;
class GVAR(EnableTeamManagement) {
value = 1;
typeName = "BOOL";
};
};
class ACE_canInteractConditions {

View File

@ -66,7 +66,7 @@ _cacheIndices = _cache select 2;
_statement = getText (_action >> "statement");
_statement = compile _statement;
if (profileNamespace getVariable ["ACE_Interaction_FlowMenu", false]) then {
if (GVAR(FlowMenu)) then {
_statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then {
compile format [QUOTE( call FUNC(hideMenu);if(%2 == 1)then{['%1'] call FUNC(openSubMenuSelf);}else{['%1'] call FUNC(openSubMenu);}; ), _subMenu select 0, _subMenu select 1];
} else {

View File

@ -67,7 +67,7 @@ if (_this select 2) then {
disableSerialization;
_dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog);
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3;
if (profileNamespace getVariable [QGVAR(AutoCenterCursor), true]) then {setMousePosition [0.5, 0.5]};
if (GVAR(AutoCenterCursor)) then {setMousePosition [0.5, 0.5]};
if !(_subMenu) then {
_ctrlInteractionDialog ctrlSetText ([_target] call EFUNC(common,getName));
} else {

View File

@ -16,6 +16,6 @@ _activated = _this select 2;
if !(_activated) exitWith {};
[_logic, QGVAR(EnableTeamManagement), "EnableTeamManagement"] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(EnableTeamManagement), "EnableTeamManagement"] call EFUNC(common,readSettingFromModule);
diag_log text "[ACE]: Interaction Module Initialized.";

View File

@ -15,7 +15,13 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
class ACE_Parameters_Numeric {
GVAR(TimePerAmmo) = 1.5;
GVAR(TimePerMagazine) = 2.0;
class ACE_Settings {
class GVAR(TimePerAmmo) {
value = 1.5;
typeName = "SCALAR";
};
class GVAR(TimePerMagazine) {
value = 2.0;
typeName = "SCALAR";
};
};

View File

@ -23,13 +23,23 @@ class RscButtonMenuCancel;
class RscButtonMenu;
class RscEdit;
class ACE_Parameters_Numeric {
GVAR(BFT_Interval) = 1;
};
class ACE_Parameters_Boolean {
GVAR(EveryoneCanDrawOnBriefing) = 1;
GVAR(BFT_Enabled) = 0;
GVAR(BFT_HideAiGroups) = 0;
class ACE_Settings {
class GVAR(BFT_Interval) {
value = 1.0;
typeName = "SCALAR";
};
class GVAR(EveryoneCanDrawOnBriefing) {
value = 1;
typeName = "BOOL";
};
class GVAR(BFT_Enabled) {
value = 0;
typeName = "BOOL";
};
class GVAR(BFT_HideAiGroups) {
value = 0;
typeName = "BOOL";
};
};
#include "MapGpsUI.hpp"

View File

@ -21,8 +21,8 @@ _activated = _this select 2;
if !(_activated) exitWith {};
GVAR(BFT_Enabled) = true;
[_logic, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readSettingFromModule);
diag_log text "[ACE]: Blue Force Tracking Module initialized.";
TRACE_2("[ACE]: Blue Force Tracking Module initialized.",GVAR(BFT_Interval), GVAR(BFT_HideAiGroups));

View File

@ -15,9 +15,9 @@ _logic = _this select 0;
GVAR(Module) = true;
[_logic, QGVAR(ENABLE_REVIVE_F), "enableFor" ] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(REVIVE_TIMER_MAX_F), "timer" ] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(REVIVE_NUMBER_MAX_F), "amountOf" ] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(ENABLE_REVIVE_F), "enableFor" ] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(REVIVE_TIMER_MAX_F), "timer" ] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(REVIVE_NUMBER_MAX_F), "amountOf" ] call EFUNC(common,readSettingFromModule);
[
{(((_this select 0) getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > 0)}

View File

@ -17,9 +17,11 @@ class CfgPatches {
//#include "CfgInventoryGlobalVariable.hpp"
#include "CfgMoves.hpp"
class ACE_Options {
class ACE_Settings {
class GVAR(useImperial) {
value = 0;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Movement_UseImperial";
default = 0;
};
};

View File

@ -7,7 +7,7 @@ _unit = _this select 0;
_weight = loadAbs _unit * 0.1;
if (GETGVAR(useImperial, 0) == 1) then {
if (GVAR(useImperial)) then {
_weight = format ["%1lb", (round (_weight * 100)) / 100];
} else {
_weight = format ["%1kg", (round (_weight * FACTOR_POUND_TO_KILOGRAMM * 100)) / 100];

View File

@ -15,40 +15,44 @@ class CfgVehicles {
typeName = "NUMBER";
defaultValue = 5;
};
class ShowNamesForAI {
class showNamesForAI {
displayName = "Show name tags for AI?";
description = "Show the name and rank tags for friendly AI units? Default: No";
typeName = "BOOL";
class values {
class Yes {
name = "Yes";
value = 1;
};
class No {
default = 1;
name = "No";
value = 0;
};
};
};
class Visibility {
displayName = "Visibility of crew info";
description = "Forces visibility of vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force";
typeName = "INT";
description = "Show the name and rank tags for friendly AI units? Default: Do not force";
typeName = "NUMBER";
class values {
class DoNotForce {
default = 1;
name = "Do Not Force";
value = -1;
};
class ForceHide {
name = "Force Hide";
value = 0;
};
class ForceShow {
name = "Force show";
value = 1;
};
};
};
class showVehicleCrewInfo {
displayName = "Show crew info?";
description = "Show vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force";
typeName = "NUMBER";
class values {
class DoNotForce {
default = 1;
name = "Do Not Force";
value = -1;
};
class ForceHide {
name = "Force Hide";
value = 0;
};
class ForceShow {
name = "Force Show";
value = 1;
};
class ForceHide {
name = "Force Hide";
value = -1;
};
};
};
};

View File

@ -15,29 +15,43 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
class ACE_Options {
class ACE_Settings {
class GVAR(showPlayerNames) {
value = 1;
typeName = "SCALAR";
isClientSetable = 1;
displayName = "$STR_ACE_NameTags_ShowPlayerNames";
values[] = {"Disabled", "Enabled", "Only Cursor", "Only On Keypress", "Only Cursor and KeyPress"};
default = 1;
};
class GVAR(showPlayerRanks) {
value = 1;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_NameTags_ShowPlayerRanks";
default = 1;
};
class GVAR(showVehicleCrewInfo) {
displayName = "$STR_ACE_CrewInfo_ShowVehicleCrewInfo";
default = 1;
value = 1;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_NameTags_ShowVehicleCrewInfo";
};
class GVAR(showNamesForAI) {
value = 0;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_NameTags_ShowNamesForAI";
};
};
class ACE_Parameters_Numeric {
GVAR(PlayerNamesViewDistance) = 5;
GVAR(PlayerNamesMaxAlpha) = 0.8;
GVAR(CrewInfoVisibility) = 0;
};
class ACE_Parameters_Boolean {
GVAR(ShowNamesForAI) = 0;
class GVAR(PlayerNamesViewDistance) {
value = 5;
typeName = "SCALAR";
isClientSetable = 0;
};
class GVAR(PlayerNamesMaxAlpha) {
value = 0.8;
typeName = "SCALAR";
isClientSetable = 0;
};
};
#include <RscTitles.hpp>

View File

@ -1,12 +1,12 @@
/*
Author: aeroson
Description:
Might be called several times a second
Parameters:
Parameters:
None
Returns:
true if CrewInfo can be shown, false otherwise
*/
@ -17,11 +17,6 @@ private["_player"];
_player = ACE_player;
// AGM_NameTags_ShowVehicleCrewInfo: -1 force NO, 0 doesnt care, 1 force YES
vehicle _player != _player &&
{
(GVAR(CrewInfoVisibility) == 1) ||
(GVAR(CrewInfoVisibility) != -1 && GVAR(showVehicleCrewInfo))
} &&
{GVAR(ShowCrewInfo)} &&
{!(vehicle _player isKindOf "ParachuteBase")};

View File

@ -22,8 +22,8 @@ if !(_activated) exitWith {};
GVAR(Module) = true;
[_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(CrewInfoVisibility), "Visibility" ] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(showVehicleCrewInfo), "showVehicleCrewInfo" ] call EFUNC(common,readSettingFromModule);
diag_log text "[ACE]: NameTags Module Initialized.";

View File

@ -58,9 +58,7 @@
<Hungarian>Játékosok rendfokozatának mutatása (névcímke szükséges)</Hungarian>
<Russian>Показать звания игроков (требует имен игроков)</Russian>
</Key>
</Package>
<Package name="CrewInfo">
<Key ID="STR_ACE_CrewInfo_ShowVehicleCrewInfo">
<Key ID="STR_ACE_NameTags_ShowVehicleCrewInfo">
<English>Show vehicle crew info</English>
<German>Zeige Fahrzeugbesatzung</German>
<Spanish>Mostrar tripulantes</Spanish>
@ -68,5 +66,8 @@
<Czech>Zobrazit info o posádce vozidla</Czech>
<Russian>Показать экипаж</Russian>
</Key>
<Key ID="STR_ACE_NameTags_ShowNamesForAI">
<English>Show name tags for AI units</English>
</Key>
</Package>
</Project>

View File

@ -3,9 +3,3 @@ class Extended_PreInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};

View File

@ -1,4 +0,0 @@
#include "script_component.hpp"
//Add Settings from configFile
[] call FUNC(addFromConfig);

View File

@ -2,16 +2,11 @@
ADDON = false;
PREP(addClientSideColor);
PREP(addClientSideOptions);
PREP(addFromConfig);
PREP(loadFromProfile);
PREP(onListBoxSettingsChanged);
PREP(onListBoxShowSelectionChanged);
PREP(onSettingsMenuOpen);
PREP(onSliderPosChanged);
PREP(resetSettings);
PREP(saveToProfile);
PREP(settingsMenuUpdateKeyView);
PREP(settingsMenuUpdateList);
PREP(updateSetting);

View File

@ -1,19 +0,0 @@
/**
* fnc_addClientSideColor.sqf
* @Descr: N/A
* @Author: PabstMirror
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_currentValue"];
PARAMS_4(_name,_localizedName,_localizedDescription,_defaultValue);
GVAR(clientSideColors) pushBack [_name, _localizedName, _localizedDescription, [], _defaultValue];
//Get the current setting from profile (or default) and set it:
_currentValue = [MENU_TAB_COLORS, _name, _defaultValue] call FUNC(loadFromProfile);
[MENU_TAB_COLORS, _name, _currentValue] call FUNC(updateSetting);

View File

@ -1,19 +0,0 @@
/**
* fnc_addClientSideOptions.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_currentValue"];
PARAMS_5(_name,_localizedName,_localizedDescription,_possibleValues,_defaultValue);
GVAR(clientSideOptions) pushBack [_name, _localizedName, _localizedDescription, _possibleValues, -1, _defaultValue];
//Get the current setting from profile (or default) and set it:
_currentValue = [MENU_TAB_OPTIONS, _name, _defaultValue] call FUNC(loadFromProfile);
[MENU_TAB_OPTIONS, _name, _currentValue] call FUNC(updateSetting);

View File

@ -1,38 +0,0 @@
/**
* fnc_addFromConfig.sqf
* @Descr: N/A
* @Author: PabstMirror
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
if (isClass (configFile >> "ACE_Options")) then {
_countOptions = count (configFile >> "ACE_Options");
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = (configFile >> "ACE_Options") select _index;
_name = configName _optionEntry;
_displayName = getText (_optionEntry >> "displayName");
_description = getText (_optionEntry >> "description");
_default = getNumber (_optionEntry >> "default");
_choices = getArray (_optionEntry >> "values");
if ((count _choices) == 0) then {
_choices = [(localize "STR_ACE_OptionsMenu_Disabled"), (localize "STR_ACE_OptionsMenu_Enabled")];
};
[_name, _displayName, _description, _choices, _default] call FUNC(addClientSideOptions);
};
};
if (isClass (configFile >> "ACE_Colors")) then {
_countOptions = count (configFile >> "ACE_Colors");
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = (configFile >> "ACE_Colors") select _index;
_name = configName _optionEntry;
_displayName = getText (_optionEntry >> "displayName");
_description = getText (_optionEntry >> "description");
_default = getArray (_optionEntry >> "default");
[_name, _displayName, _description, _default] call FUNC(addClientSideColor);
};
};

View File

@ -1,36 +0,0 @@
/**
* fnc_loadFromProfile.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_typeString", "_settingValue", "_badData"];
PARAMS_3(_type,_name,_default);
_typeString = "";
switch (_type) do {
case (MENU_TAB_OPTIONS): {_typeString = "option";};
case (MENU_TAB_COLORS): {_typeString = "color";};
};
_settingValue = profileNamespace getvariable [(format ["ace_%1_%2", _typeString, _name]), _default];
_badData = isNil "_settingValue";
if (!_badData) then {
switch (_type) do {
case (MENU_TAB_OPTIONS): {_badData = ((typeName _settingValue) != (typeName 0));};
case (MENU_TAB_COLORS): {_badData = (((typeName _settingValue) != (typeName [])) || {(count _settingValue) != 4});};
};
};
if (_badData) then {
_settingValue = _default;
systemChat format ["Bad Data in profile [ace_%1_%2] using default", _typeString, _name];
ERROR("Bad Value in profile");
};
_settingValue

View File

@ -9,5 +9,26 @@
*/
#include "script_component.hpp"
// Filter only user setable setting
GVAR(clientSideOptions) = [];
GVAR(clientSideColors) = [];
{
// If the setting is user setable and not forced
if ((_x select 2) && !(_x select 6)) then {
// Append the current value to the setting metadata
_setting = + _x;
_setting pushBack (missionNamespace getVariable (_x select 0));
// Categorize the setting according to types
// @todo: allow the user to modify other types of parameters?
if ((_x select 1) == "SCALAR" || (_x select 1) == "BOOL") then {
GVAR(clientSideOptions) pushBack _setting;
};
if ((_x select 1) == "COLOR") then {
GVAR(clientSideColors) pushBack _setting;
};
};
} forEach EGVAR(common,settings);
//Delay a frame
[{ [MENU_TAB_OPTIONS] call FUNC(onListBoxShowSelectionChanged) }, []] call EFUNC(common,execNextFrame);

View File

@ -13,13 +13,13 @@ private ["_name", "_default", "_lastSelected"];
{
_name = _x select 0;
_default = _x select 5;
_default = _x select 7;
[MENU_TAB_OPTIONS, _name, _default] call FUNC(updateSetting);
} forEach GVAR(clientSideOptions);
{
_name = _x select 0;
_default = _x select 4;
_default = _x select 7;
[MENU_TAB_COLORS, _name, _default] call FUNC(updateSetting);
} forEach GVAR(clientSideColors);

View File

@ -1,37 +0,0 @@
/**
* fnc_saveToProfile.sqf
* @Descr: Save the clientside option to the profile.
* @Author: Glowbal
*
* @Arguments: [name STRING (Name of setting)]
* @Return: BOOL True if saved.
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_nameSelected", "_saved"];
PARAMS_2(_type,_name);
_saved = false;
switch (_type) do {
case (MENU_TAB_OPTIONS): {
{
_nameSelected = _x select 0;
if (_nameSelected == _name) exitwith {
profileNamespace setvariable [(format ["ace_option_%1", _name]), (_x select 4)];
_saved = true;
};
}foreach GVAR(clientSideOptions);
};
case (MENU_TAB_COLORS): {
{
_nameSelected = _x select 0;
if (_nameSelected == _name) exitwith {
profileNamespace setvariable [(format ["ace_color_%1", _name]), (_x select 3)];
_saved = true;
};
}foreach GVAR(clientSideColors);
};
};
_saved

View File

@ -33,8 +33,8 @@ if (count _collection > 0) then {
_setting = _collection select _settingIndex;
_entryName = _setting select 0;
_localizedName = _setting select 1;
_localizedDescription = _setting select 2;
_localizedName = _setting select 3;
_localizedDescription = _setting select 4;
if (_localizedName == "") then {_localizedName = _entryName;};
(_settingsMenu displayCtrl 250) ctrlSetText _localizedName;
@ -43,15 +43,23 @@ if (count _collection > 0) then {
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
_possibleValues = _setting select 3;
_settingsValue = _setting select 4;
lbClear 400;
{ lbAdd [400, _x]; } foreach _possibleValues;
_possibleValues = _setting select 5;
_settingsValue = _setting select 8;
// Created disable/enable options for bools
if ((_setting select 1) == "BOOL") then {
lbClear 400;
lbAdd [400, (localize "STR_ACE_OptionsMenu_Disabled")];
lbAdd [400, (localize "STR_ACE_OptionsMenu_Enabled")];
_settingsValue = [0, 1] select _settingsValue;
} else {
lbClear 400;
{ lbAdd [400, _x]; } foreach _possibleValues;
};
(_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue;
};
case (MENU_TAB_COLORS): {
_currentColor = _setting select 3;
_currentColor = _setting select 8;
{
sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))];
} forEach [410, 411, 412, 413];

View File

@ -21,21 +21,30 @@ lbclear _ctrlList;
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
{
_settingsText = ((_x select 3) select (_x select 4));
_ctrlList lbadd (_x select 1);
_ctrlList lbadd (_x select 3);
_settingsValue = _x select 8;
// Created disable/enable options for bools
_settingsText = if ((_x select 1) == "BOOL") then {
[(localize "STR_ACE_OptionsMenu_Disabled"), (localize "STR_ACE_OptionsMenu_Enabled")] select _settingsValue;
} else {
(_x select 5) select _settingsValue;
};
_ctrlList lbadd (_settingsText);
}foreach GVAR(clientSideOptions);
};
case (MENU_TAB_COLORS): {
{
_color = +(_x select 3);
_color = +(_x select 8);
{
_color set [_forEachIndex, ((round (_x * 100))/100)];
} forEach _color;
_settingsColor = str _color;
_ctrlList lbadd (_x select 1);
_ctrlList lbadd (_x select 3);
_ctrlList lbadd (_settingsColor);
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 3)];
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 8)];
}foreach GVAR(clientSideColors);
};
};

View File

@ -17,25 +17,31 @@ _changed = false;
switch (_type) do {
case (MENU_TAB_OPTIONS): {
{
if (((_x select 0) == _name) && {!((_x select 4) isEqualTo _newValue)}) then {
_changed = true;
_x set [4, _newValue];
if ((_x select 0) == _name) then {
if ((_x select 1) == "BOOL") then {
_newValue = [false, true] select _newValue;
};
if !((_x select 8) isEqualTo _newValue) then {
_changed = true;
_x set [8, _newValue];
} ;
};
} foreach GVAR(clientSideOptions);
};
case (MENU_TAB_COLORS): {
{
if (((_x select 0) == _name) && {!((_x select 3) isEqualTo _newValue)}) then {
if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then {
_changed = true;
_x set [3, _newValue];
_x set [8, _newValue];
};
} foreach GVAR(clientSideColors);
};
};
if (_changed) then {
missionNameSpace setVariable [_name, _newValue];
[_type, _name] call FUNC(saveToProfile);
["SettingChanged", [_name, _newValue]] call EFUNC(common,localEvent);
TRACE_2("Variable Updated",_name,_newValue);
profileNamespace setVariable [_name, _newValue];
[_name, _newValue] call EFUNC(common,setSetting);
};

View File

@ -17,7 +17,13 @@ class CfgPatches {
#include "CfgVehicleClasses.hpp"
#include "CfgVehicles.hpp"
class ACE_Parameters_Boolean {
GVAR(SavePreDeathGear) = 0;
GVAR(RemoveDeadBodiesDisconnected) = 1;
class ACE_Settings {
class GVAR(SavePreDeathGear) {
value = 0;
typeName = "BOOL";
};
class GVAR(RemoveDeadBodiesDisconnected) {
value = 1;
typeName = "BOOL";
};
};

View File

@ -1,17 +1,17 @@
/*
Name: ACE_Respawn_fnc_module
Author(s):
KoffeinFlummi, bux578, CAA-Picard, commy2
Description:
initializes the respawn module
Parameters:
0: OBJECT - logic
1: ARRAY<OBJECT> - synced units
2: BOOLEAN - activated
Returns:
VOID
*/
@ -27,8 +27,8 @@ if !(_activated) exitWith {};
GVAR(Module) = true;
[_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readSettingFromModule);
if (isServer) then {
if (GVAR(RemoveDeadBodiesDisconnected)) then {

View File

@ -15,15 +15,33 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
class ACE_Parameters_Numeric {
GVAR(SafeZoneRadius) = 100;
};
class ACE_Parameters_Boolean {
GVAR(EnableSwitchUnits) = 0;
GVAR(SwitchToWest) = 0;
GVAR(SwitchToEast) = 0;
GVAR(SwitchToIndependent) = 0;
GVAR(SwitchToCivilian) = 0;
GVAR(EnableSafeZone) = 1;
class ACE_Settings {
class GVAR(SafeZoneRadius) {
value = 100;
typeName = "SCALAR";
};
class GVAR(EnableSwitchUnits) {
value = 0;
typeName = "BOOL";
};
class GVAR(SwitchToWest) {
value = 0;
typeName = "BOOL";
};
class GVAR(SwitchToEast) {
value = 0;
typeName = "BOOL";
};
class GVAR(SwitchToIndependent) {
value = 0;
typeName = "BOOL";
};
class GVAR(SwitchToCivilian) {
value = 0;
typeName = "BOOL";
};
class GVAR(EnableSafeZone) {
value = 1;
typeName = "BOOL";
};
};

View File

@ -1,17 +1,17 @@
/*
Name: ACE_SwitchUnits_fnc_module
Author(s):
bux578
Description:
Initializes the SwitchUnits module
Parameters:
0: OBJECT - module logic
1: ARRAY<OBJECT> - list of affected units
2: BOOLEAN - isActivated
Returns:
BOOLEAN (Good practice to include one)
*/
@ -29,12 +29,12 @@ GVAR(Module) = true;
[QGVAR(EnableSwitchUnits), true] call EFUNC(common,setParameter);
[_logic, QGVAR(SwitchToWest), "SwitchToWest"] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(SwitchToEast), "SwitchToEast"] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(SwitchToIndependent), "SwitchToIndependent"] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(SwitchToCivilian), "SwitchToCivilian"] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(EnableSafeZone), "EnableSafeZone"] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(SafeZoneRadius), "SafeZoneRadius"] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(SwitchToWest), "SwitchToWest"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(SwitchToEast), "SwitchToEast"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(SwitchToIndependent), "SwitchToIndependent"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(SwitchToCivilian), "SwitchToCivilian"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(EnableSafeZone), "EnableSafeZone"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(SafeZoneRadius), "SafeZoneRadius"] call EFUNC(common,readSettingFromModule);
diag_log text "[ACE]: SwitchUnits Module Initialized.";

View File

@ -12,8 +12,11 @@ class CfgPatches {
};
};
class ACE_Parameters_Numeric {
GVAR(DefaultLockpickStrength) = 10;
class ACE_Settings {
class GVAR(DefaultLockpickStrength) {
value = 10;
typeName = "SCALAR";
};
};
#include "CfgEventHandlers.hpp"

View File

@ -29,7 +29,7 @@ _sideKeysAssignment = _logic getVariable["SideKeysAssignment", 0];
_setLockState = _logic getVariable["SetLockState", 0];
if (isServer) then {
[_logic, QGVAR(DefaultLockpickStrength), "LockpickStrength"] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(DefaultLockpickStrength), "LockpickStrength"] call EFUNC(common,readSettingFromModule);
};
//Run at mission start (anyone besides JIPs)

View File

@ -14,11 +14,3 @@ class CfgPatches {
#include "CfgEventhandlers.hpp"
#include "CfgWorlds.hpp"
/*class ACE_Parameters_Numeric {
GVAR(XXXX) = 100;
};
class ACE_Parameters_Boolean {
GVAR(XXXX) = 0;
};*/

View File

@ -4,12 +4,6 @@ class Extended_PreInit_EventHandlers {
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_postInit.sqf) );
};
};
class Extended_Fired_Eventhandlers {
class CaManBase {
fired = QUOTE( call FUNC(handleFired) );

View File

@ -1,27 +1,20 @@
class CfgVehicles {
// TODO Stringtable usage
class Logic;
class Module_F: Logic {
class ArgumentsBaseUnits {
};
};
class GVAR(Module): Module_F {
scope = 2;
displayName = "Wind Deflection [ACE]";
icon = QUOTE(PATHTOF(data\module_icon.paa));
category = "ACE";
function = FUNC(enableModule);
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;
class Arguments {
class forAI {
displayName = "Enable for AI";
description = "Should the module be enabled for AI";
typeName = "BOOL";
defaultValue = 0;
};
};
};
class Module_F;
class GVAR(Module): Module_F {
author = "$STR_ACE_Common_ACETeam";
category = "ACE";
displayName = "Wind Deflection";
function = FUNC(enableModule);
scope = 2;
isGlobal = 1;
icon = QUOTE(PATHTOF(data\module_icon.paa));
class Arguments {
class EnableForAI {
displayName = "Enable for AI";
description = "Should the module be enabled for AI";
typeName = "BOOL";
defaultValue = 0;
};
};
};
};

View File

@ -1,15 +0,0 @@
/**
* XEH_postInit.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
if (isnil QGVAR(EnableForAI)) then {
GVAR(EnableForAI) = false;
};

View File

@ -1,16 +1,16 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ACE_common", "ACE_weather"};
versionDesc = "ACE Wind Deflection";
version = VERSION;
author[] = {$STR_ACE_Core_ACETeam, "Glowbal", "Ruthberg"};
authorUrl = "http://csemod.com";
};
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ACE_common", "ACE_weather"};
versionDesc = "ACE Wind Deflection";
version = VERSION;
author[] = {$STR_ACE_Core_ACETeam, "Glowbal", "Ruthberg"};
authorUrl = "http://csemod.com";
};
};
class CfgAddons {
@ -21,4 +21,11 @@ class CfgAddons {
};
};
class ACE_Settings {
class GVAR(EnableForAI) {
value = 0;
typeName = "BOOL";
isClientSetable = 0;
};
};
#include "CfgVehicles.h"

View File

@ -15,5 +15,5 @@ if (!hasInterface) exitwith {}; // No need for this module on HC or dedicated se
private ["_logic"];
_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param;
if (!isNull _logic) then {
[_logic, QGVAR(EnableForAI), "forAI" ] call EFUNC(common,readBooleanParameterFromModule);
[_logic, QGVAR(EnableForAI), "EnableForAI" ] call EFUNC(common,readSettingFromModule);
};