mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added and enabled AMG for AI.
This commit is contained in:
parent
ef6d090238
commit
ad95105508
@ -6,4 +6,11 @@ class ACE_Settings {
|
|||||||
displayName = "$STR_ACE_MissileGuidance";
|
displayName = "$STR_ACE_MissileGuidance";
|
||||||
description = "$STR_ACE_MissileGuidance_Desc";
|
description = "$STR_ACE_MissileGuidance_Desc";
|
||||||
};
|
};
|
||||||
|
class GVAR(enabledForAI) {
|
||||||
|
value = 1;
|
||||||
|
typeName = "BOOL";
|
||||||
|
isClientSetable = 1;
|
||||||
|
displayName = "$STR_ACE_MissileGuidance_AI";
|
||||||
|
description = "$STR_ACE_MissileGuidance_AI_Desc";
|
||||||
|
};
|
||||||
};
|
};
|
@ -12,6 +12,12 @@ class Extended_PostInit_EventHandlers {
|
|||||||
|
|
||||||
class Extended_FiredBIS_EventHandlers {
|
class Extended_FiredBIS_EventHandlers {
|
||||||
class All {
|
class All {
|
||||||
ADDON = QUOTE(_this call FUNC(fired));
|
ADDON = QUOTE(_this call FUNC(onFired));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class Extended_IncomingMissile_EventHandlers {
|
||||||
|
class All {
|
||||||
|
ADDON = QUOTE(_this call FUNC(onIncomingMissile));
|
||||||
};
|
};
|
||||||
};
|
};
|
@ -7,7 +7,8 @@ PREP(changeMissileDirection);
|
|||||||
PREP(checkSeekerAngle);
|
PREP(checkSeekerAngle);
|
||||||
PREP(checkLos);
|
PREP(checkLos);
|
||||||
|
|
||||||
PREP(fired);
|
PREP(onFired);
|
||||||
|
PREP(onIncomingMissile);
|
||||||
|
|
||||||
PREP(guidancePFH);
|
PREP(guidancePFH);
|
||||||
PREP(doAttackProfile);
|
PREP(doAttackProfile);
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
// Bail if guidance is disabled
|
// Bail if guidance is disabled
|
||||||
if(!GVAR(enabled)) exitWith { false };
|
|
||||||
|
|
||||||
// Bail on locality of the projectile, it should be local to us
|
// Bail on locality of the projectile, it should be local to us
|
||||||
if(!local _projectile) exitWith { false };
|
if(!GVAR(enabled) || {!local _projectile} ) exitWith { false };
|
||||||
|
|
||||||
|
if(!GVAR(enableForAI) && {!isPlayer _shooter} ) exitWith { false };
|
||||||
|
|
||||||
private["_config", "_enabled", "_target", "_seekerType", "_attackProfile"];
|
private["_config", "_enabled", "_target", "_seekerType", "_attackProfile"];
|
||||||
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
||||||
@ -20,10 +20,13 @@ _enabled = getNumber ( _config >> "enabled");
|
|||||||
if(isNil "_enabled" || {_enabled != 1}) exitWith { false };
|
if(isNil "_enabled" || {_enabled != 1}) exitWith { false };
|
||||||
|
|
||||||
_target = (vehicle _shooter) getVariable [QGVAR(target), nil];
|
_target = (vehicle _shooter) getVariable [QGVAR(target), nil];
|
||||||
|
_targetPos = (vehicle _shooter) getVariable [QGVAR(targetPosition), nil];
|
||||||
_seekerType = (vehicle _shooter) getVariable [QGVAR(seekerType), nil];
|
_seekerType = (vehicle _shooter) getVariable [QGVAR(seekerType), nil];
|
||||||
_attackProfile = (vehicle _shooter) getVariable [QGVAR(attackProfile), nil];
|
_attackProfile = (vehicle _shooter) getVariable [QGVAR(attackProfile), nil];
|
||||||
_lockMode = (vehicle _shooter) getVariable [QGVAR(lockMode), nil];
|
_lockMode = (vehicle _shooter) getVariable [QGVAR(lockMode), nil];
|
||||||
|
|
||||||
|
_launchPos = getPosASL (vehicle _shooter);
|
||||||
|
|
||||||
TRACE_3("Begin guidance", _target, _seekerType, _attackProfile);
|
TRACE_3("Begin guidance", _target, _seekerType, _attackProfile);
|
||||||
|
|
||||||
if ( isNil "_seekerType" || { ! ( _seekerType in (getArray (_config >> "seekerTypes" ) ) ) } ) then {
|
if ( isNil "_seekerType" || { ! ( _seekerType in (getArray (_config >> "seekerTypes" ) ) ) } ) then {
|
||||||
@ -38,21 +41,28 @@ if ( isNil "_lockMode" || { ! ( _lockMode in (getArray (_config >> "seekerLockMo
|
|||||||
|
|
||||||
// If we didn't get a target, try to fall back on tab locking
|
// If we didn't get a target, try to fall back on tab locking
|
||||||
if(isNil "_target") then {
|
if(isNil "_target") then {
|
||||||
_canUseLock = getNumber (_config >> "canVanillaLock");
|
|
||||||
if(_canUseLock > 0) then {
|
if(!isPlayer _shooter) then {
|
||||||
// @TODO: Get vanilla target
|
// This was an AI shot, lets still guide it on the AI target
|
||||||
_vanillaTarget = cursorTarget;
|
_target = _shooter getVariable[QGVAR(vanilla_target), nil];
|
||||||
|
TRACE_1("Detected AI Shooter!", _target);
|
||||||
TRACE_1("Using Vanilla Locking", _vanillaTarget);
|
} else {
|
||||||
if(!isNil "_vanillaTarget") then {
|
_canUseLock = getNumber (_config >> "canVanillaLock");
|
||||||
_target = _vanillaTarget;
|
if(_canUseLock > 0) then {
|
||||||
|
// @TODO: Get vanilla target
|
||||||
|
_vanillaTarget = cursorTarget;
|
||||||
|
|
||||||
|
TRACE_1("Using Vanilla Locking", _vanillaTarget);
|
||||||
|
if(!isNil "_vanillaTarget") then {
|
||||||
|
_target = _vanillaTarget;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile);
|
TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile);
|
||||||
[FUNC(guidancePFH), 0, [_this,
|
[FUNC(guidancePFH), 0, [_this,
|
||||||
[ACE_player,
|
[_shooter,
|
||||||
[_target, _targetPos, _launchPos],
|
[_target, _targetPos, _launchPos],
|
||||||
_seekerType,
|
_seekerType,
|
||||||
_attackProfile,
|
_attackProfile,
|
@ -0,0 +1,7 @@
|
|||||||
|
//#define DEBUG_MODE_FULL
|
||||||
|
#include "script_component.hpp"
|
||||||
|
PARAMS_3(_target,_ammo,_shooter);
|
||||||
|
|
||||||
|
if !(local (gunner _shooter) || {local _shooter}) exitWith {};
|
||||||
|
|
||||||
|
_shooter setVariable [QGVAR(vanilla_target),_target, false];
|
@ -8,10 +8,14 @@ _launchParams = _this select 1;
|
|||||||
_seekerParams = _launchParams select 3;
|
_seekerParams = _launchParams select 3;
|
||||||
_angleFov = _seekerParams select 0;
|
_angleFov = _seekerParams select 0;
|
||||||
|
|
||||||
_laserResult = [(getPosASL _projectile), (velocity _projectile), _angleFov, [ACE_DEFAULT_LASER_WAVELENGTH,ACE_DEFAULT_LASER_WAVELENGTH], ACE_DEFAULT_LASER_CODE] call EFUNC(laser,seekerFindLaserSpot);
|
if(!isNil "_target") then {
|
||||||
_foundTargetPos = _laserResult select 0;
|
// Handle AI or moving vanilla lasers
|
||||||
TRACE_1("Search", _laserResult);
|
_foundTargetPos = getPosASL _target;
|
||||||
|
} else {
|
||||||
|
_laserResult = [(getPosASL _projectile), (velocity _projectile), _angleFov, [ACE_DEFAULT_LASER_WAVELENGTH,ACE_DEFAULT_LASER_WAVELENGTH], ACE_DEFAULT_LASER_CODE] call EFUNC(laser,seekerFindLaserSpot);
|
||||||
|
_foundTargetPos = _laserResult select 0;
|
||||||
|
TRACE_1("Search", _laserResult);
|
||||||
|
};
|
||||||
|
|
||||||
if(!isNil "_foundTargetPos") then {
|
if(!isNil "_foundTargetPos") then {
|
||||||
//_canSeeTarget = [_projectile, _foundTargetPos, _angleFov] call FUNC(checkSeekerAngle);
|
//_canSeeTarget = [_projectile, _foundTargetPos, _angleFov] call FUNC(checkSeekerAngle);
|
||||||
|
@ -12,6 +12,12 @@
|
|||||||
<Portuguese>Avançado Missile Guidance</Portuguese>
|
<Portuguese>Avançado Missile Guidance</Portuguese>
|
||||||
<Hungarian>Részletes rakéta irányító</Hungarian>
|
<Hungarian>Részletes rakéta irányító</Hungarian>
|
||||||
<Russian>Расширенный ракетой</Russian>
|
<Russian>Расширенный ракетой</Russian>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_MissileGuidance_AI">
|
||||||
|
<English>Advanced Missile Guidance for AI</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_MissileGuidance_AI_Desc">
|
||||||
|
<English>Enables advanced guidance on AI units.</English>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_MissileGuidance_Desc">
|
<Key ID="STR_ACE_MissileGuidance_Desc">
|
||||||
<English>Enables advanced guidance mechanics and selection for different missiles and fire modes.</English>
|
<English>Enables advanced guidance mechanics and selection for different missiles and fire modes.</English>
|
||||||
|
Loading…
Reference in New Issue
Block a user