diff --git a/addons/grenades/CfgAmmo.hpp b/addons/grenades/CfgAmmo.hpp new file mode 100644 index 0000000000..17a6744ac7 --- /dev/null +++ b/addons/grenades/CfgAmmo.hpp @@ -0,0 +1,89 @@ +class CfgAmmo { + class FlareCore; + class FlareBase: FlareCore { + intensity = 20000; + flareSize = 12; + }; + class F_40mm_White: FlareBase { + intensity = 40000; + flareSize = 12; + }; + class F_20mm_White: FlareBase { + intensity = 20000; + flareSize = 12; + }; + class F_Signal_Green: FlareBase { + intensity = 20000; + flareSize = 12; + }; + class Flare_82mm_AMOS_White: FlareCore { + intensity = 80000; + flareSize = 12; + }; + + class F_20mm_Red: F_20mm_White {}; + class F_20mm_Green: F_20mm_White {}; + class F_20mm_Yellow: F_20mm_White {}; + + class ACE_F_Hand_White: F_20mm_White { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; + class ACE_F_Hand_Red: F_20mm_Red { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; + class ACE_F_Hand_Green: F_20mm_Green { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; + class ACE_F_Hand_Yellow: F_20mm_Yellow { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; + + class ACE_G_M84: F_20mm_Yellow { + useFlare = 0; + flareSize = 0; + intensity = 0; + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + fuseDistance = 2.3; //todo should this be explosionTime + model = PATHTOF(\models\ACE_m84_thrown.p3d); + }; +}; diff --git a/addons/grenades/CfgEventHandlers.hpp b/addons/grenades/CfgEventHandlers.hpp new file mode 100644 index 0000000000..02f1ac5553 --- /dev/null +++ b/addons/grenades/CfgEventHandlers.hpp @@ -0,0 +1,19 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE( call COMPILE_FILE(XEH_postInitClient) ); + }; +}; + +class Extended_FiredBIS_EventHandlers { + class CAManBase { + class ADDON { + clientFiredBIS = QUOTE( _this call FUNC(throwGrenade) ); + }; + }; +}; diff --git a/addons/grenades/CfgMagazines.hpp b/addons/grenades/CfgMagazines.hpp new file mode 100644 index 0000000000..75b1dfd616 --- /dev/null +++ b/addons/grenades/CfgMagazines.hpp @@ -0,0 +1,60 @@ +class CfgMagazines { + class HandGrenade; + class ACE_HandFlare_Base: HandGrenade { + value = 2; + nameSoundWeapon = "smokeshell"; + nameSound = "smokeshell"; + mass = 4; + initSpeed = 22; + }; + class ACE_HandFlare_White: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_White"; + displayname = "$STR_ACE_Grenades_M127A1_White_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_White_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_White_NameShort"; + model = "\A3\weapons_f\ammo\flare_white"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa"; + }; + class ACE_HandFlare_Red: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_Red"; + displayname = "$STR_ACE_Grenades_M127A1_Red_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_Red_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_Red_NameShort"; + model = "\A3\weapons_f\ammo\flare_red"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa"; + }; + class ACE_HandFlare_Green: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_Green"; + displayname = "$STR_ACE_Grenades_M127A1_Green_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_Green_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_Green_NameShort"; + model = "\A3\weapons_f\ammo\flare_green"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa"; + }; + class ACE_HandFlare_Yellow: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_Yellow"; + displayname = "$STR_ACE_Grenades_M127A1_Yellow_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_Yellow_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_Yellow_NameShort"; + model = "\A3\weapons_f\ammo\flare_yellow"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa"; + }; + class ACE_M84: HandGrenade { + ammo = "ACE_G_M84"; + displayname = "$STR_ACE_Grenades_M84_Name"; + descriptionshort = "$STR_ACE_Grenades_M84_Description"; + displayNameShort = "M84"; + model = PATHTOF(\models\ACE_m84.p3d); + picture = PATHTOF(\UI\ACE_m84_x_ca.paa); + }; + + class 3Rnd_UGL_FlareGreen_F; + class 6Rnd_GreenSignal_F: 3Rnd_UGL_FlareGreen_F { + ammo = "F_40mm_Green"; + initSpeed = 120; + }; + class 6Rnd_RedSignal_F: 6Rnd_GreenSignal_F { + ammo = "F_40mm_Red"; + initSpeed = 120; + }; +}; diff --git a/addons/grenades/CfgVehicles.hpp b/addons/grenades/CfgVehicles.hpp new file mode 100644 index 0000000000..9a0164e24f --- /dev/null +++ b/addons/grenades/CfgVehicles.hpp @@ -0,0 +1,45 @@ +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ + }; + +class CfgVehicles { + class NATO_Box_Base; + class EAST_Box_Base; + class IND_Box_Base; + class Box_NATO_Support_F; + + class Box_NATO_Grenades_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_White,12) + MACRO_ADDITEM(ACE_HandFlare_Green,12) + MACRO_ADDITEM(ACE_M84,12) + }; + }; + + class Box_East_Grenades_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_Yellow,12) + MACRO_ADDITEM(ACE_HandFlare_Red,12) + MACRO_ADDITEM(ACE_M84,12) + }; + }; + + class Box_IND_Grenades_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_Yellow,12) + MACRO_ADDITEM(ACE_HandFlare_Green,12) + MACRO_ADDITEM(ACE_M84,12) + }; + }; + + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_White,12) + MACRO_ADDITEM(ACE_HandFlare_Red,12) + MACRO_ADDITEM(ACE_HandFlare_Green,12) + MACRO_ADDITEM(ACE_HandFlare_Yellow,12) + MACRO_ADDITEM(ACE_M84,12) + }; + }; +}; diff --git a/addons/grenades/CfgWeapons.hpp b/addons/grenades/CfgWeapons.hpp new file mode 100644 index 0000000000..fa28ca4ef0 --- /dev/null +++ b/addons/grenades/CfgWeapons.hpp @@ -0,0 +1,23 @@ +class CfgWeapons { + class GrenadeLauncher; + + class Throw: GrenadeLauncher { + muzzles[] += {"ACE_HandFlare_WhiteMuzzle", "ACE_HandFlare_RedMuzzle", "ACE_HandFlare_GreenMuzzle", "ACE_HandFlare_YellowMuzzle", "ACE_M84Muzzle"}; + class ThrowMuzzle; + class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_White"}; + }; + class ACE_HandFlare_RedMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_Red"}; + }; + class ACE_HandFlare_GreenMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_Green"}; + }; + class ACE_HandFlare_YellowMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_Yellow"}; + }; + class ACE_M84Muzzle: ThrowMuzzle { + magazines[] = {"ACE_M84"}; + }; + }; +}; diff --git a/addons/grenades/XEH_postInitClient.sqf b/addons/grenades/XEH_postInitClient.sqf new file mode 100644 index 0000000000..6c9546bb36 --- /dev/null +++ b/addons/grenades/XEH_postInitClient.sqf @@ -0,0 +1,6 @@ +// by commy2 + +#include "script_component.hpp" + +GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265]; +GVAR(flashbangPPEffectCC) ppEffectForceInNVG true; diff --git a/addons/grenades/XEH_preInit.sqf b/addons/grenades/XEH_preInit.sqf new file mode 100644 index 0000000000..99ed6478fa --- /dev/null +++ b/addons/grenades/XEH_preInit.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" + +PREP(flashbangEffect); +PREP(nextMode); +PREP(throwGrenade); diff --git a/addons/grenades/clientInit.sqf b/addons/grenades/clientInit.sqf deleted file mode 100644 index 343bf82863..0000000000 --- a/addons/grenades/clientInit.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by commy2 - -AGM_Flashbang_CC = ppEffectCreate ["ColorCorrections", 4265]; -AGM_Flashbang_CC ppEffectForceInNVG true; diff --git a/addons/grenades/config.cpp b/addons/grenades/config.cpp index 2a24483a18..0b7e728c1f 100644 --- a/addons/grenades/config.cpp +++ b/addons/grenades/config.cpp @@ -1,47 +1,22 @@ +#include "script_component.hpp" + class CfgPatches { - class AGM_Grenades { + class ADDON { units[] = {}; weapons[] = {}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; author[] = {"commy2", "KoffeinFlummi"}; authorUrl = "https://github.com/commy2/"; + VERSION_CONFIG; }; }; -class CfgFunctions { - class AGM_Grenades { - class AGM_Grenades { - file = "\AGM_Grenades\functions"; - class flashbangEffect; - class nextMode; - class throwGrenade; - }; - }; -}; - -class Extended_PostInit_EventHandlers { - class AGM_Grenades { - clientInit = "call compile preprocessFileLineNumbers '\AGM_Grenades\clientInit.sqf'"; - }; -}; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class AGM_Grenades_ThrowGrenade { - clientFiredBIS = "if (_this select 0 == AGM_player) then {_this call AGM_Grenades_fnc_throwGrenade;};"; - }; - }; -}; - -class AGM_Core_Default_Keys { +class ACE_Core_Default_Keys { class switchGrenadeMode { - displayName = "$STR_AGM_Grenades_SwitchGrenadeMode"; - condition = "[_player] call AGM_Core_fnc_canUseWeapon"; - statement = "call AGM_Grenades_fnc_nextMode"; + displayName = "$STR_ACE_Grenades_SwitchGrenadeMode"; + condition = "[_player] call ACE_Core_fnc_canUseWeapon"; + statement = "call ACE_Grenades_fnc_nextMode"; key = 9;//34; shift = 0; control = 0; @@ -49,224 +24,8 @@ class AGM_Core_Default_Keys { }; }; -class CfgAmmo { - class FlareCore; - class FlareBase: FlareCore { - intensity = 20000; - flareSize = 12; - }; - class F_40mm_White: FlareBase { - intensity = 40000; - flareSize = 12; - }; - class F_20mm_White: FlareBase { - intensity = 20000; - flareSize = 12; - }; - class F_Signal_Green: FlareBase { - intensity = 20000; - flareSize = 12; - }; - class Flare_82mm_AMOS_White: FlareCore { - intensity = 80000; - flareSize = 12; - }; - - class F_20mm_Red: F_20mm_White {}; - class F_20mm_Green: F_20mm_White {}; - class F_20mm_Yellow: F_20mm_White {}; - - class AGM_F_Hand_White: F_20mm_White { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class AGM_F_Hand_Red: F_20mm_Red { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class AGM_F_Hand_Green: F_20mm_Green { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class AGM_F_Hand_Yellow: F_20mm_Yellow { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - - - class AGM_G_M84: F_20mm_Yellow { - useFlare = 0; - flareSize = 0; - intensity = 0; - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - fuseDistance = 2.3; - model = "agm_grenades\agm_m84_thrown.p3d"; - }; -}; - -class CfgMagazines { - class HandGrenade; - class AGM_HandFlare_Base: HandGrenade { - value = 2; - nameSoundWeapon = "smokeshell"; - nameSound = "smokeshell"; - mass = 4; - initSpeed = 22; - }; - class AGM_HandFlare_White: AGM_HandFlare_Base { - ammo = "AGM_F_Hand_White"; - displayname = "$STR_AGM_Grenades_M127A1_White_Name"; - descriptionshort = "$STR_AGM_Grenades_M127A1_White_Description"; - displayNameShort = "$STR_AGM_Grenades_M127A1_White_NameShort"; - model = "\A3\weapons_f\ammo\flare_white"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa"; - }; - class AGM_HandFlare_Red: AGM_HandFlare_Base { - ammo = "AGM_F_Hand_Red"; - displayname = "$STR_AGM_Grenades_M127A1_Red_Name"; - descriptionshort = "$STR_AGM_Grenades_M127A1_Red_Description"; - displayNameShort = "$STR_AGM_Grenades_M127A1_Red_NameShort"; - model = "\A3\weapons_f\ammo\flare_red"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa"; - }; - class AGM_HandFlare_Green: AGM_HandFlare_Base { - ammo = "AGM_F_Hand_Green"; - displayname = "$STR_AGM_Grenades_M127A1_Green_Name"; - descriptionshort = "$STR_AGM_Grenades_M127A1_Green_Description"; - displayNameShort = "$STR_AGM_Grenades_M127A1_Green_NameShort"; - model = "\A3\weapons_f\ammo\flare_green"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa"; - }; - class AGM_HandFlare_Yellow: AGM_HandFlare_Base { - ammo = "AGM_F_Hand_Yellow"; - displayname = "$STR_AGM_Grenades_M127A1_Yellow_Name"; - descriptionshort = "$STR_AGM_Grenades_M127A1_Yellow_Description"; - displayNameShort = "$STR_AGM_Grenades_M127A1_Yellow_NameShort"; - model = "\A3\weapons_f\ammo\flare_yellow"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa"; - }; - class AGM_M84: HandGrenade { - ammo = "AGM_G_M84"; - displayname = "$STR_AGM_Grenades_M84_Name"; - descriptionshort = "$STR_AGM_Grenades_M84_Description"; - displayNameShort = "M84"; - model = "agm_grenades\agm_m84.p3d"; - picture = "\agm_grenades\UI\agm_m84_x_ca.paa"; - }; - - class 3Rnd_UGL_FlareGreen_F; - class 6Rnd_GreenSignal_F: 3Rnd_UGL_FlareGreen_F { - ammo = "F_40mm_Green"; - initSpeed = 120; - }; - class 6Rnd_RedSignal_F: 6Rnd_GreenSignal_F { - ammo = "F_40mm_Red"; - initSpeed = 120; - }; -}; - -class CfgWeapons { - class GrenadeLauncher; - - class Throw: GrenadeLauncher { - muzzles[] += {"AGM_HandFlare_WhiteMuzzle", "AGM_HandFlare_RedMuzzle", "AGM_HandFlare_GreenMuzzle", "AGM_HandFlare_YellowMuzzle", "AGM_M84Muzzle"}; - class ThrowMuzzle; - class AGM_HandFlare_WhiteMuzzle: ThrowMuzzle { - magazines[] = {"AGM_HandFlare_White"}; - }; - class AGM_HandFlare_RedMuzzle: ThrowMuzzle { - magazines[] = {"AGM_HandFlare_Red"}; - }; - class AGM_HandFlare_GreenMuzzle: ThrowMuzzle { - magazines[] = {"AGM_HandFlare_Green"}; - }; - class AGM_HandFlare_YellowMuzzle: ThrowMuzzle { - magazines[] = {"AGM_HandFlare_Yellow"}; - }; - class AGM_M84Muzzle: ThrowMuzzle { - magazines[] = {"AGM_M84"}; - }; - }; -}; - -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ -}; - -class CfgVehicles { - class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class Box_NATO_Support_F; - - class Box_NATO_Grenades_F: NATO_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_HandFlare_White,12) - MACRO_ADDITEM(AGM_HandFlare_Green,12) - MACRO_ADDITEM(AGM_M84,12) - }; - }; - - class Box_East_Grenades_F: EAST_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_HandFlare_Yellow,12) - MACRO_ADDITEM(AGM_HandFlare_Red,12) - MACRO_ADDITEM(AGM_M84,12) - }; - }; - - class Box_IND_Grenades_F: IND_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_HandFlare_Yellow,12) - MACRO_ADDITEM(AGM_HandFlare_Green,12) - MACRO_ADDITEM(AGM_M84,12) - }; - }; - - class AGM_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(AGM_HandFlare_White,12) - MACRO_ADDITEM(AGM_HandFlare_Red,12) - MACRO_ADDITEM(AGM_HandFlare_Green,12) - MACRO_ADDITEM(AGM_HandFlare_Yellow,12) - MACRO_ADDITEM(AGM_M84,12) - }; - }; -}; +#include "CfgEventHandlers.hpp" +#include "CfgAmmo.hpp" +#include "CfgWeapons.hpp" +#include "CfgMagazines.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/grenades/functions/fn_flashbangEffect.sqf b/addons/grenades/functions/fn_flashbangEffect.sqf index 97d448c6f2..ab3501a1ea 100644 --- a/addons/grenades/functions/fn_flashbangEffect.sqf +++ b/addons/grenades/functions/fn_flashbangEffect.sqf @@ -11,6 +11,8 @@ * None */ +#include "script_component.hpp" + _this spawn { _unit = _this select 0; _grenade = _this select 1; @@ -45,8 +47,8 @@ _this spawn { }; // beeeeeeeeeeeeeeeeeeeeeeeeeeeeep - if (isClass (configFile >> "CfgPatches" >> "AGM_Hearing") and _strength > 0) then { - [_unit, 0.5 + (_strength / 2)] call AGM_Hearing_fnc_earRinging; + if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") and _strength > 0) then { + [_unit, 0.5 + (_strength / 2)] call ACE_Hearing_fnc_earRinging; }; // account for people looking away by slightly @@ -73,9 +75,9 @@ _this spawn { // blind player if (_strength > 0.1) then { - AGM_Flashbang_CC ppEffectEnable true; - AGM_Flashbang_CC ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; - AGM_Flashbang_CC ppEffectCommit 0.01; + GVAR(flashbangPPEffectCC) ppEffectEnable true; + GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; + GVAR(flashbangPPEffectCC) ppEffectCommit 0.01; }; sleep 0.1; @@ -83,11 +85,11 @@ _this spawn { sleep (7 * _strength); if (_strength > 0.1) then { - AGM_Flashbang_CC ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; - AGM_Flashbang_CC ppEffectCommit (10 * _strength); + GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; + GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength); sleep (10 * _strength); - AGM_Flashbang_CC ppEffectEnable false; + GVAR(flashbangPPEffectCC) ppEffectEnable false; }; }; diff --git a/addons/grenades/functions/fn_nextMode.sqf b/addons/grenades/functions/fn_nextMode.sqf index b3a1445dc4..4c33c58e92 100644 --- a/addons/grenades/functions/fn_nextMode.sqf +++ b/addons/grenades/functions/fn_nextMode.sqf @@ -10,9 +10,11 @@ * Nothing */ +#include "script_component.hpp" + private ["_mode", "_hint"]; -_mode = missionNamespace getVariable ["AGM_Grenades_Mode", 0]; +_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode == 4) then { _mode = 0; @@ -26,13 +28,13 @@ if (_mode == 3) then { }; _hint = [ - localize "STR_AGM_Grenades_NormalThrow", - localize "STR_AGM_Grenades_HighThrow", - localize "STR_AGM_Grenades_PreciseThrow", - localize "STR_AGM_Grenades_RollGrenade", - localize "STR_AGM_Grenades_DropGrenade" + localize "STR_ACE_Grenades_NormalThrow", + localize "STR_ACE_Grenades_HighThrow", + localize "STR_ACE_Grenades_PreciseThrow", + localize "STR_ACE_Grenades_RollGrenade", + localize "STR_ACE_Grenades_DropGrenade" ] select _mode; -[_hint] call AGM_Core_fnc_displayTextStructured; +[_hint] call EFUNC(common,displayTextStructured); -AGM_Grenades_Mode = _mode; +GVAR(currentThrowMode) = _mode; diff --git a/addons/grenades/functions/fn_throwGrenade.sqf b/addons/grenades/functions/fn_throwGrenade.sqf index ab5e7a1cfd..36dc08ce1a 100644 --- a/addons/grenades/functions/fn_throwGrenade.sqf +++ b/addons/grenades/functions/fn_throwGrenade.sqf @@ -1,26 +1,27 @@ /* - * Author: commy2 - * - * Adjust the grenades throwing direction and speed to the selected throwing mode. - * - * Argument: - * input from "Fired" eventhandler - * - * Return value: - * Nothing - */ +* Author: commy2 +* +* Adjust the grenades throwing direction and speed to the selected throwing mode. +* +* Argument: +* input from "Fired" eventhandler +* +* Return value: +* Nothing +*/ -private ["_unit", "_weapon", "_projectile"]; +#include "script_component.hpp" + +private ["_unit", "_weapon", "_projectile", "_mode", "_fuzeTime"]; _unit = _this select 0; _weapon = _this select 1; _projectile = _this select 6; +if (_unit != ACE_player) exitWith {}; if (_weapon != "Throw") exitWith {}; -private "_mode"; - -_mode = missionNamespace getVariable ["AGM_Grenades_Mode", 0]; +_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode != 0) then { private "_velocity"; @@ -29,23 +30,23 @@ if (_mode != 0) then { switch (_mode) do { //high throw - case 1 : { + case 1 : { _velocity = [ - 0.5 * (_velocity select 0), - 0.5 * (_velocity select 1), - [0, 0, 0] distance (_velocity vectorMultiply 0.5) + 0.5 * (_velocity select 0), + 0.5 * (_velocity select 1), + [0, 0, 0] distance (_velocity vectorMultiply 0.5) ]; }; //precise throw - case 2 : { + case 2 : { _velocity = (_unit weaponDirection _weapon) vectorMultiply (vectorMagnitude _velocity); }; //roll grande - case 3 : { + case 3 : { //@todo }; //drop grenade - case 4 : { + case 4 : { _velocity = [0, 0, 0]; }; }; @@ -53,19 +54,8 @@ if (_mode != 0) then { _projectile setVelocity _velocity; }; -if (typeOf _projectile == "AGM_G_M84") then { - _this spawn { - _projectile = _this select 6; - - sleep getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance"); - - if (alive _projectile) then { - playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; - - _affected = _projectile nearEntities ["CAManBase", 50]; - { - [[_x, _projectile], "AGM_Grenades_fnc_flashbangEffect", _x] call AGM_Core_fnc_execRemoteFnc; - } forEach _affected; - }; - }; +if (typeOf _projectile == "ACE_G_M84") then { + // _fuzeTime = (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance"); + _fuzeTime = (configFile >> "CfgAmmo" >> typeOf _projectile >> "explosionTime"); //@toDo pretty sure this should be explosionTime not fuseDistance + [FUNC(flashbangThrownFuze), 0, [_projectile, (time + _fuzeTime)]] call CBA_fnc_addPerFrameHandler; }; diff --git a/addons/grenades/functions/fnc_flashbangExplosion.sqf b/addons/grenades/functions/fnc_flashbangExplosion.sqf new file mode 100644 index 0000000000..5d047ddcbd --- /dev/null +++ b/addons/grenades/functions/fnc_flashbangExplosion.sqf @@ -0,0 +1,19 @@ +#include "script_component.hpp" + +_projectile = (_this select 0) select 0; +_waitUntilTime = (_this select 0) select 1; + +if (_waitUntilTime > time) exitWith {}; + +//remove frameEH +[(_this select 1)] call cba_fnc_removePerFrameHandler; + +if (alive _projectile) then { + playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; + + _affected = _projectile nearEntities ["CAManBase", 50]; + { + // [[_x, _projectile], "ACE_Grenades_fnc_flashbangEffect", _x] call ACE_Core_fnc_execRemoteFnc; + // [[_x, _projectile], "ACE_Grenades_fnc_flashbangEffect", _x] call ACE_Core_fnc_execRemoteFnc; + } forEach _affected; +}; \ No newline at end of file diff --git a/addons/grenades/functions/script_component.hpp b/addons/grenades/functions/script_component.hpp new file mode 100644 index 0000000000..e6a44b8a20 --- /dev/null +++ b/addons/grenades/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\grenades\script_component.hpp" \ No newline at end of file diff --git a/addons/grenades/AGM_M84.p3d b/addons/grenades/models/AGM_M84.p3d similarity index 100% rename from addons/grenades/AGM_M84.p3d rename to addons/grenades/models/AGM_M84.p3d diff --git a/addons/grenades/AGM_M84_thrown.p3d b/addons/grenades/models/AGM_M84_thrown.p3d similarity index 100% rename from addons/grenades/AGM_M84_thrown.p3d rename to addons/grenades/models/AGM_M84_thrown.p3d diff --git a/addons/grenades/stringtable.xml b/addons/grenades/stringtable.xml index 526a3dbf1b..1129d44271 100644 --- a/addons/grenades/stringtable.xml +++ b/addons/grenades/stringtable.xml @@ -1,8 +1,8 @@ - + - + Switch Grenade Mode Granaten-Modus wechseln Cambiar modo de granada @@ -14,7 +14,7 @@ Cambia tipo di granata Alternar Modo de Granada - + Normal Throw Normaler Wurf Lanzamiento normal @@ -26,7 +26,7 @@ Lancio normale Arremesso Normal - + High Throw Hoher Wurf Lanzamiento alto @@ -38,7 +38,7 @@ Lancio verso l'alto Arremesso Alto - + Precise Throw Präziser Wurf Lanzamiento preciso @@ -50,7 +50,7 @@ Lancio preciso Arremesso Preciso - + Roll Grenade Granate rollen Rodar granada @@ -62,7 +62,7 @@ Fai rotolare la granata Rolar Granada - + Drop Grenade Granate fallenlassen Soltar granada @@ -74,7 +74,7 @@ Lascia la granata Largar Granada - + M84 Stun Grenade M84 Blendgranate Granada aturdidora M84 @@ -86,7 +86,7 @@ Granata Stordente M84 M84 granada de atordoamento - + Also known as flashbang. Causes immediate flash blindness, deafness, tinnitus, and inner ear disturbance. Verursacht temporäre Blind- und Taubheit. Produce de manera inmediata ceguera, sordera, tinitus y afecta el oído interior. @@ -98,7 +98,7 @@ Anche conosciuta come flashbang. Causa accecamento immediato, sensazioni di sposatezza, mancanza d'equilibrio e disturbi al timpano. Um tipo de granada não-letal destinado a confundir, desorientar e distrair uma potencial ameaça. - + M127A1 Hand Held Signal (White) M127A1 Leuchtmittel (Weiß) M127A1 Světlice (Bílá) @@ -110,7 +110,7 @@ Bengala M127A1 (Blanca) M127A1 Feux à main (Blanc) - + M127A1 Hand Held Signal (Red) M127A1 Leuchtmittel (Rot) M127A1 Světlice (Červená) @@ -122,7 +122,7 @@ Bengala M127A1 (Roja) M127A1 Feux à main (Rouge) - + M127A1 Hand Held Signal (Green) M127A1 Leuchtmittel (Grün) M127A1 Světlice (Zelená) @@ -134,7 +134,7 @@ Bengala M127A1 (Verde) M127A1 Feux à main (Vert) - + M127A1 Hand Held Signal (Yellow) M127A1 Leuchtmittel (Gelb) M127A1 Světlice (Žlutá) @@ -146,7 +146,7 @@ Bengala M127A1 (Amarilla) M127A1 Feux à main (Jaune) - + White Hand Flare Weiße Leuchtkugel, wird wie eine Granate geworfen. Světlice (Bílá) @@ -158,7 +158,7 @@ Bengala (Blanca) Feux à main (Blanc) - + Red Hand Flare Rote Leuchtkugel, wird wie eine Granate geworfen. Světlice (Červená) @@ -170,7 +170,7 @@ Bengala (Roja) Feux à main (Rouge) - + Green Hand Flare Grüne Leuchtkugel, wird wie eine Granate geworfen. Světlice (Zelená) @@ -182,7 +182,7 @@ Bengala (Verde) Feux à main (Vert) - + Yellow Hand Flare Gelbe Leuchtkugel, wird wie eine Granate geworfen. Světlice Žlutá @@ -194,7 +194,7 @@ Bengala (Amarilla) Feux à main (Jaune) - + M127A1 (White) M127A1 (Weiß) M127A1 (Bílá) @@ -206,7 +206,7 @@ M127A1 (Белый) M127A1 (Blanca) - + M127A1 (Red) M127A1 (Rot) M127A1 (Červená) @@ -218,7 +218,7 @@ M127A1 (Красный) M127A1 (Roja) - + M127A1 (Green) M127A1 (Grün) M127A1 (Zelená) @@ -230,7 +230,7 @@ M127A1 (Зелёный) M127A1 (Verde) - + M127A1 (Yellow) M127A1 (Gelb) M127A1 (Žlutá) diff --git a/addons/grenades/data/agm_m84.rvmat b/addons/grenades/textures/agm_m84.rvmat similarity index 100% rename from addons/grenades/data/agm_m84.rvmat rename to addons/grenades/textures/agm_m84.rvmat diff --git a/addons/grenades/data/agm_m84_co.paa b/addons/grenades/textures/agm_m84_co.paa similarity index 100% rename from addons/grenades/data/agm_m84_co.paa rename to addons/grenades/textures/agm_m84_co.paa diff --git a/addons/grenades/data/agm_m84_nohq.paa b/addons/grenades/textures/agm_m84_nohq.paa similarity index 100% rename from addons/grenades/data/agm_m84_nohq.paa rename to addons/grenades/textures/agm_m84_nohq.paa diff --git a/addons/grenades/data/agm_m84_smdi.paa b/addons/grenades/textures/agm_m84_smdi.paa similarity index 100% rename from addons/grenades/data/agm_m84_smdi.paa rename to addons/grenades/textures/agm_m84_smdi.paa