Merge branch 'pike' into copperhead

This commit is contained in:
PabstMirror 2024-04-01 00:22:26 -05:00
commit 270979b779
16 changed files with 247 additions and 1 deletions

View File

@ -21,7 +21,9 @@ params ["_seekerTargetPos", "_args"];
_args params ["_firedEH"];
_firedEH params ["_shooter","","","","","","_projectile"];
if (_seekerTargetPos isEqualTo [0,0,0]) exitWith {_seekerTargetPos};
if (_seekerTargetPos isEqualTo [0,0,0]) exitWith {
_projectilePos vectorAdd (_projectile vectorModelToWorld [0, 50, 0])
};
private _shooterPos = getPosASL _shooter;
private _projectilePos = getPosASL _projectile;

1
addons/pike/$PBOPREFIX$ Normal file
View File

@ -0,0 +1 @@
z\ace\addons\pike

83
addons/pike/CfgAmmo.hpp Normal file
View File

@ -0,0 +1,83 @@
class CfgAmmo {
class SubmunitionBase;
class GVAR(ammo_gl): SubmunitionBase {
model = QPATHTOF(models\ace_pike_ammo.p3d);
submunitionAmmo = QGVAR(ammo_rocket);
submunitionCount = 1;
submunitionConeAngle = 0;
EGVAR(frag,skip) = 1; // don't frag because this is a scripted ammo
class Eventhandlers {
fired = QUOTE(call FUNC(ammoFired));
};
};
class MissileBase;
class GVAR(ammo_rocket): MissileBase {
irLock = 0;
laserLock = 0;
airLock = 0;
manualControl = 0;
timeToLive = 22;
model = QPATHTOF(models\ace_pike_ammo.p3d);
maxSpeed = 150; // ~2km in 15sec
thrust = 19;
thrustTime = 14;
initTime = 0;
airFriction = 0.1;
hit = 120;
indirectHit = 10;
indirectHitRange = 10;
warheadName = "HE";
EGVAR(frag,enabled) = 1;
EGVAR(frag,force) = 1;
EGVAR(frag,classes)[] = {QEGVAR(frag,tiny_HD)};
EGVAR(frag,metal) = 200;
EGVAR(frag,charge) = 270; // ~8x a normal 40mm
EGVAR(frag,gurney_c) = 2700;
EGVAR(frag,gurney_k) = "1/2";
CraterEffects="ExploAmmoCrater";
explosionEffects="ExploAmmoExplosion";
effectsMissileInit = "RocketBackEffectsRPG";
effectsMissile = "missile3";
SoundSetExplosion[] = {"GrenadeHe_Exp_SoundSet", "GrenadeHe_Tail_SoundSet", "Explosion_Debris_SoundSet"};
soundHit1[] = { "A3\Sounds_F\arsenal\explosives\Grenades\Explosion_gng_grenades_01", 3.1622777, 1, 1500};
soundHit2[] = { "A3\Sounds_F\arsenal\explosives\Grenades\Explosion_gng_grenades_02", 3.1622777, 1, 1500};
soundHit3[] = { "A3\Sounds_F\arsenal\explosives\Grenades\Explosion_gng_grenades_03", 3.1622777, 1, 1500};
soundHit4[] = { "A3\Sounds_F\arsenal\explosives\Grenades\Explosion_gng_grenades_04", 3.1622777, 1, 1500};
multiSoundHit[] = {"soundHit1", 0.25, "soundHit2", 0.25, "soundHit3", 0.25, "soundHit4", 0.25};
whistleDist=16;
// Begin ACE guidance Configs
class ace_missileguidance {
enabled = 2;
minDeflection = 0.0005; // Minium flap deflection for guidance
maxDeflection = 0.0025; // Maximum flap deflection for guidance
incDeflection = 0.0005; // The incrmeent in which deflection adjusts.
canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode
// Guidance type for munitions
defaultSeekerType = "SALH";
seekerTypes[] = {"SALH"};
defaultSeekerLockMode = "LOAL";
seekerLockModes[] = {"LOAL"};
seekerAngle = 90; // Angle in front of the missile which can be searched
seekerAccuracy = 1; // seeker accuracy multiplier
seekerMinRange = 1;
seekerMaxRange = 3000; // Range from the missile which the seeker can visually search
// Attack profile type selection
defaultAttackProfile = "LIN";
attackProfiles[] = {"LIN"};
};
};
};

View File

@ -0,0 +1,10 @@
class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart));
};
};
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
};
};

View File

@ -0,0 +1,5 @@
class CfgMagazineWells {
class CBA_40mm_EGLM { // for longer grenades that can only fit side breech-loading
ADDON[] = {"ACE_40mm_Pike"};
};
};

View File

@ -0,0 +1,15 @@
class CfgMagazines {
class 1Rnd_HE_Grenade_shell;
class ACE_40mm_Pike: 1Rnd_HE_Grenade_shell {
displayName = CSTRING(magazine_displayName);
displayNameShort = CSTRING(magazine_displayNameShort);
descriptionShort = CSTRING(magazine_descriptionShort);
picture = QPATHTOF(ui\gear_pike_ca.paa);
ammo = QGVAR(ammo_gl);
count = 1;
// model = QPATHTOF(models\ace_pike_ammo.p3d); // kinda ugly, just use pouch thing
initSpeed = 50;
mass = 17; // ~1.7 Pounds
author = ECSTRING(common,ACETeam);
};
};

4
addons/pike/README.md Normal file
View File

@ -0,0 +1,4 @@
ace_pike
===========
Adds 40mm Pike semi-active laser seeking rocket, firable from the M320 or EGLM grenade launcher.

2
addons/pike/XEH_PREP.hpp Normal file
View File

@ -0,0 +1,2 @@
LOG("prep");
PREP(ammoFired);

View File

@ -0,0 +1,7 @@
#include "script_component.hpp"
ADDON = false;
#include "XEH_PREP.hpp"
ADDON = true;

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"

20
addons/pike/config.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_missileguidance"};
author = ECSTRING(common,ACETeam);
authors[] = {"PabstMirror"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};
#include "CfgAmmo.hpp"
#include "CfgEventhandlers.hpp"
#include "CfgMagazines.hpp"
#include "CfgMagazineWells.hpp"

View File

@ -0,0 +1,63 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Handles firing the 40mm pike grenade (shell)
*
* Arguments:
* FiredEH
*
* Return Value:
* Nothing
*
* Example:
* [] call ace_pike_fnc_ammoFired
*
* Public: No
*/
params ["_unit", "", "", "", "_ammo", "", "_projectile", "_gunner"];
TRACE_4("ammoFired",_unit,_ammo,_projectile,_gunner);
if (!local _gunner) exitWith {};
if (isNull _projectile) exitWith {};
// Get MissileGuidance args now
private _firedEH = +_this;
// Inject the submunition ammo into guidance args
_firedEH set [4, getText (configFile >> "CfgAmmo" >> _ammo >> "submunitionAmmo")];
private _guidanceArgs = _firedEH call EFUNC(missileguidance,onFiredDeferred);
_projectile setVariable [QGVAR(guidanceArgs), _guidanceArgs];
// On missile deploy start guidance
_projectile addEventHandler ["SubmunitionCreated", {
params ["_projectile", "_submunitionProjectile"];
TRACE_2("SubmunitionCreated",_projectile,_submunitionProjectile);
private _guidanceArgs = _projectile getVariable [QGVAR(guidanceArgs), []];
if (_guidanceArgs isEqualTo []) exitWith { ERROR_1("bad args %1",_projectile); };
// Inject the submunition projectile and time into guidance args
_guidanceArgs params ["_firedEH", "", "", "", "_stateParams"];
_firedEH set [6, _submunitionProjectile]; // _firedEH params ["","","","","","","_projectile"];
_stateParams set [0, diag_tickTime]; // _stateParams params ["_lastRunTime"]
[EFUNC(missileguidance,guidancePFH), 0, _guidanceArgs] call CBA_fnc_addPerFrameHandler;
if (!isNil QEFUNC(frag,addPfhRound)) then {
[_firedEH # 0, _firedEH # 4, _submunitionProjectile] call EFUNC(frag,addPfhRound);
};
#ifdef DEBUG_MODE_FULL
[{
params ["_time", "_projectile"];
if (isNull _projectile) exitWith {true};
systemChat format ["%1 - %2", CBA_missionTime - _time, vectorMagnitude velocity _projectile];
false
}, {}, [CBA_missionTime, _submunitionProjectile]] call CBA_fnc_waitUntilAndExecute;
#endif
}];
// Trigger motor after ~4 meter delay (could also use config `triggerTime`)
[{
params ["_projectile"];
if (isNull _projectile) exitWith { WARNING_1("null %1",_projectile); };
triggerAmmo _projectile;
}, [_projectile], 0.1] call CBA_fnc_waitAndExecute;

Binary file not shown.

View File

@ -0,0 +1,17 @@
#define COMPONENT pike
#define COMPONENT_BEAUTIFIED Pike
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_PIKE
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_PIKE
#define DEBUG_SETTINGS DEBUG_SETTINGS_PIKE
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Pike">
<Key ID="STR_ACE_Pike_magazine_displayName">
<English>40mm Pike</English>
</Key>
<Key ID="STR_ACE_Pike_magazine_displayNameShort">
<English>Pike SALH</English>
</Key>
<Key ID="STR_ACE_Pike_magazine_descriptionShort">
<English>Semi-Active Laser Guided 40mm Grenade</English>
</Key>
</Package>
</Project>

Binary file not shown.