2015-05-08 12:14:15 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-10 11:04:08 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2015-06-28 08:18:53 +00:00
|
|
|
["SettingsInitialized", {
|
|
|
|
// if not enabled, then bugger off.
|
2015-07-01 17:39:49 +00:00
|
|
|
if !(GVAR(enabled)) exitWith {};
|
2015-06-28 08:18:53 +00:00
|
|
|
|
|
|
|
// Force the view distance down to the limit.
|
|
|
|
if (viewDistance > GVAR(limitViewDistance)) then {
|
|
|
|
setViewDistance GVAR(limitViewDistance);
|
2015-05-14 15:44:35 +00:00
|
|
|
};
|
2015-06-28 08:18:53 +00:00
|
|
|
|
|
|
|
// 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 EFUNC(common,addEventHandler);
|
|
|
|
|
|
|
|
// 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(viewDistanceOnFoot)) ||
|
|
|
|
(_this select 0 == QGVAR(viewDistanceLandVehicle)) ||
|
|
|
|
(_this select 0 == QGVAR(viewDistanceAirVehicle)) ||
|
|
|
|
(_this select 0 == QGVAR(objectViewDistanceCoeff))) then {
|
|
|
|
|
|
|
|
[true] call FUNC(adaptViewDistance);
|
|
|
|
};
|
|
|
|
}] call EFUNC(common,addEventHandler);
|
2015-05-14 15:44:35 +00:00
|
|
|
|
2015-06-28 08:18:53 +00:00
|
|
|
// Set the EH which waits for a vehicle change to automatically swap between On Foot/In Land Vehicle/In Air Vehicle
|
|
|
|
["playerVehicleChanged",{
|
|
|
|
[false] call FUNC(adaptViewDistance)
|
|
|
|
}] call EFUNC(common,addEventHandler);
|
2015-06-28 08:19:21 +00:00
|
|
|
}] call EFUNC(common,addEventHandler);
|