ACE3/addons/viewdistance/XEH_postInit.sqf

29 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-05-08 12:14:15 +00:00
#include "script_component.hpp"
if (!hasInterface) exitWith {};
2015-05-14 18:15:07 +00:00
// Force the view distance down to the limit.
if (GVAR(enabled) && {viewDistance > GVAR(limitViewDistance)}) then {
2015-05-14 18:15:07 +00:00
setViewDistance GVAR(limitViewDistance);
};
2015-05-14 18:15:07 +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 ace_common_fnc_addEventHandler;
2015-05-14 18:15:07 +00:00
// Set the EH which waits for any of the view distance settings to be changed, so that the effect is show immediately
2015-05-14 15:44:35 +00:00
["SettingChanged",{
2015-05-14 18:15:07 +00:00
if ((_this select 0 == QGVAR(viewDistanceOnFoot)) ||
(_this select 0 == QGVAR(viewDistanceLandVehicle)) ||
(_this select 0 == QGVAR(viewDistanceAirVehicle)) ||
(_this select 0 == QGVAR(objectViewDistanceCoeff))) then {
2015-05-14 15:44:35 +00:00
[true] call FUNC(adaptViewDistance);
};
2015-05-14 18:15:07 +00:00
}] call ace_common_fnc_addEventHandler;
2015-05-14 15:44:35 +00:00
// Set the EH which waits for a vehicle change to automatically swap to On Foot/In Land Vehicle/In Air Vehicle
2015-05-14 18:15:07 +00:00
["playerVehicleChanged",{
[false] call FUNC(adaptViewDistance)
}] call ace_common_fnc_addEventHandler;