Merge branch 'master' of github.com:KoffeinFlummi/ACE3

This commit is contained in:
esteldunedain 2015-04-14 22:54:10 -03:00
commit 7a606a2352
10 changed files with 65 additions and 27 deletions

View File

@ -26,7 +26,7 @@ class ACE_Settings {
class GVAR(UseListMenu) {
value = 0;
typeName = "BOOL";
isClientSetable = 1;
isClientSettable = 1;
displayName = "$STR_ACE_Interact_Menu_UseListMenu";
};
};

View File

@ -2,8 +2,15 @@ class ACE_Settings {
class GVAR(enabled) {
value = 1;
typeName = "BOOL";
isClientSetable = 1;
isClientSettable = 1;
displayName = "$STR_ACE_MissileGuidance";
description = "$STR_ACE_MissileGuidance_Desc";
};
class GVAR(enabledForAI) {
value = 1;
typeName = "BOOL";
isClientSettable = 1;
displayName = "$STR_ACE_MissileGuidance_AI";
description = "$STR_ACE_MissileGuidance_AI_Desc";
};
};

View File

@ -12,6 +12,12 @@ class Extended_PostInit_EventHandlers {
class Extended_FiredBIS_EventHandlers {
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));
};
};

View File

@ -7,7 +7,8 @@ PREP(changeMissileDirection);
PREP(checkSeekerAngle);
PREP(checkLos);
PREP(fired);
PREP(onFired);
PREP(onIncomingMissile);
PREP(guidancePFH);
PREP(doAttackProfile);

View File

@ -43,12 +43,8 @@ switch( (_state select 0) ) do {
};
case STAGE_CLIMB: {
TRACE_1("STAGE_CLIMB","");
_cruisAlt = 60;
if(_distanceShooterToTarget < w) then {
_cruisAlt = 60 * (_distanceShooterToTarget/2000);
TRACE_1("_cruisAlt", _cruisAlt);
};
_cruisAlt = 60 * (_distanceShooterToTarget/2000);
if( ((ASLToATL _projectilePos) select 2) - ((ASLToATL _seekerTargetPos) select 2) >= _cruisAlt) then {
_state set[0, STAGE_TERMINAL];
} else {

View File

@ -57,7 +57,8 @@ switch( (_state select 0) ) do {
};
case STAGE_COAST: {
TRACE_1("STAGE_COAST","");
if(_distanceShooterToTarget < 1250 || _distanceToTarget < ( ((ASLToATL _projectilePos) select 2) - (( ASLToATL _seekerTargetPos) select 2) )) then {
TRACE_1("", ((ASLToATL _projectilePos) select 2) - (( ASLToATL _seekerTargetPos) select 2) );
if(_distanceShooterToTarget < 1250 || _distanceToTarget < ( ((ASLToATL _projectilePos) select 2) - (( ASLToATL _seekerTargetPos) select 2) ) * 1.5) then {
_state set[0, STAGE_TERMINAL];
};
_returnTargetPos = _seekerTargetPos vectorAdd [0,0,(_projectilePos select 2)];

View File

@ -2,10 +2,10 @@
#include "script_component.hpp"
// Bail if guidance is disabled
if(!GVAR(enabled)) exitWith { false };
// 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"];
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
@ -20,10 +20,13 @@ _enabled = getNumber ( _config >> "enabled");
if(isNil "_enabled" || {_enabled != 1}) exitWith { false };
_target = (vehicle _shooter) getVariable [QGVAR(target), nil];
_targetPos = (vehicle _shooter) getVariable [QGVAR(targetPosition), nil];
_seekerType = (vehicle _shooter) getVariable [QGVAR(seekerType), nil];
_attackProfile = (vehicle _shooter) getVariable [QGVAR(attackProfile), nil];
_lockMode = (vehicle _shooter) getVariable [QGVAR(lockMode), nil];
_launchPos = getPosASL (vehicle _shooter);
TRACE_3("Begin guidance", _target, _seekerType, _attackProfile);
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(isNil "_target") then {
_canUseLock = getNumber (_config >> "canVanillaLock");
if(_canUseLock > 0) then {
// @TODO: Get vanilla target
_vanillaTarget = cursorTarget;
TRACE_1("Using Vanilla Locking", _vanillaTarget);
if(!isNil "_vanillaTarget") then {
_target = _vanillaTarget;
if(!isPlayer _shooter) then {
// This was an AI shot, lets still guide it on the AI target
_target = _shooter getVariable[QGVAR(vanilla_target), nil];
TRACE_1("Detected AI Shooter!", _target);
} else {
_canUseLock = getNumber (_config >> "canVanillaLock");
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);
[FUNC(guidancePFH), 0, [_this,
[ACE_player,
[_shooter,
[_target, _targetPos, _launchPos],
_seekerType,
_attackProfile,

View File

@ -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];

View File

@ -8,10 +8,14 @@ _launchParams = _this select 1;
_seekerParams = _launchParams select 3;
_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);
_foundTargetPos = _laserResult select 0;
TRACE_1("Search", _laserResult);
if(!isNil "_target") then {
// Handle AI or moving vanilla lasers
_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 {
//_canSeeTarget = [_projectile, _foundTargetPos, _angleFov] call FUNC(checkSeekerAngle);

View File

@ -12,6 +12,12 @@
<Portuguese>Avançado Missile Guidance</Portuguese>
<Hungarian>Részletes rakéta irányító</Hungarian>
<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 ID="STR_ACE_MissileGuidance_Desc">
<English>Enables advanced guidance mechanics and selection for different missiles and fire modes.</English>