Laser - Add Individual Laser Code Digit Control (#9434)

* Initial Commit

* Use DIK Codes

* Update headers and dev code for new default frequency

---------
This commit is contained in:
LorenLuke 2023-10-02 10:29:38 -07:00 committed by GitHub
parent 3c9d7733e8
commit a5a8b5387a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 90 additions and 37 deletions

View File

@ -1,4 +1,5 @@
#include "script_component.hpp"
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
if (hasInterface) then {
#include "initKeybinds.sqf"

View File

@ -7,8 +7,8 @@ PREP_RECOMPILE_START;
PREP_RECOMPILE_END;
// Laser default variables
ACE_DEFAULT_LASER_CODE = 1111;
ACE_DEFAULT_LASER_WAVELENGTH = 1550;
ACE_DEFAULT_LASER_CODE = 1688;
ACE_DEFAULT_LASER_WAVELENGTH = 1064;
ACE_DEFAULT_LASER_BEAMSPREAD = 1;
GVAR(laserEmitters) = createHashMap;

View File

@ -18,7 +18,7 @@
// Dev Debug Function
// Displays lasers and attempts to lock on to codes 1111 and 1112 from a target vehicle's view
// Displays lasers and attempts to lock on to codes 1111 and 1688 from a target vehicle's view
// On Screen Debug:
// Red - Vanilla Laser Targets
// Yellow - Array (vehicle pos/weapon) Laser Targets
@ -31,14 +31,14 @@ private _testSeekerPosASL = _seekerVehicle modelToWorldVisualWorld [0,0,1];
private _testSeekerDir = vectorDirVisual _seekerVehicle;
{
private _code = _x;
private _results = [_testSeekerPosASL, _testSeekerDir, 45, 10000, [1550,1550], _code, _seekerVehicle] call FUNC(seekerFindLaserSpot);
private _results = [_testSeekerPosASL, _testSeekerDir, 45, 10000, [ACE_DEFAULT_LASER_WAVELENGTH, ACE_DEFAULT_LASER_WAVELENGTH], _code, _seekerVehicle] call FUNC(seekerFindLaserSpot);
private _resultPos = _results select 0;
if (!isNil "_resultPos") then {
// Draw lock results
drawLine3D [ASLtoAGL _testSeekerPosASL, ASLtoAGL _resultPos, [0,0,1,1]];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\select_target_ca.paa", [0,0,1,1], (ASLtoAGL _resultPos), 1.5, 1.5, 45, format ["%1 from %2", _code, _results select 1], 0.5, 0.025, "TahomaB"];
};
} forEach [1111, 1112]; // Scan at codes 1111 and 1112
} forEach [1111, ACE_DEFAULT_LASER_CODE]; // Scan at codes 1111 and 1688
// Draw all lasers

View File

@ -50,16 +50,27 @@ if (
) exitWith {false};
private _oldLaserCode = _currentShooter getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
private _newLaserCode = _oldLaserCode;
private _newLaserCode = 0;
// "Four-digit code equipment settings range from 1111 to 1788"
// While there is a 0 or 9 in code, keep adding change
if (((_codeChange < 0) && {_oldLaserCode > ACE_DEFAULT_LASER_CODE}) || {(_codeChange > 0) && {_oldLaserCode < 1788}}) then {
_newLaserCode = _oldLaserCode + _codeChange;
while {(((str _newLaserCode) find "0") >= 0) || {((str _newLaserCode) find "9") >= 0}} do {
_newLaserCode = _newLaserCode + _codeChange;
_codeChange = floor((_codeChange max 0) min 2);
private _placeValue = 10 ^ _codeChange;
private _oldDigit = (floor(_oldLaserCode / _placeValue)) % 10;
private _newDigit = _oldDigit + 1;
private _limit = 8;
if (_codeChange == 2) then {_limit = 7};
if (_newDigit > _limit) then {_newDigit = 1};
for "_i" from 0 to 3 step 1 do {
private _digit = floor(_oldLaserCode / (10 ^ _i)) mod 10;
if (_i == _codeChange) then {
_digit = _newDigit;
};
_newLaserCode = _newLaserCode + (_digit * 10 ^ _i);
};
TRACE_2("",_oldLaserCode,_newLaserCode);

View File

@ -7,7 +7,7 @@
* 0: Emitter <OBJECT>
* 1: Owner <OBJECT>
* 2: Method, can be code, which emitter and owner are passed to, a string function name, an array with a position memory point and weapon name, or an array with a position memory point, a vector begining memory point, and vector ending memory point. <STRING><CODE><ARRAY>
* 3: Wavelength (1550nm is common eye safe) <NUMBER>
* 3: Wavelength (1064nm is typical) <NUMBER>
* 4: Laser code <NUMBER>
* 5: Beam divergence (in mils off beam center) <NUMBER>
* 6: Method Args <ANY> (default: nil)
@ -16,8 +16,8 @@
* UUID for sending to laserOff function <STRING>
*
* Example:
* [hmg, hmg, [[0,0,1], "HMG_static"], 1550, 1111, 1] call ace_laser_fnc_laserOn
* [player, player, "ace_laser_fnc_findLaserSource", 1550, 1111, 1, ["pilot"]] call ace_laser_fnc_laserOn
* [hmg, hmg, [[0,0,1], "HMG_static"], 1064, 1688, 1] call ace_laser_fnc_laserOn
* [player, player, "ace_laser_fnc_findLaserSource", 1064, 1688, 1, ["pilot"]] call ace_laser_fnc_laserOn
*
* Public: No
*/

View File

@ -9,7 +9,7 @@
* 1: Direction vector (will be normalized) <ARRAY>
* 2: Seeker FOV in degrees <NUMBER>
* 3: Seeker max distance in meters <NUMBER>
* 4: Seeker wavelength sensitivity range, [1550,1550] is common eye safe <ARRAY>
* 4: Seeker wavelength sensitivity range, [1064,1064] is common <ARRAY>
* 5: Seeker laser code. <NUMBER>
* 6: Ignore 1 (e.g. Player's vehicle) <OBJECT> (default: objNull)
* 7: Ignore 2 (e.g. Attached object) <OBJECT> (default: objNull)
@ -19,7 +19,7 @@
* [Strongest compatible laser spot ASL pos, owner object] Nil array values if nothing found <ARRAY>
*
* Example:
* [getPosASL player, [0,1,0], 90, [1500, 1500], 1111, player] call ace_laser_fnc_seekerFindLaserSpot
* [getPosASL player, [0,1,0], 90, [1064, 1064], 1688, player] call ace_laser_fnc_seekerFindLaserSpot
*
* Public: No
*/

View File

@ -1,16 +1,23 @@
["ACE3 Equipment", QGVAR(LaserCodeUp), localize LSTRING(laserCodeUp),
["ACE3 Equipment", QGVAR(LaserCodeUpHundreds), localize LSTRING(laserCodeUpHundreds),
{
[2] call FUNC(keyLaserCodeChange);
},
{false},
[DIK_Q, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+Q)
["ACE3 Equipment", QGVAR(LaserCodeUpTens), localize LSTRING(laserCodeUpTens),
{
[1] call FUNC(keyLaserCodeChange);
},
{false},
[16, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+Q)
[DIK_W, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+W)
["ACE3 Equipment", QGVAR(LaserCodeDown), localize LSTRING(laserCodeDown),
["ACE3 Equipment", QGVAR(LaserCodeUpOnes), localize LSTRING(laserCodeUpOnes),
{
[-1] call FUNC(keyLaserCodeChange);
[0] call FUNC(keyLaserCodeChange);
},
{false},
[18, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+E)
[DIK_E, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+E)

View File

@ -51,22 +51,56 @@
<Chinese>雷射碼</Chinese>
<Turkish>Lazer Kod</Turkish>
</Key>
<Key ID="STR_ACE_Laser_laserCodeUp">
<English>Laser - Cycle Code Up</English>
<German>Lasercode +</German>
<Polish>Laser - Następny kod</Polish>
<French>Code laser +</French>
<Russian>Лазер - увеличить частоту</Russian>
<Portuguese>Laser - Alternar Código para Cima</Portuguese>
<Hungarian>Lézer - kódciklus növelése</Hungarian>
<Spanish>Láser - Aumentar código</Spanish>
<Czech>Laser - Kód +</Czech>
<Italian>Laser - Cambia codice +</Italian>
<Japanese>レーザ - コードの数値を増やす</Japanese>
<Korean>레이저 - 코드 순환 위</Korean>
<Chinesesimp>激光—循环切换激光码 上</Chinesesimp>
<Chinese>雷射 - 循環切換雷射碼 上</Chinese>
<Turkish>Lazer - Çevrim Kodu Yukarı</Turkish>
<Key ID="STR_ACE_Laser_laserCodeUpOnes">
<English>Laser - Cycle Code Up - XXX#</English>
<German>Lasercode +XXX#</German>
<Polish>Laser - Następny kod - XXX#</Polish>
<French>Code laser +XXX#</French>
<Russian>Лазер - увеличить частоту - XXX#</Russian>
<Portuguese>Laser - Alternar Código para Cima - XXX#</Portuguese>
<Hungarian>Lézer - kódciklus növelése - XXX#</Hungarian>
<Spanish>Láser - Aumentar código - XXX#</Spanish>
<Czech>Laser - Kód +XXX#</Czech>
<Italian>Laser - Cambia codice - XXX#</Italian>
<Japanese>レーザ - コードの数値を増やす - XXX#</Japanese>
<Korean>레이저 - 코드 순환 위 - XXX#</Korean>
<Chinesesimp>激光—循环切换激光码 上 - XXX#</Chinesesimp>
<Chinese>雷射 - 循環切換雷射碼 上 - XXX#</Chinese>
<Turkish>Lazer - Çevrim Kodu Yukarı - XXX#</Turkish>
</Key>
<Key ID="STR_ACE_Laser_laserCodeUpTens">
<English>Laser - Cycle Code Up - XX#X</English>
<German>Lasercode +XX#X</German>
<Polish>Laser - Następny kod - XX#X</Polish>
<French>Code laser +XX#X</French>
<Russian>Лазер - увеличить частоту - XX#X</Russian>
<Portuguese>Laser - Alternar Código para Cima - XX#X</Portuguese>
<Hungarian>Lézer - kódciklus növelése - XX#X</Hungarian>
<Spanish>Láser - Aumentar código - 1##X</Spanish>
<Czech>Laser - Kód +XX#X</Czech>
<Italian>Laser - Cambia codice - XX#X</Italian>
<Japanese>レーザ - コードの数値を増やす - XX#X</Japanese>
<Korean>레이저 - 코드 순환 위 - 1##X</Korean>
<Chinesesimp>激光—循环切换激光码 上 - XX#X</Chinesesimp>
<Chinese>雷射 - 循環切換雷射碼 上 - XX#X</Chinese>
<Turkish>Lazer - Çevrim Kodu Yukarı - XX#X</Turkish>
</Key>
<Key ID="STR_ACE_Laser_laserCodeUpHundreds">
<English>Laser - Cycle Code Up - X#XX</English>
<German>Lasercode +X#XX</German>
<Polish>Laser - Następny kod - X#XX</Polish>
<French>Code laser +X#XX</French>
<Russian>Лазер - увеличить частоту - X#XX</Russian>
<Portuguese>Laser - Alternar Código para Cima - X#XX</Portuguese>
<Hungarian>Lézer - kódciklus növelése - X#XX</Hungarian>
<Spanish>Láser - Aumentar código - X#XX</Spanish>
<Czech>Laser - Kód +X#XX</Czech>
<Italian>Laser - Cambia codice - X#XX</Italian>
<Japanese>レーザ - コードの数値を増やす - X#XX</Japanese>
<Korean>레이저 - 코드 순환 위 - X#XX</Korean>
<Chinesesimp>激光—循环切换激光码 上 - X#XX</Chinesesimp>
<Chinese>雷射 - 循環切換雷射碼 上 - X#XX</Chinese>
<Turkish>Lazer - Çevrim Kodu Yukarı - X#XX</Turkish>
</Key>
<Key ID="STR_ACE_Laser_laserCodeDown">
<English>Laser - Cycle Code Down</English>