mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Ports over NouberNou's dragon guidance
This commit is contained in:
parent
f77c95a577
commit
6fd65589cb
1
addons/dragon/$PBOPREFIX$
Normal file
1
addons/dragon/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\dragon
|
10
addons/dragon/ACE_GuidanceConfig.hpp
Normal file
10
addons/dragon/ACE_GuidanceConfig.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
class ACEGVAR(missileguidance,AttackProfiles) {
|
||||
class DRAGON {
|
||||
name = "FGM-77 Dragon";
|
||||
visualName = "FGM-77 Dragon";
|
||||
description = "FGM-77 Dragon";
|
||||
|
||||
functionName = QFUNC(attackProfile_DRAGON);
|
||||
};
|
||||
};
|
||||
|
53
addons/dragon/CfgAmmo.hpp
Normal file
53
addons/dragon/CfgAmmo.hpp
Normal file
@ -0,0 +1,53 @@
|
||||
class CfgAmmo {
|
||||
class MissileBase;
|
||||
class CUP_M_47_AT_EP1: MissileBase {
|
||||
thrust = 0;
|
||||
initTime = 0;
|
||||
thrustTime = 0;
|
||||
sideAirFriction = 0.5;
|
||||
effectsMissile = "";
|
||||
effectFlare = "";
|
||||
airFriction = 0.5;
|
||||
irLock = 0;
|
||||
manualControl = 0;
|
||||
deflecting = 0;
|
||||
fuseDistance = 5;
|
||||
whistleDist = 2;
|
||||
timeToLive = 20;
|
||||
lockType = 0;
|
||||
|
||||
class ace_missileguidance {
|
||||
enabled = 1;
|
||||
|
||||
minDeflection = 0; // Minium flap deflection for guidance
|
||||
maxDeflection = 0; // Maximum flap deflection for guidance
|
||||
incDeflection = 0; // The incrmeent in which deflection adjusts.
|
||||
|
||||
canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode
|
||||
|
||||
// Guidance type for munitions
|
||||
defaultSeekerType = "SACLOS";
|
||||
seekerTypes[] = { "SACLOS" };
|
||||
|
||||
defaultSeekerLockMode = "LOAL";
|
||||
seekerLockModes[] = { "LOAL", "LOBL" };
|
||||
|
||||
onFired = QACEFUNC(hot,onFired);
|
||||
|
||||
seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos]
|
||||
seekerAngle = 15; // Angle from the shooter's view that can track the missile
|
||||
seekerAccuracy = 1; // seeker accuracy multiplier
|
||||
|
||||
seekerMinRange = 75;
|
||||
seekerMaxRange = 1000; // Range from the missile which the seeker can visually search
|
||||
|
||||
correctionDistance = 15; // distance from center of crosshair where missile sits. If the missile leaves this the missile will ground itself
|
||||
missileLeadDistance = 0; // distance ahead of the missile where the SACLOS system will project to
|
||||
offsetFromCrosshair[] = { 0, 0, 0 }; // where the missile wants to stay in relation to the center of the crosshair.
|
||||
|
||||
// Attack profile type selection
|
||||
defaultAttackProfile = "DRAGON";
|
||||
attackProfiles[] = {"DRAGON"};
|
||||
};
|
||||
};
|
||||
}
|
11
addons/dragon/CfgEventHandlers.hpp
Normal file
11
addons/dragon/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
class Extended_PreStart_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preStart));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
0
addons/dragon/CfgMagazines.hpp
Normal file
0
addons/dragon/CfgMagazines.hpp
Normal file
6
addons/dragon/CfgWeapons.hpp
Normal file
6
addons/dragon/CfgWeapons.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
class CfgWeapons {
|
||||
class Launcher_Base_F;
|
||||
class CUP_launch_M47: Launcher_Base_F {
|
||||
|
||||
};
|
||||
};
|
11
addons/dragon/README.md
Normal file
11
addons/dragon/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
ace_dragon
|
||||
===================
|
||||
|
||||
Adds M47 Dragon Missile.
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
The people responsible for merging changes to this component or answering potential questions.
|
||||
|
||||
- [Name](https://github.com/name)
|
2
addons/dragon/XEH_PREP.hpp
Normal file
2
addons/dragon/XEH_PREP.hpp
Normal file
@ -0,0 +1,2 @@
|
||||
PREP(attackProfile_DRAGON);
|
||||
|
9
addons/dragon/XEH_preInit.sqf
Normal file
9
addons/dragon/XEH_preInit.sqf
Normal file
@ -0,0 +1,9 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP_RECOMPILE_START;
|
||||
#include "XEH_PREP.hpp"
|
||||
PREP_RECOMPILE_END;
|
||||
|
||||
ADDON = true;
|
3
addons/dragon/XEH_preStart.sqf
Normal file
3
addons/dragon/XEH_preStart.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "XEH_PREP.hpp"
|
21
addons/dragon/config.cpp
Normal file
21
addons/dragon/config.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
name = COMPONENT_NAME;
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author = ECSTRING(common,ACETeam);
|
||||
authors[] = {""};
|
||||
url = ECSTRING(main,URL);
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "ACE_GuidanceConfig.hpp"
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "CfgMagazines.hpp"
|
||||
#include "CfgAmmo.hpp"
|
55
addons/dragon/functions/fnc_attackProfile_DRAGON.sqf
Normal file
55
addons/dragon/functions/fnc_attackProfile_DRAGON.sqf
Normal file
@ -0,0 +1,55 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Brandon (TCVM) (Code inspired by NouberNou)
|
||||
* Attack profile: Dragon Guidance
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Seeker Target PosASL <ARRAY>
|
||||
* 1: Guidance Arg Array <ARRAY>
|
||||
* 2: Attack Profile State <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* Missile Aim PosASL <ARRAY> - Unused
|
||||
*
|
||||
* Example:
|
||||
* [[1,2,3], [], []] call ace_hot_fnc_attackProfile_WIRE;
|
||||
*
|
||||
* Public: No
|
||||
*
|
||||
*/
|
||||
params ["_seekerTargetPos", "_args", "_attackProfileStateParams"];
|
||||
_args params ["_firedEH", "", "", "", "_stateParams"];
|
||||
_firedEH params ["_shooter","_weapon","","","","","_projectile"];
|
||||
_attackProfileStateParams params["_maxCorrectableDistance", "_wireCut", "_randomVector", "_crosshairOffset", "_seekerMaxRangeSqr", "_wireCutSource", ["_lastTime", 0]];
|
||||
_stateParams params ["_lastRunTime"];
|
||||
|
||||
private _projectilePos = getPosASL _projectile;
|
||||
|
||||
if ((((getPosASL _shooter) vectorDistanceSqr _projectilePos) > _seekerMaxRangeSqr) || { _wireCut }) exitWith {
|
||||
// wire snap, random direction
|
||||
if (_randomVector isEqualTo [0, 0, 0]) then {
|
||||
_randomVector = RANDOM_VECTOR_3D vectorMultiply 300;
|
||||
_attackProfileStateParams set [1, true];
|
||||
_attackProfileStateParams set [2, _randomVector];
|
||||
|
||||
playSound3D ["a3\sounds_f\air\sfx\SL_rope_break.wss", objNull, false, AGLtoASL (_shooter modelToWorld _wireCutSource), 150, 1, 25];
|
||||
};
|
||||
_projectilePos vectorAdd _randomVector
|
||||
};
|
||||
_maxCorrectableDistance = 30;
|
||||
// if the time between updates is less than the pop time we want to fire the rockets
|
||||
if ((_lastTime - CBA_missionTime) <= 0) then {
|
||||
_attackProfileStateParams set [6, CBA_missionTime + 0.3];
|
||||
|
||||
private _vectorToCrosshair = vectorNormalized (_projectile worldToModel (ASLToAGL _seekerTargetPos));
|
||||
private _vectorToPos = vectorNormalized (((_projectile vectorWorldToModelVisual (_shooter weaponDirection _weapon)) vectorMultiply (100 * 0.3)) vectorAdd (_vectorToCrosshair vectorMultiply _maxCorrectableDistance));
|
||||
|
||||
if ((_vectorToPos select 2) < 0) then {
|
||||
_vectorToPos set [2, 0];
|
||||
};
|
||||
|
||||
_projectile setVelocityModelSpace ((velocityModelSpace _projectile) vectorAdd (_vectorToPos vectorMultiply 6.5));
|
||||
};
|
||||
|
||||
// Return position in-front of projectile. Because we simulate the velocity updates in this function we dont want missile guidance taking over
|
||||
_projectilePos vectorAdd (AGLtoASL (_projectile vectorModelToWorld [0, 50, 0]))
|
1
addons/dragon/functions/script_component.hpp
Normal file
1
addons/dragon/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\dragon\script_component.hpp"
|
17
addons/dragon/script_component.hpp
Normal file
17
addons/dragon/script_component.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#define COMPONENT dragon
|
||||
#define COMPONENT_BEAUTIFIED M47 Dragon
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
// #define DEBUG_MODE_FULL
|
||||
#define DISABLE_COMPILE_CACHE
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
#ifdef DEBUG_ENABLED_DRAGON
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_DRAGON
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_DRAGON
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
Loading…
x
Reference in New Issue
Block a user