From f81f5830c54019bd69ee560260536951b980018f Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 6 Dec 2018 20:28:13 -0600 Subject: [PATCH] Illumination Flares (#4506) * Illumination Flares * add M992 IR flare * update debug script * comments --- addons/grenades/CfgAmmo.hpp | 17 ++++++++++- addons/grenades/CfgMagazineWells.hpp | 5 ++++ addons/grenades/CfgMagazines.hpp | 31 ++++++++++++++++++++ addons/grenades/config.cpp | 1 + addons/grenades/dev/dev_testFlares.sqf | 39 ++++++++++++++++++++++++++ addons/grenades/stringtable.xml | 18 ++++++++++++ 6 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 addons/grenades/CfgMagazineWells.hpp create mode 100644 addons/grenades/dev/dev_testFlares.sqf diff --git a/addons/grenades/CfgAmmo.hpp b/addons/grenades/CfgAmmo.hpp index 47b4cee5b1..c52ec34d04 100644 --- a/addons/grenades/CfgAmmo.hpp +++ b/addons/grenades/CfgAmmo.hpp @@ -5,7 +5,7 @@ class CfgAmmo { GVAR(pullPinSound)[] = {"A3\sounds_f\weapons\grenades\Grenade_PullPin.wss", 1.5, 1, 10}; impactGroundSoft[] = {}; }; - + class FlareCore; class FlareBase: FlareCore { intensity = 20000; @@ -17,6 +17,21 @@ class CfgAmmo { intensity = 40000; flareSize = 12; }; + class ACE_40mm_Flare_white: F_40mm_White { + intensity = 1250000; // vanilla: 10000 + timeToLive = 45; // vanilla: 25, ace changes to 60 in FlareBase + coefGravity = 0.25; // vanilla: undefined (would be 1) + // Makes the ammo fall the ground slower (~2 m/s) + }; + class ACE_40mm_Flare_red: ACE_40mm_Flare_white { + lightColor[] = {0.5,0.25,0.25,0}; + }; + class ACE_40mm_Flare_green: ACE_40mm_Flare_white { + lightColor[] = {0.25,0.5,0.25,0}; + }; + class ACE_40mm_Flare_ir: ACE_40mm_Flare_white { + nvgOnly = 1; + }; class F_20mm_White: FlareBase { intensity = 20000; diff --git a/addons/grenades/CfgMagazineWells.hpp b/addons/grenades/CfgMagazineWells.hpp new file mode 100644 index 0000000000..0ce8abca35 --- /dev/null +++ b/addons/grenades/CfgMagazineWells.hpp @@ -0,0 +1,5 @@ +class CfgMagazineWells { + class CBA_40mm_M203 { + ADDON[] = {"ACE_40mm_flare_white", "ACE_40mm_flare_red", "ACE_40mm_flare_green", "ACE_40mm_flare_ir"}; + }; +}; diff --git a/addons/grenades/CfgMagazines.hpp b/addons/grenades/CfgMagazines.hpp index c345a913ac..7faf13c9e1 100644 --- a/addons/grenades/CfgMagazines.hpp +++ b/addons/grenades/CfgMagazines.hpp @@ -89,4 +89,35 @@ class CfgMagazines { ammo = "F_40mm_Red"; initSpeed = 120; }; + + class UGL_FlareWhite_F; + class ACE_40mm_Flare_white: UGL_FlareWhite_F { + author = ECSTRING(common,ACETeam); + ammo = "ACE_40mm_Flare_white"; + displayName = CSTRING(40mm_flare_white); + descriptionShort = CSTRING(parachute_flare_description); + }; + + class UGL_FlareRed_F; + class ACE_40mm_Flare_red: UGL_FlareRed_F { + author = ECSTRING(common,ACETeam); + ammo = "ACE_40mm_Flare_red"; + displayName = CSTRING(40mm_flare_red); + descriptionShort = CSTRING(parachute_flare_description); + }; + + class UGL_FlareGreen_F; + class ACE_40mm_Flare_green: UGL_FlareGreen_F { + author = ECSTRING(common,ACETeam); + ammo = "ACE_40mm_Flare_green"; + displayName = CSTRING(40mm_flare_green); + descriptionShort = CSTRING(parachute_flare_description); + }; + + class ACE_40mm_Flare_ir: UGL_FlareWhite_F { + author = ECSTRING(common,ACETeam); + ammo = "ACE_40mm_Flare_ir"; + displayName = CSTRING(40mm_flare_ir); + descriptionShort = CSTRING(parachute_flare_ir_description); + }; }; diff --git a/addons/grenades/config.cpp b/addons/grenades/config.cpp index c836b613e1..326308a5eb 100644 --- a/addons/grenades/config.cpp +++ b/addons/grenades/config.cpp @@ -25,6 +25,7 @@ class CfgPatches { #include "CfgAmmo.hpp" #include "CfgWeapons.hpp" #include "CfgMagazines.hpp" +#include "CfgMagazineWells.hpp" #include "CfgVehicles.hpp" #include "Effects.hpp" diff --git a/addons/grenades/dev/dev_testFlares.sqf b/addons/grenades/dev/dev_testFlares.sqf new file mode 100644 index 0000000000..e883a90c65 --- /dev/null +++ b/addons/grenades/dev/dev_testFlares.sqf @@ -0,0 +1,39 @@ +// execVM "z\ace\addons\grenades\dev\dev_testFlares.sqf"; + +removeAllWeapons player; + +player addMagazine "UGL_FlareWhite_F"; +player addMagazine "UGL_FlareWhite_F"; +player addMagazine "ACE_40mm_Flare_white"; +player addMagazine "ACE_40mm_Flare_white"; +player addMagazine "ACE_40mm_Flare_green"; +player addMagazine "ACE_40mm_Flare_red"; +player addMagazine "ACE_40mm_Flare_ir"; +player linkItem "NVGoggles"; +skipTime 12; + +player addWeapon "arifle_MX_GL_ACO_F"; + +["ace_firedPlayer", { + params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; + systemChat str _magazine; + [{ + params ["_args", "_pfid"]; + _args params ["_projectile", "_launchHeight", "_shotTime", "_deployedTime"]; + if (!alive _projectile) exitWith {[_pfid] call CBA_fnc_removePerFrameHandler;}; + + private _out = format ["Flight time: %1\n", (time - _shotTime) toFixed 1]; + if (_deployedTime < 0) then { + if ((vectorMagnitude velocity _projectile) < 10) then { + _args set [3, time]; + }; + } else { + _out = _out + format ["Deployed time: %1\n", (time - _deployedTime) toFixed 1]; + }; + _out = _out + format ["Height Above Launch: %1\n", (((getPosASL _projectile) select 2) - _launchHeight) toFixed 1]; + _out = _out + format ["Height Above Terrain: %1\n", ((getPosATL _projectile) select 2) toFixed 1]; + _out = _out + format ["Speed: %1\nVelocity:\n%2\n", (vectorMagnitude velocity _projectile) toFixed 1, (velocity _projectile) apply {_x toFixed 1}]; + + hintSilent _out; + }, 0.1, [_projectile, (getPosASL _unit) select 2, time, -1]] call CBA_fnc_addPerFrameHandler; +}] call CBA_fnc_addEventHandler; diff --git a/addons/grenades/stringtable.xml b/addons/grenades/stringtable.xml index d89ff53044..7c45f4094e 100644 --- a/addons/grenades/stringtable.xml +++ b/addons/grenades/stringtable.xml @@ -373,5 +373,23 @@ 燃烧手榴弹是用来摧毁武器,弹药以及其他装备的好帮手。 燃燒手榴彈是用來摧毀武器,彈藥以及其他裝備的好幫手 + + Type: Star Parachute Flare + + + M583 Illumination Flare (White) + + + M662 Illumination Flare (Red) + + + M661 Illumination Flare (Green) + + + Type: Parachute IR Flare + + + M992 Illumination IR Flare +