2015-05-08 07:28:48 +00:00
|
|
|
/*
|
|
|
|
* Author: Winter
|
|
|
|
* Sets the player's current view distance according to allowed values.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-05-08 12:14:15 +00:00
|
|
|
* None
|
2015-05-08 07:28:48 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-05-08 12:14:15 +00:00
|
|
|
* [] call ace_viewdistance_fnc_changeViewDistance;
|
2015-05-08 07:28:48 +00:00
|
|
|
*
|
2015-05-08 13:36:47 +00:00
|
|
|
* Public: Yes
|
2015-05-08 07:28:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-08 13:27:13 +00:00
|
|
|
private ["_text","_new_view_distance","_view_distance_limit"];
|
2015-05-08 12:49:52 +00:00
|
|
|
|
|
|
|
_new_view_distance = [GVAR(newViewDistance)] call FUNC(returnViewDistanceValue);
|
|
|
|
_view_distance_limit = [GVAR(topViewDistanceLimit)] call FUNC(returnViewDistanceValue);
|
|
|
|
|
|
|
|
if !GVAR(changeAllowed) then {
|
2015-05-08 13:27:13 +00:00
|
|
|
_text = "You are not allowed to change the view distance!";
|
|
|
|
[_text,2] call EFUNC(common,displayTextStructured);
|
2015-05-08 12:49:52 +00:00
|
|
|
} else {
|
|
|
|
if (_new_view_distance > _view_distance_limit) then {
|
2015-05-08 13:27:13 +00:00
|
|
|
_text = composeText ["That option is not allowed! The limit is: ",str(_view_distance_limit)];
|
|
|
|
[_text,1] call EFUNC(common,displayTextStructured);
|
2015-05-08 12:49:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2015-05-08 13:27:13 +00:00
|
|
|
_text = composeText ["View distance successfully changed to: ",str(_new_view_distance)];
|
|
|
|
[_text,1] call EFUNC(common,displayTextStructured);
|
2015-05-08 12:49:52 +00:00
|
|
|
setViewDistance _new_view_distance;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// To do: add a check against a module limit.
|