mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Optional setting to disable laser pointer system
This commit is contained in:
parent
d8877d0dbd
commit
b960ae5d6b
6
addons/laserpointer/ACE_Settings.hpp
Normal file
6
addons/laserpointer/ACE_Settings.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
class ACE_Settings {
|
||||
class GVAR(enabled) {
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
};
|
@ -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);
|
||||
|
@ -12,6 +12,7 @@ class CfgPatches {
|
||||
};
|
||||
};
|
||||
|
||||
#include "ACE_Settings.hpp"
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
|
@ -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 {};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user