mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cleaned up code
This commit is contained in:
parent
45992e5e7f
commit
0b4137763d
@ -8,7 +8,7 @@ class ACE_Settings {
|
|||||||
class GVAR(viewDistanceLimit) {
|
class GVAR(viewDistanceLimit) {
|
||||||
typeName = "SCALAR";
|
typeName = "SCALAR";
|
||||||
value = 11; // setting the highest number in the array below means no limit.
|
value = 11; // setting the highest number in the array below means no limit.
|
||||||
values[] = {0,1,2,3,4,5,6,7,8,9,10,11}; // correspond to the index values
|
values[] = {0,1,2,3,4,5,6,7,8,9,10,11}; // correspond to the INDEX values
|
||||||
displayName = "Change View Distance Limit";
|
displayName = "Change View Distance Limit";
|
||||||
description = "Sets the top limit for all clients";
|
description = "Sets the top limit for all clients";
|
||||||
};
|
};
|
||||||
@ -16,7 +16,7 @@ class ACE_Settings {
|
|||||||
typeName = "SCALAR";
|
typeName = "SCALAR";
|
||||||
isClientSettable = 1;
|
isClientSettable = 1;
|
||||||
value = 0; // not sure what to set this to.
|
value = 0; // not sure what to set this to.
|
||||||
values[] = {"1500","2000","2500","3000","3500","4000","5000","6000","7000","8000","9000","10000"};
|
values[] = {"1500","2000","2500","3000","3500","4000","5000","6000","7000","8000","9000","10000"}; // Values also need to be changed in functions/fnc_returnViewDistanceValue.sqf
|
||||||
displayName = "Change View Distance";
|
displayName = "Change View Distance";
|
||||||
description = "Changes in game view distance";
|
description = "Changes in game view distance";
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@ class CfgVehicles {
|
|||||||
class Arguments {
|
class Arguments {
|
||||||
class moduleViewDistanceLimit {
|
class moduleViewDistanceLimit {
|
||||||
displayName = "View Distance setting limit";
|
displayName = "View Distance setting limit";
|
||||||
description = "Sets the limit for how high clients can raise their view distance (< 10,000)";
|
description = "Sets the limit for how high clients can raise their view distance (< 10000)";
|
||||||
typeName = "SCALAR";
|
typeName = "SCALAR";
|
||||||
defaultValue = 10000;
|
defaultValue = 10000;
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if (!GVAR(changeAllowed)) exitWith {}; // if viewdistance is disabled from config, exit here.
|
if (!GVAR(changeAllowed)) exitWith {
|
||||||
|
// if viewdistance module is disabled from config, exit here.
|
||||||
|
diag_log format["[ACE]: View Distance is disabled from the config.cpp in the pbo"];
|
||||||
|
};
|
||||||
[] call FUNC(initViewDistance);
|
[] call FUNC(initViewDistance);
|
@ -22,6 +22,7 @@ private ["_text","_new_view_distance","_view_distance_limit"];
|
|||||||
// Change the received index number into an actual view distance number as set in the config:
|
// Change the received index number into an actual view distance number as set in the config:
|
||||||
_new_view_distance = [GVAR(newViewDistance)] call FUNC(returnViewDistanceValue);
|
_new_view_distance = [GVAR(newViewDistance)] call FUNC(returnViewDistanceValue);
|
||||||
|
|
||||||
|
// Grab the limit, either from the module OR if the module is not valid, the config.
|
||||||
_view_distance_limit = [] call FUNC(returnViewDistanceLimit);
|
_view_distance_limit = [] call FUNC(returnViewDistanceLimit);
|
||||||
|
|
||||||
if (_new_view_distance > _view_distance_limit) then {
|
if (_new_view_distance > _view_distance_limit) then {
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
// Set the EH which waits for the View Distance setting to be changed
|
||||||
["SettingChanged",{
|
["SettingChanged",{
|
||||||
if (_this select 0 == QGVAR(newViewDistance)) then {
|
if (_this select 0 == QGVAR(newViewDistance)) then {
|
||||||
[] call FUNC(changeViewDistance);
|
[] call FUNC(changeViewDistance);
|
||||||
|
@ -22,12 +22,12 @@ if (!isServer) exitWith {};
|
|||||||
PARAMS_3(_logic,_units,_activated);
|
PARAMS_3(_logic,_units,_activated);
|
||||||
|
|
||||||
if (!_activated) exitWith {
|
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.";
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(modulePresent) = true;
|
GVAR(modulePresent) = true;
|
||||||
|
|
||||||
[_logic, QGVAR(moduleViewDistanceLimit),"moduleViewDistanceLimit"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(moduleViewDistanceLimit),"moduleViewDistanceLimit"] call EFUNC(common,readSettingFromModule);
|
||||||
|
|
||||||
//hint format["[ACE]: View Distance Limit Module Initialized with limit: %1",GVAR(moduleViewDistanceLimit)]; // only used for debug
|
hint format["[ACE]: View Distance Limit Module Initialized with limit: %1",GVAR(moduleViewDistanceLimit)]; // only used for debug, GVAR(moduleViewDistanceLimit) keeps returning as ANY. Remember to remove before finalising the module.
|
||||||
diag_log format["[ACE]: View Distance Limit Module Initialized with limit: %1",GVAR(moduleViewDistanceLimit)];
|
diag_log format["[ACE]: View Distance Limit Module Initialized with limit: %1",GVAR(moduleViewDistanceLimit)];
|
@ -19,16 +19,16 @@
|
|||||||
|
|
||||||
private ["_limit"];
|
private ["_limit"];
|
||||||
|
|
||||||
_limit = 20000; // unrealistic amount for debug
|
_limit = 20000; // unrealistic amount since A3 max is 10000, helps in debug
|
||||||
|
|
||||||
if (!isNil QGVAR(moduleViewDistanceLimit)) then {
|
if (!isNil QGVAR(moduleViewDistanceLimit)) then {
|
||||||
_limit = GVAR(moduleViewDistanceLimit); // module always takes priority
|
_limit = GVAR(moduleViewDistanceLimit); // module value always takes priority over config
|
||||||
} else {
|
} else {
|
||||||
// if module is not present, take the value from the config instead
|
// If the module is not present, take the value from the config instead
|
||||||
_limit = [GVAR(viewDistanceLimit)] call FUNC(returnViewDistanceValue); // this function converts the array index in the config to it's relevant scalar value.
|
_limit = [GVAR(viewDistanceLimit)] call FUNC(returnViewDistanceValue); // this function converts the array index in the config to it's relevant scalar value.
|
||||||
};
|
};
|
||||||
|
|
||||||
hint format ["[VD] Limit returned from module: %2 Local Limit: %3",GVAR(modulePresent),GVAR(moduleViewDistanceLimit),_limit];
|
hint format ["[VD] Limit returned from module: %2 Local Limit: %3",GVAR(modulePresent),GVAR(moduleViewDistanceLimit),_limit]; // only used for debug, trying to get the module to work. Remember to remove before finalising pbo
|
||||||
diag_log format ["[VD] Limit returned from module: %2 Local Limit: %3",GVAR(modulePresent),GVAR(moduleViewDistanceLimit),_limit];
|
diag_log format ["[VD] Limit returned from module: %2 Local Limit: %3",GVAR(modulePresent),GVAR(moduleViewDistanceLimit),_limit]; // only used for debug, trying to get the module to work. Remember to remove before finalising pbo
|
||||||
|
|
||||||
_limit;
|
_limit;
|
Loading…
Reference in New Issue
Block a user