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

Grenades - Add throwable explosive charges #7860

Merged
merged 17 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
54 changes: 53 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,56 @@ 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(explosives,magazine) = "ACE_SatchelCharge_Remote_Mag_Throwable";
EGVAR(explosives,explosive) = "SatchelCharge_Remote_Ammo_Scripted";
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"};
EGVAR(explosives,magazine) = "ACE_DemoCharge_Remote_Mag_Throwable";
EGVAR(explosives,explosive) = "DemoCharge_Remote_Ammo_Scripted";
class CamShakeExplode {
power = 10;
duration = 2;
frequency = 20;
distance = 250;
};
};
};
52 changes: 50 additions & 2 deletions 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,52 @@ 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);
scope = 1;
picture = "\A3\Weapons_f\data\UI\gear_satchel_CA.paa";
model = "\A3\Weapons_F\Explosives\satchel_i";
descriptionShort = "Type: Charge<br />Rounds: 1<br />Used on: Things that need to die";
Cyruz143 marked this conversation as resolved.
Show resolved Hide resolved
class Library {
libTextDesc = "An explosive satchel that is throwable. 7 second fixed fuse";
Cyruz143 marked this conversation as resolved.
Show resolved Hide resolved
};
descriptionUse = "";
type = "2* 256";
allowedSlots[] = {901};
value = 5;
ammo = "ACE_SatchelCharge_Remote_Ammo_Thrown";
mass = 80;
count = 1;
initSpeed = 10;
maxLeadSpeed = 0;
nameSoundWeapon = "satchelcharge";
nameSound = "satchelcharge";
weaponPoolAvailable = 0;
useActionTitle = "";
sound[] = {"A3\sounds_f\dummysound", 0.000316228, 1, 10};
displayName = "Explosive Satchel (Throwable)";
displayNameShort = "Satchel Charge";
Cyruz143 marked this conversation as resolved.
Show resolved Hide resolved
useAction = 0;
EGVAR(explosives,placeable) = 0;
class ACE_Triggers {
SupportedTriggers[] = {};
};
};

class ACE_DemoCharge_Remote_Mag_Throwable: ACE_SatchelCharge_Remote_Mag_Throwable {
picture = "\A3\Weapons_F\Data\UI\gear_c4_charge_small_CA.paa";
model = "\A3\Weapons_F\explosives\c4_charge_small_d";
descriptionShort = "Type: Charge<br />Rounds: 1<br />Used on: Things that need to die";
class Library {
libTextDesc = "An explosive charge that is throwable. 7 second fixed fuse";
};
allowedSlots[] = {901, 701};
ammo = "ACE_DemoCharge_Remote_Ammo_Thrown";
mass = 20;
initSpeed = 15;
displayName = "Explosive Charge (Throwable)";
displayNameShort = "Explosive Charge";
};
};
veteran29 marked this conversation as resolved.
Show resolved Hide resolved
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(changeFuse);
veteran29 marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions addons/grenades/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
["ace_firedNonPlayer", DFUNC(throwGrenade)] call CBA_fnc_addEventHandler;

if (!hasInterface) exitWith {};
call FUNC(changeFuse);
Cyruz143 marked this conversation as resolved.
Show resolved Hide resolved

GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265];
GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
Expand Down
6 changes: 4 additions & 2 deletions addons/grenades/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ 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"};
requiredAddons[] = {"ace_common","ace_explosives"};
author = ECSTRING(common,ACETeam);
authors[] = {"commy2","KoffeinFlummi"};
url = ECSTRING(main,URL);
Expand Down
67 changes: 67 additions & 0 deletions addons/grenades/functions/fnc_changeFuse.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#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_changeFuse
*
* Public: No
*/

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

[
_mag,
"CONTAINER",
"Covert to short fuse",
nil,
QPATHTOEF(explosives,UI\Place_Explosive_ca.paa),
[
{true},
{
params ["", "", "_item", "", "_magArr"];
_item isEqualTo (_magArr #0);
veteran29 marked this conversation as resolved.
Show resolved Hide resolved
}
],
{
params ["_unit", "", "", "", "_magArr"];
_unit addMagazine (_magArr #1);
false;
},
true,
[_mag,_throwableMag]
] call CBA_fnc_addItemContextMenuOption;

[
_throwableMag,
"CONTAINER",
"Remove short fuse",
nil,
QPATHTOEF(explosives,UI\Place_Explosive_ca.paa),
[
{true},
{
params ["", "", "_item", "", "_magArr"];
_item isEqualTo (_magArr #1);
}
],
{
params ["_unit", "", "", "", "_magArr"];
_unit addMagazine (_magArr #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"]
];
veteran29 marked this conversation as resolved.
Show resolved Hide resolved