mclos updates

This commit is contained in:
Bailey Danyluk 2024-08-30 00:25:43 -06:00
parent 16efd49c8d
commit db39416cb6
4 changed files with 30 additions and 25 deletions

View File

@ -1,44 +1,40 @@
#include "script_component.hpp"
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
[QGVAR(handoff), LINKFUNC(handleHandoff)] call CBA_fnc_addEventHandler;
["ACE3 Weapons", QGVAR(cycleFireMode), LLSTRING(CycleFireMode), {
[] call FUNC(cycleAttackProfileKeyDown);
false
[] call FUNC(cycleAttackProfileKeyDown)
}, {
},
[15, [false, true, false]], false] call CBA_fnc_addKeybind; //Ctrl+Tab Key
[DIK_TAB, [false, true, false]], false] call CBA_fnc_addKeybind; //Ctrl+Tab Key
// Each MCLOS argument is the vector which acceleration will be applied
["ACE3 Weapons", QGVAR(mclosUp), LLSTRING(mclosUp), {
[[0, 0, 1], ACE_player] call FUNC(mclosButtonPressed);
false
[[0, 0, 1], ACE_player] call FUNC(mclosButtonPressed)
}, {
[[0, 0, -1], ACE_player] call FUNC(mclosButtonPressed);
[[0, 0, -1], ACE_player] call FUNC(mclosButtonPressed)
},
[0x48, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 8
[DIK_NUMPAD8, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 8
["ACE3 Weapons", QGVAR(mclosDown), LLSTRING(mclosDown), {
[[0, 0, -1], ACE_player] call FUNC(mclosButtonPressed);
false
[[0, 0, -1], ACE_player] call FUNC(mclosButtonPressed)
}, {
[[0, 0, 1], ACE_player] call FUNC(mclosButtonPressed);
[[0, 0, 1], ACE_player] call FUNC(mclosButtonPressed)
},
[0x50, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 2
[DIK_NUMPAD2, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 2
["ACE3 Weapons", QGVAR(mclosLeft), LLSTRING(mclosLeft), {
[[1, 0, 0], ACE_player] call FUNC(mclosButtonPressed);
false
[[1, 0, 0], ACE_player] call FUNC(mclosButtonPressed)
}, {
[[-1, 0, 0], ACE_player] call FUNC(mclosButtonPressed);
[[-1, 0, 0], ACE_player] call FUNC(mclosButtonPressed)
},
[0x4D, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 6
[DIK_NUMPAD6, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 6
["ACE3 Weapons", QGVAR(mclosRight), LLSTRING(mclosRight), {
[[-1, 0, 0], ACE_player] call FUNC(mclosButtonPressed);
false
[[-1, 0, 0], ACE_player] call FUNC(mclosButtonPressed)
}, {
[[1, 0, 0], ACE_player] call FUNC(mclosButtonPressed);
[[1, 0, 0], ACE_player] call FUNC(mclosButtonPressed)
},
[0x4B, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 4
[DIK_NUMPAD4, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 4

View File

@ -18,3 +18,4 @@ params ["_firedEH", "", "", "", "_stateParams"];
_firedEH params ["_shooter","_weapon","","","","","_projectile"];
_stateParams params ["", "_seekerStateParams"];
_projectile setVariable [QGVAR(source), vehicle _shooter];

View File

@ -8,7 +8,7 @@
* 1: Unit <OBJECT>
*
* Return Value:
* None
* If the button is pressed with an MCLOS context
*
* Example:
* [[0, 0, 1], player] call ace_missileguidance_fnc_mclosButtonPressed
@ -20,10 +20,17 @@ private _projectiles = _player getVariable [QGVAR(MCLOS_Projectiles), []];
_projectiles = _projectiles select { !isNull _x };
_player setVariable [QGVAR(MCLOS_Projectiles), _projectiles];
if (getNumber ((configOf vehicle _player) >> QGVAR(hasMCLOSControl) == 1) then {
private _inMclosControlled = false;
private _shooter = vehicle _player;
if (getNumber ((configOf _shooter) >> QGVAR(hasMCLOSControl) == 1) then {
playSound "ACE_Sound_Click";
private _currentDirection = _shooter getVariable [QGVAR(MCLOS_direction), [0, 0, 0]];
// Send direction across network for non-local projectiles
// This is the case in a wanted development for a proper Malyutka implementation
_shooter setVariable [QGVAR(MCLOS_direction), _currentDirection vectorAdd _accelerationDirection, true];
_inMclosControlled = true;
};
private _currentDirection = _player getVariable [QGVAR(MCLOS_direction), [0, 0, 0]];
_player setVariable [QGVAR(MCLOS_direction), _currentDirection vectorAdd _accelerationDirection];
_inMclosControlled

View File

@ -21,8 +21,9 @@ _firedEH params ["","","","","","","_projectile","_gunner"];
_flightParams params ["_pitchRate", "_yawRate"];
private _projectilePos = getPosASLVisual _projectile;
private _source = _projectile getVariable [QGVAR(source), _projectile];
private _accelerationDirection = _projectile vectorModelToWorldVisual (_gunner getVariable [QGVAR(MCLOS_direction), [0, 0, 0]]);
private _accelerationDirection = _projectile vectorModelToWorldVisual (_source getVariable [QGVAR(MCLOS_direction), [0, 0, 0]]);
private _returnPos = _projectilePos vectorAdd (_accelerationDirection vectorMultiply (_pitchRate max _yawRate));
_targetData set [0, _projectilePos vectorFromTo _returnPos];