mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
First working version
This commit is contained in:
parent
2c8dddfc47
commit
6b604c101c
@ -1,9 +1,24 @@
|
|||||||
class ACE_Settings {
|
class ACE_Settings {
|
||||||
class GVAR(viewdistance) {
|
class GVAR(changeAllowed) {
|
||||||
|
typeName = "BOOL";
|
||||||
|
value = 1;
|
||||||
|
displayName = "Allow View Distance Changing";
|
||||||
|
description = "Enables changing in game view distance";
|
||||||
|
};
|
||||||
|
class GVAR(top_limit) {
|
||||||
|
typeName = "SCALAR";
|
||||||
|
values[] = {0,1,2,3,4,5,6,7,8,9,10,11}; // correspond to the index values
|
||||||
|
displayName = "View Distance Limit";
|
||||||
|
description = "Sets the top limit for all clients";
|
||||||
|
};
|
||||||
|
class GVAR(newViewDistance) {
|
||||||
typeName = "SCALAR";
|
typeName = "SCALAR";
|
||||||
isClientSettable = 1;
|
isClientSettable = 1;
|
||||||
values[] = {1500,2000,2500,3000,3500,4000,5000,6000,7000,8000,9000,10000};
|
//value = 1;
|
||||||
displayName = "View Distance"; // has to be changed to string table type
|
values[] = {"1500","2000","2500","3000","3500","4000","5000","6000","7000","8000","9000","10000"};
|
||||||
description = "Change View Distance";
|
displayName = "Change View Distance";
|
||||||
|
description = "Changes in game view distance";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// To do: include string table style displayName & description.
|
@ -4,3 +4,9 @@ class Extended_PreInit_EventHandlers {
|
|||||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Extended_PostInit_EventHandlers {
|
||||||
|
class ADDON {
|
||||||
|
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||||
|
};
|
||||||
|
};
|
4
addons/viewdistance/XEH_postInit.sqf
Normal file
4
addons/viewdistance/XEH_postInit.sqf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
if (!hasInterface || !GVAR(enabled)) exitWith {};
|
||||||
|
[] call FUNC(initViewDistance);
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
ADDON = false;
|
ADDON = false;
|
||||||
|
|
||||||
PREP(empty);
|
PREP(returnViewDistanceValue);
|
||||||
|
PREP(changeViewDistance);
|
||||||
|
PREP(initViewDistance);
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
@ -4,21 +4,38 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: View Distance Setting (SCALAR)
|
* None
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [1500] call ace_common_fnc_imanexample
|
* [] call ace_viewdistance_fnc_changeViewDistance;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_new_view_distance"];
|
private ["_new_view_distance_index","_new_view_distance"];
|
||||||
|
|
||||||
_new_view_distance = _this select 0;
|
_new_view_distance_index = GVAR(newViewDistance);
|
||||||
|
|
||||||
player setViewDistance (_new_view_distance);
|
_new_view_distance = [_new_view_distance_index] call FUNC(returnViewDistanceValue);
|
||||||
|
|
||||||
|
/*
|
||||||
|
hint format ["DEBUG: Player: %1 new view distance index: %2 new view distance value: %3",(name player),_new_view_distance_index,_new_view_distance];
|
||||||
|
diag_log format ["DEBUG: Player: %1 new view distance index: %2 new view distance value: %3",(name player),_new_view_distance_index,_new_view_distance];
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// To do: add a check against a sever or module top limit here.
|
||||||
|
|
||||||
|
if !GVAR(changeAllowed) then
|
||||||
|
{
|
||||||
|
hint "You cannot change the view distance!"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setViewDistance _new_view_distance;
|
||||||
|
};
|
24
addons/viewdistance/functions/fnc_initViewDistance.sqf
Normal file
24
addons/viewdistance/functions/fnc_initViewDistance.sqf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Author: Winter
|
||||||
|
* Sets the player's current view distance according to allowed values.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: View Distance Setting (SCALAR)
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [1500] call ace_common_fnc_imanexample
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
["SettingChanged",{
|
||||||
|
if (_this select 0 == QGVAR(newViewDistance)) then {
|
||||||
|
[] call FUNC(changeViewDistance);
|
||||||
|
};
|
||||||
|
},true] call ace_common_fnc_addEventHandler;
|
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Author: Winter
|
||||||
|
* Returns the view distance value according to the given index
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: View Distance Index (SCALAR)
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* View Distance (SCALAR)
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [2] call ace_viewdistance_fnc_returnViewDistanceValue;
|
||||||
|
*
|
||||||
|
* Public: Yes
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_index","_return"];
|
||||||
|
|
||||||
|
_index = _this select 0;
|
||||||
|
_return = 0;
|
||||||
|
|
||||||
|
switch (_index) do
|
||||||
|
{
|
||||||
|
case 0: {_return = 1500};
|
||||||
|
case 1: {_return = 2000};
|
||||||
|
case 2: {_return = 2500};
|
||||||
|
case 3: {_return = 3000};
|
||||||
|
case 4: {_return = 3500};
|
||||||
|
case 5: {_return = 4000};
|
||||||
|
case 6: {_return = 5000};
|
||||||
|
case 7: {_return = 6000};
|
||||||
|
case 8: {_return = 7000};
|
||||||
|
case 9: {_return = 8000};
|
||||||
|
case 10: {_return = 9000};
|
||||||
|
case 11: {_return = 10000};
|
||||||
|
default {hint "something broke!";};
|
||||||
|
};
|
||||||
|
|
||||||
|
_return;
|
Loading…
Reference in New Issue
Block a user