From f354bab3c2865efd524edcf3b695a11c1c1fa9a1 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 13 Aug 2016 04:29:01 -0500 Subject: [PATCH] Add Tripflare (#4152) --- addons/explosives/CfgAmmo.hpp | 23 +++++++++++++++++++ addons/explosives/CfgCloudlets.hpp | 15 ++++++++++++ addons/explosives/CfgMagazines.hpp | 8 +++++++ addons/explosives/CfgVehicles.hpp | 7 ++++++ addons/explosives/XEH_PREP.hpp | 1 + addons/explosives/config.cpp | 1 + .../explosives/functions/fnc_spawnFlare.sqf | 23 +++++++++++++++++++ addons/explosives/scripts/TripflareEffect.sqf | 20 ++++++++++++++++ addons/explosives/stringtable.xml | 6 +++++ 9 files changed, 104 insertions(+) create mode 100644 addons/explosives/CfgCloudlets.hpp create mode 100644 addons/explosives/functions/fnc_spawnFlare.sqf create mode 100644 addons/explosives/scripts/TripflareEffect.sqf diff --git a/addons/explosives/CfgAmmo.hpp b/addons/explosives/CfgAmmo.hpp index 8d81a52613..05780b706a 100644 --- a/addons/explosives/CfgAmmo.hpp +++ b/addons/explosives/CfgAmmo.hpp @@ -41,6 +41,29 @@ class CfgAmmo { GVAR(defuseObjectPosition)[] = {-1.415, 0, 0.12}; }; + class ACE_FlareTripMine_Wire_Ammo: APERSTripMine_Wire_Ammo { + SoundSetExplosion[] = {}; + defaultMagazine = "ACE_FlareTripMine_Mag"; //Mag that gets dropped after defuse + hit = 0; + indirectHit = 0; + indirectHitRange = 0; + soundHit[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + explosionEffects = "ACE_TripflareEffect"; + CraterEffects = ""; + soundTrigger[] = {"",1,1}; + class CamShakeExplode { + power = 0; + duration = 0; + frequency = 0; + distance = 0; + }; + }; + + class F_20mm_Red; + class ACE_TripFlare_FlareEffect: F_20mm_Red { + triggerTime = 0.1; + }; + class SLAMDirectionalMine_Wire_Ammo: DirectionalBombBase { indirectHitRange = 20; GVAR(explodeOnDefuseChance) = 1; diff --git a/addons/explosives/CfgCloudlets.hpp b/addons/explosives/CfgCloudlets.hpp new file mode 100644 index 0000000000..88d742656c --- /dev/null +++ b/addons/explosives/CfgCloudlets.hpp @@ -0,0 +1,15 @@ +class CfgCloudlets { + class Default; + class ACE_TripFlare: Default { + lifeTime = 0; + beforeDestroyScript = "\z\ace\addons\explosives\scripts\TripflareEffect.sqf"; + }; +}; + +class ACE_TripflareEffect { + class SpawnFlare { + simulation = "particles"; + type = "ACE_TripFlare"; + position = "explosionPos"; + }; +}; diff --git a/addons/explosives/CfgMagazines.hpp b/addons/explosives/CfgMagazines.hpp index eec0dadfa3..698ed79fcb 100644 --- a/addons/explosives/CfgMagazines.hpp +++ b/addons/explosives/CfgMagazines.hpp @@ -37,6 +37,14 @@ class CfgMagazines { class Tripwire; }; }; + class ACE_FlareTripMine_Mag: APERSTripMine_Wire_Mag { + author = ECSTRING(common,aceteam); + ammo = "ACE_FlareTripMine_Wire_Ammo"; + GVAR(SetupObject) = "ACE_Explosives_Place_APERSTripwireMine"; + displayName = CSTRING(TripFlare_Name); + descriptionShort = CSTRING(TripFlare_Description); + class Library {libTextDesc = CSTRING(TripFlare_Description);}; + }; class ClaymoreDirectionalMine_Remote_Mag: CA_Magazine { GVAR(Placeable) = 1; diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index b5cd201d7a..dfaac9b346 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -346,6 +346,13 @@ class CfgVehicles { // TODO: Find a way to place the mine laying down instead of standing up }; + class APERSTripMine: MineBase {}; + class ACE_FlareTripMine: APERSTripMine { + author = ECSTRING(common,aceteam); + ammo = "ACE_FlareTripMine_Wire_Ammo"; + displayName = CSTRING(TripFlare_Name); + }; + class IEDUrbanBig_F; class ACE_IEDUrbanBig_Range: IEDUrbanBig_F { author = ECSTRING(common,aceteam); diff --git a/addons/explosives/XEH_PREP.hpp b/addons/explosives/XEH_PREP.hpp index 0d8a4eeca5..b43953d8fd 100644 --- a/addons/explosives/XEH_PREP.hpp +++ b/addons/explosives/XEH_PREP.hpp @@ -42,6 +42,7 @@ PREP(selectTrigger); PREP(setupExplosive); PREP(setPosition); PREP(setSpeedDial); +PREP(spawnFlare); PREP(startDefuse); PREP(startTimer); PREP(triggerType); diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index 8b660197e9..9c323af6c1 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -22,6 +22,7 @@ class CfgPatches { #include "CfgMagazines.hpp" #include "CfgWeapons.hpp" #include "CfgVehicles.hpp" +#include "CfgCloudlets.hpp" #include "ACE_Triggers.hpp" #include "ExplosivesUI.hpp" diff --git a/addons/explosives/functions/fnc_spawnFlare.sqf b/addons/explosives/functions/fnc_spawnFlare.sqf new file mode 100644 index 0000000000..acd5dc2a99 --- /dev/null +++ b/addons/explosives/functions/fnc_spawnFlare.sqf @@ -0,0 +1,23 @@ +/* + * Author: VKing + * Spawns a flare on the ground for tripflare trigger + * + * Arguments: + * 0: Position + * + * Return Value: + * None + * + * Example: + * [getPos groundFlare] call ace_explosives_fnc_spawnFlare + * + * Public: no + */ +#include "script_component.hpp" + +params ["_posX","_posY","_posZ"]; +TRACE_3("Params",_posX,_posY,_posZ); + +private _flare = "ACE_TripFlare_FlareEffect" createVehicle [_posX,_posY,_posZ]; + +TRACE_1("",_flare); diff --git a/addons/explosives/scripts/TripflareEffect.sqf b/addons/explosives/scripts/TripflareEffect.sqf new file mode 100644 index 0000000000..6792af07df --- /dev/null +++ b/addons/explosives/scripts/TripflareEffect.sqf @@ -0,0 +1,20 @@ +/* + * Author: VKing + * Spawns a flare on the ground for tripflare trigger + * + * Arguments: + * 0: Position + * + * Return Value: + * None + * + * Example: + * beforeDestroyScript = "\z\ace\addons\explosives\scripts\TripflareEffect.sqf; + * + * Public: no + */ + +// This is called from a CfgCloudlet's beforeDestroyScript config. +// It will be re-compiled each use, so avoid complex preProcessor includes and just call the prepared function. + +_this call ace_explosives_fnc_spawnFlare; diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 6c8e192660..86fe2d086a 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -755,5 +755,11 @@ Collega a %1 Conectar à %1 + + Tripwire Flare + + + Type: Tripwire flare - Ignites a non-lethal flare when triggered.<br />Rounds: 1<br />Used on: Ground + \ No newline at end of file