Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions addons/dragon/CfgAmmo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ class CfgAmmo {
caliber = 60;
warheadName = "HEAT";
hit = 460;
fuseDistance = 75;
};
class GVAR(penetrator_dragon_2): GVAR(penetrator_super) {
caliber = 40;
hit = 400;
};
class GVAR(penetrator_dragon_1): GVAR(penetrator_super) {
caliber = 22;
hit = 300;
};

class GVAR(dragonBase): Rocket_03_AP_F {
Expand All @@ -22,8 +29,8 @@ class CfgAmmo {
sideAirFriction = 0.05;
effectsMissile = "missile2";
effectFlare = "";
airFriction = 0.5;
fuseDistance = 75;
airFriction = 0.3;
fuseDistance = 65; // manual says 65m
whistleDist = 2;

hit = 100;
Expand Down Expand Up @@ -51,10 +58,31 @@ class CfgAmmo {
enabled = 1;
seekerMinRange = 30;
seekerMaxRange = 1500;
serviceChargeAcceleration = 13.5;
serviceCharges = 60; // how many charges are in this missile
};
};

class GVAR(2_M): GVAR(dragonBase) {
submunitionAmmo = QGVAR(penetrator_dragon_2);
submunitionDirectionType = "SubmunitionModelDirection";
submunitionInitSpeed = 1000;
submunitionParentSpeedCoef = 0;
submunitionInitialOffset[] = { 0, 0, -0.2 };

class ace_missileguidance: ace_missileguidance {
enabled = 1;
};
};

class GVAR(1_M): GVAR(2_M) {
submunitionAmmo = QGVAR(penetrator_dragon_1);

class ace_missileguidance: ace_missileguidance {
enabled = 1;
};
};

class ShellBase;
class GVAR(serviceCharge): ShellBase {
hit = 1;
Expand Down
8 changes: 7 additions & 1 deletion addons/dragon/CfgMagazines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ class CfgMagazines {
soundHit[] = {};
model = QPATHTOF(models\dragon.p3d);
ammo = QGVAR(super);
initSpeed = 120;
initSpeed = 65;
scope = 1;
displayName = CSTRING(dragonName);
displayNameShort = CSTRING(dragonName);
descriptionShort = CSTRING(dragonDescription);
};
class GVAR(2): GVAR(super) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need new CSW items for these?
or are they more just for testing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we ok with the turret spam if we add that? It'd be another two launchers with changes limited to:

  • Max range / speed
  • Penetration

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon further thought, I would like them. I think in the near-future I may explore adding a new arsenal category for CSW weapons to keep the launcher tab less full

ammo = QGVAR(2_M);
};
class GVAR(1): GVAR(super) {
ammo = QGVAR(1_M);
};
};

2 changes: 1 addition & 1 deletion addons/dragon/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CfgWeapons {

displayName = CSTRING(dragonName);
descriptionShort = CSTRING(dragonDescription);
magazines[] = { QGVAR(super) };
magazines[] = { QGVAR(super), QGVAR(2), QGVAR(1) };
};

// need a weapon in order to rotate turret
Expand Down
26 changes: 8 additions & 18 deletions addons/dragon/functions/fnc_attackProfile_DRAGON.sqf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "..\script_component.hpp"
#define GRAVITY_OFFSET [0, 0, _serviceInterval^2 * 4.9025]
/*
* Author: tcvm (Code inspired by NouberNou's Dragon Guidance)
* Attack profile: Dragon Guidance
Expand All @@ -19,7 +20,7 @@
params ["_seekerTargetPos", "_args", "_attackProfileStateParams"];
_args params ["_firedEH", "", "", "", "_stateParams"];
_firedEH params ["_shooter","_weapon","","","","","_projectile"];
_attackProfileStateParams params ["_maxCorrectableDistance", "_wireCut", "_seekerMaxRangeSqr", "_seekerMinRangeSqr", "_wireCutSource", "_lastTime", "_serviceInterval", "_serviceChargeCount", "_serviceChargeAcceleration", "_dragonSpeed"];
_attackProfileStateParams params ["_maxCorrectableDistance", "_wireCut", "_seekerMaxRangeSqr", "_seekerMinRangeSqr", "_wireCutSource", "_lastTime", "_serviceInterval", "_serviceChargeCount", "_serviceChargeAcceleration"];

private _projectilePos = getPosASL _projectile;
private _distanceToProjectile = (getPosASL _shooter) vectorDistanceSqr _projectilePos;
Expand Down Expand Up @@ -51,27 +52,16 @@ if (_distanceToProjectile <= _seekerMinRangeSqr || { _serviceChargeCount <= 0 }
if (((_lastTime - CBA_missionTime) <= 0) || {(_lastTime - CBA_missionTime) < (_serviceInterval / 2) && (_projectilePos vectorDistance _seekerTargetPos > 1)}) then {
_attackProfileStateParams set [5, CBA_missionTime + _serviceInterval];

private _vectorToCrosshair = vectorNormalized (_projectile worldToModel (ASLToAGL _seekerTargetPos));
private _vectorToPos = vectorNormalized (((_projectile vectorWorldToModelVisual (_shooter weaponDirection _weapon)) vectorMultiply (_dragonSpeed * _serviceInterval)) vectorAdd (_vectorToCrosshair vectorMultiply _maxCorrectableDistance));

if ((_vectorToPos select 2) < 0) then {
_vectorToPos set [2, 0];
} else {
private _a = _vectorToPos select 1;
private _b = _vectorToPos select 2;
// The booster has some angle to it, so we introduce that axis if the angle is too low
if (abs(_a) > 0 && { abs(atan (_b / _a)) < DRAGON_BOOSTER_ANGLE }) then {
_vectorToPos set [2, abs(_a)];
};
};

_projectile setVelocityModelSpace ((velocityModelSpace _projectile) vectorAdd (_vectorToPos vectorMultiply _serviceChargeAcceleration));
private _vectorToCrosshair = vectorNormalized (_projectile worldToModel (GRAVITY_OFFSET vectorAdd ASLToAGL _seekerTargetPos));
// Plus or minus since we'll assume the change a charge is at the exact vector is pseudo random
private _angle = ((_vectorToCrosshair#2) atan2 (_vectorToCrosshair#0)) - 22.5 + random 45;

_projectile setVelocityModelSpace ((velocityModelSpace _projectile) vectorAdd ([cos _angle * sin DRAGON_BOOSTER_ANGLE, cos DRAGON_BOOSTER_ANGLE , sin _angle * sin DRAGON_BOOSTER_ANGLE] vectorMultiply _serviceChargeAcceleration));
private _charge = createVehicle [QGVAR(serviceCharge), [0, 0, 0], [], 0, "NONE"];
_charge setPosASL (_projectilePos vectorAdd ((_vectorToCrosshair vectorMultiply -1) vectorMultiply 0.025));
_charge setPosASL (_projectilePos vectorAdd (_vectorToCrosshair vectorMultiply -0.025));
[QEGVAR(common,setShotParents), [_charge] + getShotParents _projectile] call CBA_fnc_serverEvent; // AI should be alerted of popping source

_attackProfileStateParams set [7, _serviceChargeCount - 1];
};

_retPos

4 changes: 1 addition & 3 deletions addons/dragon/functions/fnc_onFired.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ private _config = configOf _projectile >> "ace_missileguidance";
private _serviceInterval = [_config >> "serviceInterval", "NUMBER", 0.33] call CBA_fnc_getConfigEntry;
private _serviceChargeCount = [_config >> "serviceCharges", "NUMBER", 60] call CBA_fnc_getConfigEntry;
private _serviceChargeAcceleration = [_config >> "serviceChargeAcceleration", "NUMBER", 6.5] call CBA_fnc_getConfigEntry;
private _dragonSpeed = [_config >> "dragonSpeed", "NUMBER", 100] call CBA_fnc_getConfigEntry;
private _maxCorrectableDistance = [_config >> "correctionDistance", "NUMBER", DEFAULT_CORRECTION_DISTANCE] call CBA_fnc_getConfigEntry;
private _maxDistanceSqr = _seekerMaxRange * _seekerMaxRange;
private _minDistanceSqr = _seekerMinRange * _seekerMinRange;
Expand All @@ -49,7 +48,6 @@ _attackProfileStateParams append [
CBA_missionTime,
_serviceInterval,
_serviceChargeCount,
_serviceChargeAcceleration,
_dragonSpeed
_serviceChargeAcceleration
];

42 changes: 42 additions & 0 deletions addons/dragon/models/dragon.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
class CfgSkeletons {
class Default {
isDiscrete = 1;
skeletonInherit = "";
skeletonBones[] = {};
};

class dragon_skeleton: Default {
skeletonInherit = "Default";
skeletonBones[] = {
"missile",""
};
};
};

class CfgModels {
class Default {
sectionsInherit = "";
sections[] = {};
};

class dragon: Default {
sectionsInherit = "Default";
sections[] = {};
skeletonName = "dragon_skeleton";
class Animations {
class spin {
type="rotationZ";
selection="missile";
sourceAddress = "loop";
source="time";
axis="";
animPeriod=0.5;
initPhase=0;
maxValue=1;
minValue=0;
angle1="rad 720";
angle0=0;
};
};
};
};
Binary file modified addons/dragon/models/dragon.p3d
Binary file not shown.
2 changes: 1 addition & 1 deletion addons/dragon/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
#endif

#include "\z\ace\addons\main\script_macros.hpp"
#define DRAGON_BOOSTER_ANGLE 45
#define DRAGON_BOOSTER_ANGLE 35
6 changes: 3 additions & 3 deletions addons/missileguidance/CfgMissileTypesNato.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ class GVAR(type_Dragon) {

serviceInterval = 0.33; // how many seconds between pops
serviceCharges = 32; // how many charges are in this missile
serviceChargeAcceleration = 6.5;
dragonSpeed = 100; // meters per second
serviceChargeAcceleration = 6;
dragonSpeed = 100; // deprecated - meters per second

defaultAttackProfile = "DRAGON";
attackProfiles[] = {"DRAGON"};
Expand Down Expand Up @@ -277,7 +277,7 @@ class GVAR(type_Javelin) {
seekerAccuracy = 1; // seeker accuracy multiplier

seekerMinRange = 0;
seekerMaxRange = 2500; // Range from the missile which the seeker can visually search
seekerMaxRange = 4500; // Range from the missile which the seeker can visually search

seekLastTargetPos = 1; // seek last target position [if seeker loses LOS of target, continue to last known pos]

Expand Down
Loading