Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cardboard #398

Closed
wants to merge 21 commits into from
Closed
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
85 changes: 85 additions & 0 deletions addons/uh60_weapons/Data/hl_88.rvmat
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
ambient[]={1,1,1,1};
diffuse[]={0.80000001,0.80000001,0.80000001,1};
forcedDiffuse[]={0,0,0,1};
emmisive[]={0,0,0,1};
specular[]={0.2,0.2,0.2,1};
specularPower=1.5;
PixelShaderID="Super";
VertexShaderID="Super";
class Stage1
{
texture="z\vtx\addons\uh60_weapons\Data\hl_88_nohq.paa";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
class Stage2
{
texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage3
{
texture="#(argb,8,8,3)color(0,0,0,0,mc)";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
class Stage4
{
texture="z\vtx\addons\uh60_weapons\Data\hl_88_AS.paa";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
class Stage5
{
texture="#(argb,8,8,3)color(1,0.02,0.001,1,SMDI)";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
class Stage6
{
texture="#(ai,64,64,1)fresnel(4.5,1.1)";
uvSource="none";
};
class Stage7
{
texture="a3\data_f\env_land_ca.paa";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
Binary file added addons/uh60_weapons/Data/hl_88_AS.paa
Binary file not shown.
Binary file added addons/uh60_weapons/Data/hl_88_CO.paa
Binary file not shown.
Binary file added addons/uh60_weapons/Data/hl_88_SMDI.paa
Binary file not shown.
Binary file added addons/uh60_weapons/Data/hl_88_nohq.paa
Binary file not shown.
30 changes: 30 additions & 0 deletions addons/uh60_weapons/config/cfgAmmo.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class CfgAmmo {
class M_Scalpel_AT;
class B_30mm_MP_Tracer_Green;
class ammo_Missile_HARM;
class ACE_Hellfire_AGM114K: M_Scalpel_AT {class ace_missileguidance;};
class ACE_Hellfire_AGM114N: M_Scalpel_AT {class ace_missileguidance;};
class VTX_Hellfire_AGM114K: ACE_Hellfire_AGM114K {
Expand Down Expand Up @@ -132,5 +133,34 @@ class CfgAmmo {
// https://ace3mod.com/wiki/framework/frag-framework.html

};
class vtx_ammo_Missile_HARM_HL : ammo_Missile_HARM {
hit = 0;
indirectHit = 0;
//autoSeekTarget = 0;
//flightProfiles[] = {LOALDistance};
//manualControl = 1;
//missileLockMinDistance = 50;
//missileLockMaxDistance = 2000;
//maxControlRange = 10000;
// missileKeepLockedCone = 90;
//missileLockCone = 160;
//missileLockMaxSpeed = 120;
//lockType = 1;
//lockSeekRadius = 2000;
displayName = "AGM-88 HL";
displayNameShort = "AGM-88 HL";
description = "Anti Radiation School Project";
descriptionShort = "Anti Radiation School Project";
model = QPATHTOF(hl_88.p3d);
proxyShape = QPATHTOF(hl_88.p3d);
aiAmmoUsageFlags = 128 + 512;
explosionEffects = "vtx_uh60_cardboardExplosion";
//model = "\A3\Weapons_F_Sams\Ammo\Missile_AR_01_F_fly.p3d";
//proxyShape = "\A3\Weapons_F_Sams\Ammo\Missile_AR_01_F.p3d";
craterEffects = "";
soundHit1[] = {"\z\vtx\addons\uh60_weapons\Data\Audio\AGM_88_HL_Impact.ogg", db-10, 1, 2000};
soundHit2[] = {"\z\vtx\addons\uh60_weapons\Data\Audio\AGM_88_HL_Impact.ogg", db-10, 1, 2000};
soundHit3[] = {"\z\vtx\addons\uh60_weapons\Data\Audio\AGM_88_HL_Impact.ogg", db-10, 1, 2000};
};

};
36 changes: 36 additions & 0 deletions addons/uh60_weapons/config/cfgCloudlets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,40 @@ class cfgCloudlets {
randomDirectionPeriodVar = 0;
randomDirectionIntensityVar = 0;
};
class vtx_uh60_confetti : Default {
interval = 0.001;
circleRadius = 1;
circleVelocity[] = {0,0,0};
angleVar = 1;
particleFSLoop = 0;
particleShape = "\A3\data_f\ParticleEffects\Universal\Universal";
particleFSNtieth = 16;
particleFSIndex = 12;
particleFSFrameCount = 8;
animationName = "";
particleType = "Billboard";
timerPeriod = 1;
lifeTime = 2;
moveVelocity[] = {0,10,0};
rotationVelocity = 0;
weight = 10;
volume = 5;
rubbing = 0;
size[] = {0.1};
color[] = {{1,1,1,1}};
animationSpeed[] = {1};
randomDirectionPeriod = 10;
randomDirectionIntensity = 10;
onTimerScript = "";
beforeDestroyScript = "";
blockAIVisibility = 0;
lifeTimeVar = 1;
positionVar[] = {1,1,1};
MoveVelocityVar[] = {1,1,1};
rotationVelocityVar = 0;
sizeVar = 1;
colorVar[] = {1,1,1,1};
randomDirectionPeriodVar = 1;
randomDirectionIntensityVar = 1;
};
};
11 changes: 11 additions & 0 deletions addons/uh60_weapons/config/cfgEffects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,15 @@ class vtx_agm114_explosion
interval = 1;
lifeTime = 0.5;
};
};

class vtx_uh60_cardboardExplosion {
class vtx_uh60_confetti {
simulation = "particles";
type = "vtx_uh60_confetti";
position[] = {0,0.5,0};
intensity = 1;
interval = 1;
lifeTime = 2;
};
};
15 changes: 15 additions & 0 deletions addons/uh60_weapons/config/cfgMagazines.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class cfgMagazines {
class VehicleMagazine;
class PylonMissile_Missile_HARM_x1;
class PylonRack_Missile_HARM_x1;
class PylonRack_4Rnd_ACE_Hellfire_AGM114K;
class PylonRack_4Rnd_ACE_Hellfire_AGM114N;
class VTX_4Rnd_ACE_Hellfire_AGM114K: PylonRack_4Rnd_ACE_Hellfire_AGM114K { // 4x Launcher Support Rack
Expand Down Expand Up @@ -120,4 +122,17 @@ class cfgMagazines {
};
};
};
class VTX_PylonMissile_Missile_HARM_x1_HL: PylonMissile_Missile_HARM_x1 {
hardpoints[] = {"VTX_ST_L","VTX_ST_R","VTX_ST_OUTBOARD","B_HARM_RAIL","I_HARM_RAIL","B_HARM","I_HARM"};
ammo = "vtx_ammo_Missile_HARM_HL";
count = 1;
mass = 10;
author = "Yax (at him on discord)";
displayName = "1x AGM-88 Hobby Lobby [H60]";
displayNameShort = "AGM-88HL";
model = QPATHTOF(hl_88.p3d);
pylonWeapon = "vtx_weapon_HARMLauncher_HL";
descriptionShort="Held together with duct tape and powered by a hobby lobby motor. Explodes into glitter";
description = "Improvised anti radiation munitions, designed by highschoolers. Held together with duct tape and powered by a hobby lobby motor. Carries a payload of confetti and glitter. Guided by a raspberryPI running the 'The Missile knows where it is' meme. It's really just an advanced way to mark a target.";
};
};
17 changes: 17 additions & 0 deletions addons/uh60_weapons/config/cfgWeapons.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
class cfgWeapons {
class MissileLauncher;
class ace_hellfire_launcher;
class ace_hellfire_launcher_L;
class ace_hellfire_launcher_N;
class weapon_HARMLauncher;
class vtx_hellfire_launcher: ace_hellfire_launcher {
ace_laser_showHud = 0;
magazines[] = {"VTX_4Rnd_ACE_Hellfire_AGM114K"};
Expand Down Expand Up @@ -104,4 +106,19 @@ class cfgWeapons {
class Far_AI: Far_AI {displayName = "APKWS";};
class Medium_AI: Medium_AI {displayName = "APKWS";};
};
class vtx_weapon_HARMLauncher_HL : weapon_HARMLauncher {
displayName = "AGM-88HL";
displayNameShort = "AGM-88HL";
magazines[] = {"VTX_PylonMissile_Missile_HARM_x1_HL"};
lockAcquire = 0;
weaponLockDelay = 0;
soundFly[] = {"\z\vtx\addons\uh60_weapons\Data\Audio\AGM_88_HL_Running.ogg", db-10, 1, 2000};
soundLoop[] = {"\z\vtx\addons\uh60_weapons\Data\Audio\AGM_88_HL_Running.ogg", db-10, 1, 2000};
soundBegin[] = {"\z\vtx\addons\uh60_weapons\Data\Audio\AGM_88_HL_Launch.ogg", db-10, 1, 2000};
class Eventhandlers {
class vtx_harm {
fired = "_this call vtx_uh60_weapons_fnc_fired";
};
};
};
};
92 changes: 92 additions & 0 deletions addons/uh60_weapons/functions/fnc_HARMGuidence.sqf
AdozenBABYdogs marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#include "script_component.hpp"

/*
* Author: Donov & Yax
* Flies the missile to a target, or scans for targets to hit
*
* Arguments:
* 0: Projectile <OBJECT>
* 1: Ammo <OBJECT>
*
* Return Value:
* 0: Closest Target (or objNull for no Target) <OBJECT>
*
* Example:
* [_projectile, _ammo] call vtx_uh60_weapons_fnc_getHARMTarget
*/

params ["_projectile", "_ammo"];

[{ //start of Yax's ITC APK Code
(_this select 0) params ["_projectile", "_ammo", "_foundTarget", "_launchTime","_lastFrameTime", "_targetPos"];
//Target pos needs to get passed as a parameter or this does not work
private _frameTime = time - _lastFrameTime;
(_this select 0) set [4, time];

if (!alive _projectile) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};

//Start of Donov HARM Guidance computer
//systemChat "Missile Alive";
_missileTgtPos = [getPosASL _projectile, vectorDir _projectile, _projectile] call ace_laser_fnc_shootRay;
/* Using Shoot ray to determine a spot in space where the missile is looking in front of it
* Then using nearestObjects to pull a list of "AllVehicles" from the radius of the seekerhead
* Then sorting through the list of "AllVehicls" and setting the target as the first vehicle (closest) in the list
* Only choosing vehicles that have radar on (turning off radar and moving should save the vehicle (in theory))
*/
if (!_foundTarget) then {
if ((_missileTgtPos # 1) != 0) then {
_target = [_projectile, ((_missileTgtPos # 1)*5.6712818 + 10), (_missileTgtPos # 0)] call vtx_uh60_weapons_fnc_getHARMTarget;
if (_target != objNull) then {
_targetPos = getPosASL _target;
} else {
_targetPos = (_missileTgtPos # 0);
};
} else {
/* Backup Function to default to _targetPos
* Adds a point 6000m in the distance and flys to that point
* Finds a grid 30 degrees down from the missile and search there for targets
* As the missile flys, it should check the ground for other targets to try and narrow down the position of the target
* Should check missile altitude as well to adjust the radius of the search
*/
_vecDir = [6000 + ((getPosATL _projectile) # 2), getDir _projectile, -30] call CBA_fnc_polar2vect;
_vecDir = vectorNormalized _vecDir;
_missileTgtPos = [getPosASL _projectile, _vecDir, _projectile] call ace_laser_fnc_shootRay;
if ((_missileTgtPos # 1) != 0) then {
_target = [_projectile, ((_missileTgtPos # 1)*5.6712818 + 10), (_missileTgtPos # 0)] call vtx_uh60_weapons_fnc_getHARMTarget;
if (_target != objNull) then {
_targetPos = getPosASL _target;
} else {
_targetPos = (_missileTgtPos # 0);
};
} else {
_targetPos = _projectile vectorModelToWorld [6000, 0, 0];
_targetPos set [2, 0];
};
};
} else {

//End of Donov HARM Guidance Code
if(time > _launchTime + 1 && _targetPos != objNull) then {
_targetCoordinates = _targetPos vectorAdd [0,0,0.2];
_position = getPosASL _projectile;
(_projectile call BIS_fnc_getPitchBank) params ["_pitch", "_bank"];
_vectToTarget = vectorNormalized (_targetCoordinates vectorDiff _position);
_vectToTargetDiff = _vectToTarget vectorDiff (vectorNormalized (velocity _projectile));
_vectorModelSpace = _projectile vectorWorldToModel _vectToTargetDiff;
_angleX = asin (_vectorModelSpace # 0);
_angleY = asin (_vectorModelSpace # 2);
_turnRate = 4 * _frameTime;
_projectile setDir (getDir _projectile) + ((_turnRate * _angleX) min _angleX);
[_projectile, _pitch + ((_turnRate * _angleY) min _angleY), 0] call BIS_fnc_setPitchBank;
};
};
}, 0, [_projectile, _ammo, false, time, time, getPos _projectile]] call CBA_fnc_addPerFrameHandler;
//End of Yax's ITC APK Code






14 changes: 14 additions & 0 deletions addons/uh60_weapons/functions/fnc_fired.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,18 @@ if (_ammo == "VTX_Hellfire_AGM114K" || _ammo == "VTX_Hellfire_AGM114N") then {

if (player == _gunner && local _gunner) then {
[_vehicle] call vtx_uh60_weapons_fnc_updateMFDValues;
};

//spaggetti code: Mix of Yax's ITC Air APKs and HARM Guidance by Donov
if (_ammo == "vtx_ammo_Missile_HARM_HL" && vehicle _gunner == _vehicle) then {
_index = 0; //reset index to enter while loop
while {_index < 4} do {
if ((getPylonMagazines _vehicle # _index) == "PylonMissile_Missile_HARM_x1_HL") then {
if (_vehicle ammoOnPylon (_index + 1) == 0) then { _vehicle setPylonLoadout [(_index + 1), "", true]; /*systemChat "Reset Pylon"*/};
//This loop checks for which HARM was fired, and replaces the pylon with nothing. It removes the missile
};
_index = _index + 1; //python be like
Comment on lines +24 to +29
Copy link
Member

Choose a reason for hiding this comment

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

why do you need to do this, arma automatically removes munitions from pylons when firing already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because arma decided that it didn't want to remove the pylon when it fired

Copy link
Member

Choose a reason for hiding this comment

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

that's because the pylons should not be removed. a pylon is a launch rail.
the missile model should only be set on the ammo, the pylon model should be a launch rail or nothing

};
[_projectile, _ammo] call vtx_uh60_weapons_fnc_HARMGuidance;

};
Loading