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 GVAR(enabled) {
typeName = "BOOL";
value = 1;
displayName = "Enable ACE viewdistance";
description = "Enables ACE viewdistance module.";
};
class GVAR(viewDistanceOnFoot) {
typeName = "SCALAR";
isClientSettable = 1;

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
/*
* Author: Winter
* Initialises the view distance limiter module
*
*
*
* Arguments:
* 0: logic <OBJECT>
@ -10,7 +10,7 @@
*
* Return Value:
* None
*
*
*/
#include "script_component.hpp"
@ -23,6 +23,7 @@ if (!_activated) exitWith {
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);
diag_log format ["[ACE]: View Distance Limit Module Initialized. Limit set by module: %1",GVAR(limitViewDistance)];