future proof MCLOS

This commit is contained in:
Bailey Danyluk 2024-08-30 00:30:41 -06:00
parent db39416cb6
commit c5e2eb9814
2 changed files with 19 additions and 7 deletions

View File

@ -18,4 +18,10 @@ params ["_firedEH", "", "", "", "_stateParams"];
_firedEH params ["_shooter","_weapon","","","","","_projectile"];
_stateParams params ["", "_seekerStateParams"];
_projectile setVariable [QGVAR(source), vehicle _shooter];
private _source = vehicle _shooter;
private _controlled = _source getVariable [QGVAR(mclos_projectiles), []];
_controlled pushBack _projectile;
_source setVariable [QGVAR(mclos_projectiles), _controlled];
_projectile setVariable [QGVAR(source), _source];

View File

@ -15,10 +15,8 @@
*
* Public: No
*/
params ["_accelerationDirection", "_player"];
private _projectiles = _player getVariable [QGVAR(MCLOS_Projectiles), []];
_projectiles = _projectiles select { !isNull _x };
_player setVariable [QGVAR(MCLOS_Projectiles), _projectiles];
private _inMclosControlled = false;
@ -27,10 +25,18 @@ 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
// Send data across network for handling non-local projectiles
// This is the case in a wanted development for a proper Malyutka implementation where projectiles will
// have their locality change via script
_shooter setVariable [QGVAR(MCLOS_direction), _currentDirection vectorAdd _accelerationDirection, true];
_inMclosControlled = true;
// Shouldn't have too many projectiles sent across the network. Planned max is 4 at a time
private _controlled = _shooter getVariable [QGVAR(mclos_projectiles), []];
_controlled = _controlled select { !isNull _x };
_shooter setVariable [QGVAR(mclos_projectiles), _controlled, true];
// if we are controlling missiles, we want the input to be captured
_inMclosControlled = _controlled isNotEqualTo [];
};
_inMclosControlled