-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into missile_sdb
- Loading branch information
Showing
19 changed files
with
268 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,4 +57,8 @@ class CfgAmmo { | |
enabled = 1; | ||
}; | ||
}; | ||
|
||
#ifdef CREATE_MOCK_PLATFORMS | ||
#include "dev\mock_ammo.hpp" | ||
#endif | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class M_Titan_AA_static; | ||
class GVAR(mock_a_Malyutka): M_Titan_AA_static { | ||
aiAmmoUsageFlags="64 + 128 + 256 + 512"; | ||
weaponLockSystem = 0; | ||
airLock = 0; | ||
lockType = 0; | ||
manualControl = 0; | ||
thrust = 80; | ||
maxSpeed = 100; | ||
airFriction = 0.5; | ||
sideairfriction = 0.14; | ||
class ADDON: GVAR(type_Malyutka) { | ||
enabled = 1; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class 1Rnd_GAA_missiles; | ||
class GVAR(mock_m_Malyutka): 1Rnd_GAA_missiles { | ||
ammo = QGVAR(mock_a_Malyutka); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class CfgVehicles { | ||
class Car_F; | ||
class LSV_02_base_F: Car_F { | ||
class Turrets; | ||
}; | ||
class LSV_02_AT_base_F: LSV_02_base_F { | ||
class Turrets: Turrets { | ||
class MainTurret; | ||
}; | ||
}; | ||
class O_LSV_02_AT_F: LSV_02_AT_base_F {}; | ||
class GVAR(mock_lsv_Malyutka): O_LSV_02_AT_F { | ||
scope = 1; | ||
displayName = "[ACE] Test Malyutka LSV"; | ||
class Turrets: Turrets { | ||
class MainTurret: MainTurret { | ||
weapons[] = { QGVAR(mock_w_Malyutka) }; | ||
magazines[] = { QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka), QGVAR(mock_m_Malyutka) }; | ||
}; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class MissileLauncher; | ||
class GVAR(mock_w_Malyutka): MissileLauncher { | ||
displayName = "Test Malyutka"; | ||
GVAR(hasMCLOSControl) = 1; | ||
magazineReloadTime=1; | ||
magazines[] = { QGVAR(mock_m_Malyutka) }; | ||
}; |
44 changes: 44 additions & 0 deletions
44
addons/missileguidance/functions/fnc_MCLOS_buttonPressed.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: tcvm | ||
* Handles MCLOS guidance via keyboard keys | ||
* | ||
* Arguments: | ||
* 0: Acceleration vector <ARRAY> | ||
* 1: Unit <OBJECT> | ||
* | ||
* Return Value: | ||
* If the button is pressed with an MCLOS context | ||
* | ||
* Example: | ||
* [[0, 0, 1], player] call ace_missileguidance_fnc_MCLOS_buttonPressed | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_accelerationDirection", "_player"]; | ||
|
||
private _shooter = vehicle _player; | ||
if (_player == _shooter) exitWith {}; | ||
private _turret = _shooter unitTurret _player; | ||
|
||
if (((_shooter weaponsTurret _turret) findIf { | ||
(getNumber (configFile >> "CfgWeapons" >> _x >> QGVAR(hasMCLOSControl))) == 1 | ||
}) == -1) exitWith { false }; | ||
|
||
|
||
playSound "ACE_Sound_Click_20db"; | ||
|
||
private _currentDirection = _shooter getVariable [QGVAR(MCLOS_direction), [0, 0, 0]]; | ||
// 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]; | ||
|
||
// 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 | ||
_controlled isNotEqualTo [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: tcvm | ||
* Sets up MCLOS state arrays (called from missileGuidance's onFired). | ||
* | ||
* Arguments: | ||
* Guidance Arg Array <ARRAY> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [] call ace_missileguidance_fnc_MCLOS_onFired | ||
* | ||
* Public: No | ||
*/ | ||
params ["_firedEH", "", "", "", "_stateParams"]; | ||
_firedEH params ["_shooter","_weapon","","","","","_projectile", "_gunner"]; | ||
|
||
if !(_gunner call EFUNC(common,isPlayer)) then { | ||
// AI shot - save shot info (ToDo: Handle offset for optics/launch dir?) | ||
// _stateParams params ["", "_seekerStateParams"]; | ||
_stateParams set [1, [getPosASLVisual _projectile, vectorNormalized velocity _projectile]]; | ||
}; | ||
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]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: tcvm | ||
* MCLOS seeker | ||
* | ||
* Arguments: | ||
* 1: Guidance Arg Array <ARRAY> | ||
* 2: Seeker State <ARRAY> | ||
* | ||
* Return Value: | ||
* Position of wanted missile pos relative to the camera direction <ARRAY> | ||
* | ||
* Example: | ||
* [] call ace_missileguidance_fnc_seekerType_MCLOS | ||
* | ||
* Public: No | ||
*/ | ||
params ["", "_args"]; | ||
_args params ["_firedEH", "", "_flightParams", "", "_stateParams"]; | ||
_firedEH params ["_shooter","","","","","","_projectile","_gunner"]; | ||
_flightParams params ["_pitchRate", "_yawRate"]; | ||
_stateParams params ["", "_seekerStateParams"]; | ||
|
||
private _projectilePos = getPosASLVisual _projectile; | ||
private _source = _projectile getVariable [QGVAR(source), _projectile]; | ||
private _mclosInput = (_source getVariable [QGVAR(MCLOS_direction), [0, 0, 0]]); | ||
|
||
if (_seekerStateParams isNotEqualTo []) then { // Handle AI | ||
_seekerStateParams params ["_launchPos", "_launchVec"]; | ||
if (!(alive _shooter && {alive _gunner} && {(vehicle _gunner) == _shooter} && {_gunner call EFUNC(common,isAwake)})) exitWith {}; | ||
|
||
private _distance = _launchPos vectorDistance _projectilePos; | ||
private _projectedPath = _launchPos vectorAdd (_launchVec vectorMultiply _distance); | ||
|
||
private _hOffset = (_projectilePos # 2) - (_projectedPath # 2); | ||
private _vv = (velocity _projectile) # 2; | ||
_mclosInput = switch (true) do { | ||
case (_hOffset < 0): { [0, 0, 1] }; // gross h adjust | ||
case (_hOffset > 50): { [0, 0, -1] }; | ||
case ((_hOffset + 2 * _vv) < 0): { [0, 0, 1] }; // gross v adjust | ||
case ((_hOffset + 2 * _vv) > 10): { [0, 0, -1] }; | ||
case ((_hOffset + _vv) > 5): { [0, 0, -1] }; // fine v adjust | ||
default { [0, 0, 0] }; | ||
}; | ||
}; | ||
|
||
private _accelerationDirection = _projectile vectorModelToWorldVisual _mclosInput; | ||
private _returnPos = _projectilePos vectorAdd (_accelerationDirection vectorMultiply (_pitchRate max _yawRate)); | ||
|
||
//IGNORE_PRIVATE_WARNING["_targetData"] | ||
_targetData set [0, _projectilePos vectorFromTo _returnPos]; | ||
_targetData set [2, _returnPos distance _projectilePos]; | ||
|
||
_returnPos | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters