From 7a6fb5465402a83f46a5351ab0b09594b4d79cd2 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Thu, 14 May 2015 15:15:07 -0300 Subject: [PATCH] Small tweaks to viewdistance --- addons/viewdistance/XEH_postInit.sqf | 30 +++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/addons/viewdistance/XEH_postInit.sqf b/addons/viewdistance/XEH_postInit.sqf index 6c4f41d374..f024f58194 100644 --- a/addons/viewdistance/XEH_postInit.sqf +++ b/addons/viewdistance/XEH_postInit.sqf @@ -2,26 +2,28 @@ if (!hasInterface) exitWith {}; +// Force the view distance down to the limit. if (viewDistance > GVAR(limitViewDistance)) then { - setViewDistance GVAR(limitViewDistance); // force the view distance down to the limit. - setObjectViewDistance (0.8 * GVAR(limitViewDistance)); -} else { - [true] call FUNC(adaptViewDistance); // adapt view distance in the beginning according to whether client is on foot or vehicle. + setViewDistance GVAR(limitViewDistance); }; -// Set the EH which waits for any of the view distance settings to be changed, avoids the player having to enter or leave a vehicle for the changes to have effect. -["SettingChanged",{ - if ((_this select 0 == QGVAR(viewDistanceOnFoot)) || (_this select 0 == QGVAR(viewDistanceLandVehicle)) || (_this select 0 == QGVAR(viewDistanceAirVehicle))) then { - [true] call FUNC(adaptViewDistance); - }; -},true] call ace_common_fnc_addEventHandler; +// Adapt view distance when the player is created or changed according to whether client is on foot or vehicle. +["playerChanged",{ + [false] call FUNC(adaptViewDistance); +}] call ace_common_fnc_addEventHandler; -// Set the EH which waits for the Object View Distance coefficient to be changed, so that the effect is show immediately +// Set the EH which waits for any of the view distance settings to be changed, so that the effect is show immediately ["SettingChanged",{ - if (_this select 0 == QGVAR(objectViewDistanceCoeff)) then { + if ((_this select 0 == QGVAR(viewDistanceOnFoot)) || + (_this select 0 == QGVAR(viewDistanceLandVehicle)) || + (_this select 0 == QGVAR(viewDistanceAirVehicle)) || + (_this select 0 == QGVAR(objectViewDistanceCoeff))) then { + [true] call FUNC(adaptViewDistance); }; -},true] call ace_common_fnc_addEventHandler; +}] call ace_common_fnc_addEventHandler; // Set the EH which waits for a vehicle change to automatically swap to On Foot/In Land Vehicle/In Air Vehicle -["playerVehicleChanged",{[false] call FUNC(adaptViewDistance)},true] call ace_common_fnc_addEventHandler; \ No newline at end of file +["playerVehicleChanged",{ + [false] call FUNC(adaptViewDistance) +}] call ace_common_fnc_addEventHandler; \ No newline at end of file