Skip to content

Commit

Permalink
Grenades - Add throwable explosive charges (#7860)
Browse files Browse the repository at this point in the history
* First pass on adding throwable explosives

* Moved fnc call to postinit

* Disabled gits auto CRLF bs

* Changing fnc name and call

* Move names to string table

* Using vanilla icon and removing explosive depend

* More stringtable conversions

* Missing semi-colons causing RPT error

* Update addons/grenades/stringtable.xml

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Remove empty strings

* Update addons/grenades/stringtable.xml

Co-authored-by: Elgin675 <elgin675@hotmail.com>

* Add compatibility with "realistic names" modules, and add french translation

* Fix little mistake

* Update addons/grenades/stringtable.xml

Co-authored-by: Elgin675 <elgin675@hotmail.com>

* Add setting

* Change setting name, use ace_settingsInitialized

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: Elgin675 <elgin675@hotmail.com>
  • Loading branch information
3 people authored Aug 24, 2020
1 parent 311dcde commit b215356
Show file tree
Hide file tree
Showing 12 changed files with 257 additions and 8 deletions.
50 changes: 49 additions & 1 deletion addons/grenades/CfgAmmo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class CfgAmmo {
effectsSmoke = "ACE_M84FlashbangEffect";
whistleDist = 0;
};

class ACE_G_CTS9: ACE_G_M84 {
GVAR(flashbang) = 1;
GVAR(flashbangBangs) = 9;
Expand Down Expand Up @@ -171,4 +171,52 @@ class CfgAmmo {
whistleDist = 0; // no BIS explosion effects
whistleOnFire = 0; // no BIS firing effects
};

class ACE_SatchelCharge_Remote_Ammo_Thrown: Grenade {
model = "\A3\Weapons_F\Explosives\satchel";
hit = 3000;
indirectHit = 3000;
indirectHitRange = 5;
defaultMagazine = "ACE_SatchelCharge_Remote_Mag_Throwable";
soundHit1[] = {"A3\Sounds_F\arsenal\explosives\bombs\Explosion_satchel_01", 3.16228, 1, 1500};
soundHit2[] = {"A3\Sounds_F\arsenal\explosives\bombs\Explosion_satchel_02", 3.16228, 1, 1500};
multiSoundHit[] = {"soundHit1", 0.5, "soundHit2", 0.5};
ExplosionEffects = "MineNondirectionalExplosion";
CraterEffects = "MineNondirectionalCrater";
whistleDist = 10;
SoundSetExplosion[] = {"ClaymoreMine_Exp_SoundSet", "ClaymoreMine_Tail_SoundSet", "Explosion_Debris_SoundSet"};
timeToLive = 8;
fuseDistance = 0;
explosionTime = 7;
deflectionSlowDown = 0.1;
explosionType = "bomb";
ACE_damageType = "explosive";
EGVAR(frag,skip) = 1;
EGVAR(advanced_throwing,torqueMagnitude) = "(5 + random 20) * selectRandom [1, -1]";
GVAR(pullPinSound)[] = {"A3\Sounds_F_Orange\arsenal\explosives\Handling\ExplosiveSatchel_TouchOff_01.wss", 2, 1, 50};
class CamShakeExplode {
power = 20;
duration = 2;
frequency = 20;
distance = 250;
};
};

class ACE_DemoCharge_Remote_Ammo_Thrown: ACE_SatchelCharge_Remote_Ammo_Thrown {
model = "\A3\Weapons_F\explosives\c4_charge_small";
hit = 500;
indirectHit = 500;
defaultMagazine = "ACE_DemoCharge_Remote_Mag_Throwable";
soundHit[] = {"A3\Sounds_F\arsenal\explosives\bombs\Explosive_Charge", 3.16228, 1, 1500};
ExplosionEffects = "MineNondirectionalExplosionSmall";
CraterEffects = "MineNondirectionalCraterSmall";
whistleDist = 32;
SoundSetExplosion[] = {"ExplosiveCharge_Exp_SoundSet", "ExplosiveCharge_Tail_SoundSet", "Explosion_Debris_SoundSet"};
class CamShakeExplode {
power = 10;
duration = 2;
frequency = 20;
distance = 250;
};
};
};
43 changes: 42 additions & 1 deletion addons/grenades/CfgMagazines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CfgMagazines {
ammo = "ACE_G_M84";
mass = 4;
};

class ACE_CTS9: HandGrenade {
author = ECSTRING(common,ACETeam);
displayname = CSTRING(CTS9_Name);
Expand Down Expand Up @@ -131,4 +131,45 @@ class CfgMagazines {
displayName = CSTRING(40mm_flare_ir);
descriptionShort = CSTRING(parachute_flare_ir_description);
};

class CA_Magazine;
class ACE_SatchelCharge_Remote_Mag_Throwable: CA_Magazine {
author = ECSTRING(common,ACETeam);
ammo = "ACE_SatchelCharge_Remote_Ammo_Thrown";
scope = 1;
picture = "\A3\Weapons_f\data\UI\gear_satchel_CA.paa";
model = "\A3\Weapons_F\Explosives\satchel_i";
displayName = CSTRING(SatchelCharge_Remote_Mag_Throwable);
displayNameShort = "$STR_A3_cfgMagazines_PipeBomb0";
descriptionShort = CSTRING(SatchelCharge_Description);
class Library {
libTextDesc = CSTRING(SatchelCharge_LibText);
};
type = "2* 256";
allowedSlots[] = {901};
value = 5;
mass = 80;
count = 1;
initSpeed = 7.5;
maxLeadSpeed = 0;
nameSound = "satchelcharge";
nameSoundWeapon = "satchelcharge";
sound[] = {"A3\sounds_f\dummysound", 0.000316228, 1, 10};
useAction = 0;
};

class ACE_DemoCharge_Remote_Mag_Throwable: ACE_SatchelCharge_Remote_Mag_Throwable {
ammo = "ACE_DemoCharge_Remote_Ammo_Thrown";
picture = "\A3\Weapons_F\Data\UI\gear_c4_charge_small_CA.paa";
model = "\A3\Weapons_F\explosives\c4_charge_small_d";
displayName = CSTRING(DemoCharge_Remote_Mag_Throwable);
displayNameShort = "$STR_A3_cfgMagazines_DemoCharge0";
descriptionShort = CSTRING(SatchelCharge_Description);
class Library {
libTextDesc = CSTRING(DemoCharge_LibText);
};
allowedSlots[] = {901, 701};
mass = 20;
initSpeed = 12.5;
};
};
12 changes: 10 additions & 2 deletions addons/grenades/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class CfgWeapons {
class GrenadeLauncher;
class Throw: GrenadeLauncher {
muzzles[] += {"ACE_HandFlare_WhiteMuzzle","ACE_HandFlare_RedMuzzle","ACE_HandFlare_GreenMuzzle","ACE_HandFlare_YellowMuzzle","ACE_M84Muzzle","ACE_M14Muzzle","ACE_CTS9Muzzle"};
muzzles[] += {"ACE_HandFlare_WhiteMuzzle","ACE_HandFlare_RedMuzzle","ACE_HandFlare_GreenMuzzle","ACE_HandFlare_YellowMuzzle","ACE_M84Muzzle","ACE_M14Muzzle","ACE_CTS9Muzzle","ACE_SatchelMuzzle","ACE_DemoMuzzle"};

class ThrowMuzzle;
class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle {
Expand All @@ -28,9 +28,17 @@ class CfgWeapons {
class ACE_M14Muzzle: ThrowMuzzle {
magazines[] = {"ACE_M14"};
};

class ACE_CTS9Muzzle: ThrowMuzzle {
magazines[] = {"ACE_CTS9"};
};

class ACE_SatchelMuzzle: ThrowMuzzle {
magazines[] = {"ACE_SatchelCharge_Remote_Mag_Throwable"};
};

class ACE_DemoMuzzle: ThrowMuzzle {
magazines[] = {"ACE_DemoCharge_Remote_Mag_Throwable"};
};
};
};
1 change: 1 addition & 0 deletions addons/grenades/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ PREP(flashbangThrownFuze);
PREP(incendiary);
PREP(nextMode);
PREP(throwGrenade);
PREP(addChangeFuseItemContextMenuOptions);
6 changes: 6 additions & 0 deletions addons/grenades/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
// Statement
[] call FUNC(nextMode);
}, {false}, [9, [false, false, false]], false] call CBA_fnc_addKeybind; //8 Key

["ace_settingsInitialized", {
if (GVAR(convertExplosives)) then {
[] call FUNC(addChangeFuseItemContextMenuOptions);
};
}] call CBA_fnc_addEventHandler;
2 changes: 2 additions & 0 deletions addons/grenades/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initSettings.sqf"

ADDON = true;
4 changes: 3 additions & 1 deletion addons/grenades/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class CfgPatches {
"ACE_HandFlare_Yellow",
"ACE_M84",
"ACE_M14",
"ACE_CTS9"
"ACE_CTS9",
"ACE_SatchelCharge_Remote_Mag_Throwable",
"ACE_DemoCharge_Remote_Mag_Throwable"
};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include "script_component.hpp"
/*
* Author: Cyruz
* Allows conversion of explosive charges in to throwable versions
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_grenades_fnc_addChangeFuseItemContextMenuOptions
*
* Public: No
*/
TRACE_1("addChangeFuseItemContextMenuOptions",_this);

{
_x params ["_mag", "_throwableMag"];

[
_mag,
"CONTAINER",
LLSTRING(convert_fuse),
nil,
"\a3\ui_f\data\igui\cfg\simpletasks\types\destroy_ca.paa",
[
{true},
{
params ["", "", "_item", "", "_magArr"];
_item isEqualTo (_magArr select 0);
}
],
{
params ["_unit", "", "", "", "_magArr"];
_unit addMagazine (_magArr select 1);
false;
},
true,
[_mag,_throwableMag]
] call CBA_fnc_addItemContextMenuOption;

[
_throwableMag,
"CONTAINER",
LLSTRING(remove_fuse),
nil,
"\a3\ui_f\data\igui\cfg\simpletasks\types\destroy_ca.paa",
[
{true},
{
params ["", "", "_item", "", "_magArr"];
_item isEqualTo (_magArr select 1);
}
],
{
params ["_unit", "", "", "", "_magArr"];
_unit addMagazine (_magArr select 0);
false;
},
true,
[_mag,_throwableMag]
] call CBA_fnc_addItemContextMenuOption;
} forEach [
["SatchelCharge_Remote_Mag", "ACE_SatchelCharge_Remote_Mag_Throwable"],
["DemoCharge_Remote_Mag", "ACE_DemoCharge_Remote_Mag_Throwable"]
];
9 changes: 9 additions & 0 deletions addons/grenades/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
QGVAR(convertExplosives), "CHECKBOX",
[LSTRING(convertExplosives_DisplayName), LSTRING(convertExplosives_Description)],
LSTRING(Settings_DisplayName),
true,
true,
{},
true
] call CBA_fnc_addSetting;
50 changes: 50 additions & 0 deletions addons/grenades/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -508,5 +508,55 @@
<Czech>M992 Infračervená světlice</Czech>
<Turkish>M992 Illumination IR Flare</Turkish>
</Key>
<Key ID="STR_ACE_Grenades_SatchelCharge_Remote_Mag_Throwable">
<English>Explosive Satchel (Throwable)</English>
<French>Charge en sacoche (lançable)</French>
</Key>
<Key ID="STR_ACE_Grenades_SatchelCharge_Description">
<English>Type: Charge&lt;br /&gt;Rounds: 1&lt;br /&gt;Used on: Things that need to die</English>
<French>Type : Charge&lt;br /&gt;Munitions : 1&lt;br /&gt;Application : à balancer sur des trucs qui doivent mourir</French>
</Key>
<Key ID="STR_ACE_Grenades_SatchelCharge_LibText">
<English>An explosive satchel that is throwable. 7 second fixed fuse</English>
<French>Charge explosive lançable. Détonation après 7 secondes.</French>
</Key>
<Key ID="STR_ACE_Grenades_DemoCharge_Remote_Mag_Throwable">
<English>Explosive Charge (Throwable)</English>
<French>Charge explosive (lançable)</French>
</Key>
<Key ID="STR_ACE_Grenades_DemoCharge_LibText">
<English>An explosive charge that is throwable. 7 second fixed fuse</English>
<French>Bloc explosif lançable. Détonation après 7 secondes.</French>
</Key>
<Key ID="STR_ACE_Grenades_Convert_Fuse">
<English>Convert to short fuse</English>
<French>Mèche lente (7 secondes)</French>
</Key>
<Key ID="STR_ACE_Grenades_Remove_Fuse">
<English>Remove short fuse</English>
<French>Retirer la mèche lente</French>
</Key>
<Key ID="STR_ACE_Grenades_Settings_DisplayName">
<English>ACE Grenades</English>
<German>ACE Granaten</German>
<Czech>ACE Granáty</Czech>
<Polish>ACE Granaty</Polish>
<Italian>ACE Granate</Italian>
<Spanish>ACE Granadas</Spanish>
<French>ACE Grenades</French>
<Portuguese>ACE Granadas</Portuguese>
<Russian>ACE Гранаты</Russian>
<Japanese>ACE 手榴弾</Japanese>
<Korean>ACE 수류탄</Korean>
<Chinesesimp>ACE 手榴弹</Chinesesimp>
<Chinese>ACE 手榴彈</Chinese>
<Turkish>ACE Bombalar</Turkish>
</Key>
<Key ID="STR_ACE_Grenades_convertExplosives_DisplayName">
<English>Allow Explosive Conversion</English>
</Key>
<Key ID="STR_ACE_Grenades_convertExplosives_Description">
<English>Allow converting explosives to throwables</English>
</Key>
</Package>
</Project>
8 changes: 7 additions & 1 deletion addons/realisticnames/CfgMagazines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,12 @@ class CfgMagazines {
class DemoCharge_Remote_Mag: SatchelCharge_Remote_Mag {
displayName = CSTRING(DemoCharge_Name);
};
class ACE_SatchelCharge_Remote_Mag_Throwable: SatchelCharge_Remote_Mag {
displayName = CSTRING(SatchelChargeThrowable_Name);
};
class ACE_DemoCharge_Remote_Mag_Throwable: ACE_SatchelCharge_Remote_Mag_Throwable {
displayName = CSTRING(DemoChargeThrowable_Name);
};

// hand grenades
class HandGrenade: CA_Magazine {
Expand Down Expand Up @@ -474,7 +480,7 @@ class CfgMagazines {
};
class PylonRack_7Rnd_Rocket_04_HE_F: 7Rnd_Rocket_04_HE_F {
displayName = "Hydra 70 7x HE"; // [vanilla: Shrieker 7x HE - Rocket_04_HE_Plane_CAS_01_F]
};
};
class PylonRack_7Rnd_Rocket_04_AP_F: 7Rnd_Rocket_04_AP_F {
displayName = "Hydra 70 7x AP"; // [vanilla: Shrieker 7x AP - Rocket_04_AP_Plane_CAS_01_F]
};
Expand Down
12 changes: 10 additions & 2 deletions addons/realisticnames/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@
<Spanish>Conjunto de carga de demolición M183</Spanish>
<Polish>Ładunek burzący M183</Polish>
<Czech>Demoliční nálož M183</Czech>
<French>M183 Charge de Démolition</French>
<French>M183 Charge de démolition</French>
<Russian>M183 Комплектный подрывной заряд</Russian>
<Portuguese>M183 Sacola de Demolição</Portuguese>
<Hungarian>M183 romboló töltet</Hungarian>
Expand All @@ -1323,13 +1323,17 @@
<Chinesesimp>M183炸药包</Chinesesimp>
<Turkish>M183 Demolition Charge Assembly</Turkish>
</Key>
<Key ID="STR_ACE_RealisticNames_SatchelChargeThrowable_Name">
<English>M183 Demolition Charge (Throwable)</English>
<French>M183 Charge de démolition (lançable)</French>
</Key>
<Key ID="STR_ACE_RealisticNames_DemoCharge_Name">
<English>M112 Demolition Block</English>
<German>M112 Sprengladung</German>
<Spanish>Bloque de demolición M112</Spanish>
<Polish>Ładunek burzący M112</Polish>
<Czech>Výbušná nálož M112</Czech>
<French>M112 Block de Démolition</French>
<French>M112 Bloc de démolition</French>
<Russian>M112 подрывной заряд</Russian>
<Portuguese>M112 Carga de Demolição</Portuguese>
<Hungarian>M112 romboló tömb</Hungarian>
Expand All @@ -1340,6 +1344,10 @@
<Chinesesimp>M112塑性炸药</Chinesesimp>
<Turkish>M112 Demolition Block</Turkish>
</Key>
<Key ID="STR_ACE_RealisticNames_DemoChargeThrowable_Name">
<English>M112 Demolition Charge (Throwable)</English>
<French>M112 Bloc de démolition (lançable)</French>
</Key>
<Key ID="STR_ACE_RealisticNames_HandGrenade_Name">
<English>M67 Fragmentation Grenade</English>
<German>M67 Splittergranate</German>
Expand Down

1 comment on commit b215356

@enragedpixel
Copy link

Choose a reason for hiding this comment

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

is there an intended way for other mods to call this event or patch the CBA forEach call?

Please sign in to comment.