From c05a91f5308d0f0ab63059c2ef17f67d73308d1c Mon Sep 17 00:00:00 2001 From: SAM Date: Sun, 10 May 2015 12:15:34 +0200 Subject: [PATCH] Suppress prompts when changing vehicle. They're only shown when the player changes the setting. --- .../viewdistance/functions/fnc_adaptViewDistance.sqf | 10 ++++++---- .../viewdistance/functions/fnc_changeViewDistance.sqf | 2 +- addons/viewdistance/functions/fnc_init.sqf | 8 ++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/addons/viewdistance/functions/fnc_adaptViewDistance.sqf b/addons/viewdistance/functions/fnc_adaptViewDistance.sqf index bc56955893..946c601fc8 100644 --- a/addons/viewdistance/functions/fnc_adaptViewDistance.sqf +++ b/addons/viewdistance/functions/fnc_adaptViewDistance.sqf @@ -4,7 +4,7 @@ * * * Arguments: - * None + * 0: Show Prompt * * Return Value: * None @@ -17,19 +17,21 @@ #include "script_component.hpp" +PARAMS_1(_show_prompt); + private["_land_vehicle","_air_vehicle"]; _land_vehicle = (vehicle player) isKindOf "LandVehicle"; _air_vehicle = (vehicle player) isKindOf "Air"; if (!_land_vehicle && !_air_vehicle) exitWith { - [GVAR(viewDistanceOnFoot),true] call FUNC(changeViewDistance); + [GVAR(viewDistanceOnFoot),_show_prompt] call FUNC(changeViewDistance); }; if (_land_vehicle) exitWith { - [GVAR(viewDistanceLandVehicle),true] call FUNC(changeViewDistance); + [GVAR(viewDistanceLandVehicle),_show_prompt] call FUNC(changeViewDistance); }; if (_air_vehicle) exitWith { - [GVAR(viewDistanceAirVehicle),true] call FUNC(changeViewDistance); + [GVAR(viewDistanceAirVehicle),_show_prompt] call FUNC(changeViewDistance); }; \ No newline at end of file diff --git a/addons/viewdistance/functions/fnc_changeViewDistance.sqf b/addons/viewdistance/functions/fnc_changeViewDistance.sqf index 596c86d521..bf5f610c0d 100644 --- a/addons/viewdistance/functions/fnc_changeViewDistance.sqf +++ b/addons/viewdistance/functions/fnc_changeViewDistance.sqf @@ -26,7 +26,7 @@ _view_distance_limit = GVAR(limitViewDistance); // Grab the limit if (_new_view_distance <= _view_distance_limit) then { if (_prompt) then { - _text = composeText ["View distance: ",str(_new_view_distance)]; + _text = composeText ["View distance successfully changed to: ",str(_new_view_distance)]; [_text,1] call EFUNC(common,displayTextStructured); }; setViewDistance _new_view_distance; diff --git a/addons/viewdistance/functions/fnc_init.sqf b/addons/viewdistance/functions/fnc_init.sqf index 72fc2ee0e6..07befd157c 100644 --- a/addons/viewdistance/functions/fnc_init.sqf +++ b/addons/viewdistance/functions/fnc_init.sqf @@ -23,15 +23,15 @@ if (viewDistance > GVAR(limitViewDistance)) then { setViewDistance GVAR(limitViewDistance); // force the view distance down to the limit. setObjectViewDistance (0.8 * GVAR(limitViewDistance)); } else { - [] call FUNC(adaptViewDistance); // adapt view distance in the beginning according to whether client is on foot or vehicle. + [true] call FUNC(adaptViewDistance); // adapt view distance in the beginning according to whether client is on foot or vehicle. }; -// Set the EH which waits for any of the view distance settings to be changed (avoids the player having to enter or leave their vehicle for the changes to have effect.) +// 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 { - [] call FUNC(adaptViewDistance); + [true] call FUNC(adaptViewDistance); }; },true] 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",{[] call FUNC(adaptViewDistance)},true] call ace_common_fnc_addEventHandler; \ No newline at end of file +["playerVehicleChanged",{[false] call FUNC(adaptViewDistance)},true] call ace_common_fnc_addEventHandler; \ No newline at end of file