-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MCLOS - Add support for AI #10701
Merged
Merged
MCLOS - Add support for AI #10701
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,23 @@ | ||
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; | ||
GVAR(hasMCLOSControl) = 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,6 @@ | ||
class MissileLauncher; | ||
class GVAR(mock_w_Malyutka): MissileLauncher { | ||
displayName = "Test Malyutka"; | ||
magazineReloadTime=1; | ||
magazines[] = { 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
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 |
---|---|---|
|
@@ -16,16 +16,39 @@ | |
* Public: No | ||
*/ | ||
params ["", "_args"]; | ||
_args params ["_firedEH", "", "_flightParams"]; | ||
_firedEH params ["","","","","","","_projectile","_gunner"]; | ||
_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]]); | ||
|
||
private _accelerationDirection = _projectile vectorModelToWorldVisual (_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 _source = _projectile getVariable [QGVAR(source), _projectile]; | ||
PabstMirror marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private _hOffset = (_projectilePos # 2) - (_projectedPath # 2); | ||
private _vv = (velocity _projectile) # 2; | ||
_mclosInput = switch (true) do { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this doesn't support side-to-side travel |
||
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]; | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this only aims for the point the ai was aiming when they fired. if the target moves, this inherently misses. i think we could do something similar to SACLOS where we figure out the position the gunner is looking but as SACLOS shows that isn't easy. this is good for now, just wanted to note this