Make viewdistance disabable through settings and module

This commit is contained in:
esteldunedain 2015-05-14 16:36:12 -03:00
parent 195643d557
commit a9197a8e33
5 changed files with 17 additions and 4 deletions

View File

@ -1,4 +1,10 @@
class ACE_Settings { class ACE_Settings {
class GVAR(enabled) {
typeName = "BOOL";
value = 1;
displayName = "Enable ACE viewdistance";
description = "Enables ACE viewdistance module.";
};
class GVAR(viewDistanceOnFoot) { class GVAR(viewDistanceOnFoot) {
typeName = "SCALAR"; typeName = "SCALAR";
isClientSettable = 1; isClientSettable = 1;

View File

@ -9,6 +9,12 @@ class CfgVehicles {
isGlobal = 1; isGlobal = 1;
//icon = ""; // needs an icon //icon = ""; // needs an icon
class Arguments { class Arguments {
class moduleViewDistanceEnabled {
displayName = "Enable ACE viewdistance";
description = "Enables ACE viewdistance";
typeName = "BOOL";
defaultValue = 1;
};
class moduleViewDistanceLimit { class moduleViewDistanceLimit {
displayName = "View Distance Limit"; displayName = "View Distance Limit";
description = "Sets the limit for how high clients can raise their view distance (<= 10000)"; description = "Sets the limit for how high clients can raise their view distance (<= 10000)";

View File

@ -3,7 +3,7 @@
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
// Force the view distance down to the limit. // Force the view distance down to the limit.
if (viewDistance > GVAR(limitViewDistance)) then { if (GVAR(enabled) && {viewDistance > GVAR(limitViewDistance)}) then {
setViewDistance GVAR(limitViewDistance); setViewDistance GVAR(limitViewDistance);
}; };

View File

@ -21,7 +21,7 @@ PARAMS_1(_show_prompt);
private["_land_vehicle","_air_vehicle"]; private["_land_vehicle","_air_vehicle"];
if (isNull ACE_player) exitWith {}; if (!GVAR(enabled) || isNull ACE_player) exitWith {};
_land_vehicle = (vehicle ACE_player) isKindOf "LandVehicle"; _land_vehicle = (vehicle ACE_player) isKindOf "LandVehicle";
_air_vehicle = (vehicle ACE_player) isKindOf "Air"; _air_vehicle = (vehicle ACE_player) isKindOf "Air";

View File

@ -23,6 +23,7 @@ if (!_activated) exitWith {
diag_log text "[ACE]: View Distance Limit Module is placed but NOT active."; diag_log text "[ACE]: View Distance Limit Module is placed but NOT active.";
}; };
[_logic, QGVAR(enabled),"moduleViewDistanceEnabled"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(limitViewDistance),"moduleViewDistanceLimit"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(limitViewDistance),"moduleViewDistanceLimit"] call EFUNC(common,readSettingFromModule);
diag_log format ["[ACE]: View Distance Limit Module Initialized. Limit set by module: %1",GVAR(limitViewDistance)]; diag_log format ["[ACE]: View Distance Limit Module Initialized. Limit set by module: %1",GVAR(limitViewDistance)];