Optional setting to disable laser pointer system

This commit is contained in:
PabstMirror 2015-06-12 00:58:04 -05:00
parent d8877d0dbd
commit b960ae5d6b
4 changed files with 36 additions and 22 deletions

View File

@ -0,0 +1,6 @@
class ACE_Settings {
class GVAR(enabled) {
typeName = "BOOL";
value = 1;
};
};

View File

@ -14,26 +14,28 @@ if !(hasInterface) exitWith {};
GVAR(nearUnits) = [];
// @todo. Maybe move to common?
[{
private "_nearUnits";
_nearUnits = [];
{
_nearUnits append crew _x;
if (count _nearUnits > 10) exitWith {
_nearUnits resize 10;
};
} forEach nearestObjects [positionCameraToWorld [0,0,0], ["AllVehicles"], 50]; // when moving this, search also for units inside vehicles. currently breaks the laser in FFV
GVAR(nearUnits) = _nearUnits;
} , 5, []] call CBA_fnc_addPerFrameHandler;
addMissionEventHandler ["Draw3D", {
call FUNC(onDraw);
}];
#include "initKeybinds.sqf"
["SettingsInitialized", {
//If not enabled, dont't add draw eventhandler or PFEH (for performance)
if (!GVAR(enabled)) exitWith {};
// @todo. Maybe move to common?
[{
private "_nearUnits";
_nearUnits = [];
{
_nearUnits append crew _x;
if (count _nearUnits > 10) exitWith {
_nearUnits resize 10;
};
} forEach nearestObjects [positionCameraToWorld [0,0,0], ["AllVehicles"], 50]; // when moving this, search also for units inside vehicles. currently breaks the laser in FFV
GVAR(nearUnits) = _nearUnits;
} , 5, []] call CBA_fnc_addPerFrameHandler;
addMissionEventHandler ["Draw3D", {
call FUNC(onDraw);
}];
}] call EFUNC(common,addEventHandler);

View File

@ -12,6 +12,7 @@ class CfgPatches {
};
};
#include "ACE_Settings.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

View File

@ -37,6 +37,11 @@ _nextPointer = getText (_config >> "ACE_nextModeClass");
if (_nextPointer == "") exitWith {};
//If system disabled, don't switch to a laser:
private "_nextPointerIsLaser";
_nextPointerIsLaser = getNumber (configFile >> "CfgWeapons" >> _nextPointer >> "ACE_laserpointer");
if ((!GVAR(enabled)) && {_nextPointerIsLaser == 1}) exitWith {};
// disable inheritance for this entry, because addons claim this as a base class for convenience
if !((_config >> "ACE_nextModeClass") in configProperties [_config, "true", false]) exitWith {};