This commit is contained in:
johnb432 2024-07-20 21:51:11 +02:00
parent 4f726d6bc0
commit 1321c03a6e
14 changed files with 30 additions and 30 deletions

View File

@ -1,4 +1,4 @@
class CfgIRLaserSettings {
laserMaxRange = 3000; // 4000 is max range of the laser in engine
laserMaxRange = LASER_MAX; // 4000 is max range of the laser in engine
maxViewDistance = 6000;
};

View File

@ -1,5 +1,3 @@
class CBA_Extended_EventHandlers_base;
class CfgVehicles {
class AllVehicles;
class Air: AllVehicles {
@ -10,8 +8,8 @@ class CfgVehicles {
property = QGVAR(enabled);
control = "Checkbox";
typeName = "BOOL";
expression = QUOTE(_this setVariable [ARR_3('GVAR(enabled)',_value,true)]);
defaultValue = "(true)";
expression = QUOTE(_this setVariable [ARR_3(QQGVAR(enabled),_value,true)]);
defaultValue = "true";
condition = "objectVehicle";
};
};

View File

@ -2,19 +2,22 @@
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
// Events
[QGVAR(laserOn), FUNC(onLaserOn)] call CBA_fnc_addEventHandler;
[QGVAR(laserOff), FUNC(onLaserOff)] call CBA_fnc_addEventHandler;
[QGVAR(laserOn), LINKFUNC(onLaserOn)] call CBA_fnc_addEventHandler;
[QGVAR(laserOff), LINKFUNC(onLaserOff)] call CBA_fnc_addEventHandler;
// Keybinds
["ACE3 Vehicles", QGVAR(toggleLaser), localize LSTRING(ToggleLaser), {
["ACE3 Vehicles", QGVAR(toggleLaser), LLSTRING(ToggleLaser), {
// Ignore when in Zeus
if (!isNull curatorCamera) exitWith {};
private _vehicle = cameraOn;
if !(_vehicle getVariable [QGVAR(enabled), false]) exitWith {false};
private _controlledUnit = [ACE_player, ACE_controlledUAV#1] select unitIsUAV _vehicle;
private _controlledUnit = [ACE_player, ACE_controlledUAV # 1] select (unitIsUAV _vehicle);
private _canTurnOn = if (_vehicle getVariable [QGVAR(useTurret), false]) then {
private _turretInfo = _vehicle getVariable [QGVAR(turretInfo), []];
_controlledUnit == _vehicle turretUnit _turretInfo#0
_controlledUnit == _vehicle turretUnit _turretInfo # 0
} else {
_controlledUnit == driver _vehicle
};

View File

@ -6,7 +6,7 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
#include "initSettings.sqf"
#include "initSettings.inc.sqf"
GVAR(lasers) = [];
GVAR(localLasers) = [];

View File

@ -1,4 +1,4 @@
#include "script_component.hpp"
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Finds the turret that has control over the marking laser.
@ -34,7 +34,7 @@ private _walkTurrets = {
// Check if turret has a optics with night or thermal vision
private _visionModes = flatten (("true" configClasses (_x >> "OpticsIn")) apply {
(getArray (_x >> "visionMode")) apply {toLower _x}
(getArray (_x >> "visionMode")) apply {toLowerANSI _x}
});
if !("nvg" in _visionModes || {"ti" in _visionModes}) then {

View File

@ -1,4 +1,4 @@
#include "script_component.hpp"
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Calculates the directional vector of a pilot camera mounted marking laser.

View File

@ -1,4 +1,4 @@
#include "script_component.hpp"
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Calculates the directional vector of a turret mounted marking laser.
@ -21,7 +21,7 @@ private _turretInfo = _aircraft getVariable [QGVAR(turretInfo), []];
_turretInfo params ["_turretPath", "_animationSources", "_followFreeLook"];
private _controlledTurret = if (unitIsUAV cameraOn) then {
ACE_controlledUAV#2
ACE_controlledUAV # 2
} else {
cameraOn unitTurret ACE_player
};
@ -31,8 +31,8 @@ if ((cameraOn == _aircraft) && {(_followFreeLook && {cameraView == "INTERNAL"})
(AGLToASL positionCameraToWorld [0, 0, 0]) vectorFromTo (AGLToASL positionCameraToWorld [0, 0, 1])
} else {
// Get turret dir through animation source
private _angleBody = -deg(_aircraft animationPhase _animationSources#0);
private _angleGun = deg(_aircraft animationPhase _animationSources#1);
private _angleBody = -deg (_aircraft animationPhase _animationSources # 0);
private _angleGun = deg (_aircraft animationPhase _animationSources # 1);
_aircraft vectorModelToWorld ([1, _angleBody, _angleGun] call CBA_fnc_polar2vect)
};

View File

@ -1,4 +1,4 @@
#include "script_component.hpp"
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Equips an aircraft with a marking laser.

View File

@ -1,4 +1,4 @@
#include "script_component.hpp"
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Handles a plane turning its marking laser on.

View File

@ -1,4 +1,4 @@
#include "script_component.hpp"
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Handles a plane turning its marking laser off.
@ -19,14 +19,14 @@ params ["_aircraft"];
// Start PFHs if this is the first laser
if (local _aircraft && {GVAR(updatePFH) == -1}) then {
GVAR(updatePFH) = [FUNC(updatePFH), 1, []] call CBA_fnc_addPerFrameHandler;
GVAR(updatePFH) = [LINKFUNC(updatePFH), 1, []] call CBA_fnc_addPerFrameHandler;
// Make sure update is called before first render
[] call FUNC(updatePFH);
};
if (hasInterface && {GVAR(renderPFH) == -1}) then {
GVAR(renderPFH) = [FUNC(renderPFH), 0, []] call CBA_fnc_addPerFrameHandler;
GVAR(renderPFH) = [LINKFUNC(renderPFH), 0, []] call CBA_fnc_addPerFrameHandler;
};
GVAR(lasers) pushBack _aircraft;

View File

@ -1,4 +1,4 @@
#include "script_component.hpp"
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Renders all marking lasers.
@ -18,7 +18,7 @@
if (GVAR(lasers) isEqualTo []) exitWith {};
#ifndef DEBUG_MODE_FULL
private _controlledUnit = [ACE_player, ACE_controlledUAV#1] select unitIsUAV cameraOn;
private _controlledUnit = [ACE_player, ACE_controlledUAV # 1] select (unitIsUAV cameraOn);
if (currentVisionMode _controlledUnit != 1 && {
(!isNull curatorCamera) && {
(_curator getVariable ["BIS_fnc_curatorVisionModes_current", 0]) != 0
@ -41,12 +41,12 @@ if (currentVisionMode _controlledUnit != 1 && {
// 0.1 is added to calculated values, seems to be slightly inaccurate
_gimbalLimits params ["_minDir", "_maxDir", "_minElev", "_maxElev"];
private _modelVector = _aircraft vectorWorldToModelVisual _vector;
private _dir = _modelVector#0 atan2 _modelVector#1;
private _dir = _modelVector # 0 atan2 _modelVector # 1;
if (_dir < _minDir - 0.1 || {_dir > _maxDir + 0.1}) then {
continue;
};
private _elevation = _modelVector#2 atan2 vectorMagnitude [_modelVector#0, _modelVector#1, 0];
private _elevation = _modelVector # 2 atan2 vectorMagnitude [_modelVector # 0, _modelVector # 1, 0];
if (_elevation < _minElev - 0.1 || {_elevation > _maxElev + 0.1}) then {
continue;
};

View File

@ -1,4 +1,4 @@
#include "script_component.hpp"
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Sends network updates for all local marking lasers.

View File

@ -1 +0,0 @@
#include "\z\ace\addons\markinglaser\script_component.hpp"

View File

@ -4,5 +4,5 @@
[LSTRING(Setting_Enabled_DisplayName), LSTRING(Setting_Enabled_Description)],
ELSTRING(common,ACEKeybindCategoryVehicles),
true,
true
1
] call CBA_fnc_addSetting;