From 4f3454034066fa83cbd89bac3d3bdde616c192df Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 23 Feb 2025 15:25:36 -0600 Subject: [PATCH] Tripflares - Change setting to different magazines Also Make airburst a trigger option --- addons/explosives/ACE_Triggers.hpp | 6 +++ addons/explosives/CfgAmmo.hpp | 16 ++++++-- addons/explosives/CfgCloudlets.hpp | 25 ------------- addons/explosives/CfgMagazines.hpp | 15 ++++++-- addons/explosives/CfgVehicles.hpp | 10 +++-- addons/explosives/CfgWeapons.hpp | 2 +- addons/explosives/XEH_PREP.hpp | 2 +- addons/explosives/config.cpp | 3 +- .../explosives/functions/fnc_spawnFlare.sqf | 27 -------------- .../functions/fnc_tripflare_init.sqf | 37 +++++++++++++++++++ addons/explosives/initSettings.inc.sqf | 10 ----- .../explosives/scripts/TripflareAirEffect.sqf | 22 ----------- addons/explosives/scripts/TripflareEffect.sqf | 20 ---------- addons/explosives/stringtable.xml | 21 +++++------ 14 files changed, 86 insertions(+), 130 deletions(-) delete mode 100644 addons/explosives/CfgCloudlets.hpp delete mode 100644 addons/explosives/functions/fnc_spawnFlare.sqf create mode 100644 addons/explosives/functions/fnc_tripflare_init.sqf delete mode 100644 addons/explosives/scripts/TripflareAirEffect.sqf delete mode 100644 addons/explosives/scripts/TripflareEffect.sqf diff --git a/addons/explosives/ACE_Triggers.hpp b/addons/explosives/ACE_Triggers.hpp index a94ad95eaa4..47b94bcb509 100644 --- a/addons/explosives/ACE_Triggers.hpp +++ b/addons/explosives/ACE_Triggers.hpp @@ -65,4 +65,10 @@ class ACE_Triggers { picture = QPATHTOF(Data\UI\Tripwire.paa); onPlace = QUOTE(false); }; + class Tripwire_Airburst { + isAttachable = 0; + displayName = CSTRING(Tripwire_Airburst); + picture = QPATHTOF(Data\UI\Tripwire.paa); + onPlace = QUOTE((_this # 1) setVariable [ARR_3(QQGVAR(airburst),true,true)]; false); + }; }; diff --git a/addons/explosives/CfgAmmo.hpp b/addons/explosives/CfgAmmo.hpp index 3655a094587..471e7a17f56 100644 --- a/addons/explosives/CfgAmmo.hpp +++ b/addons/explosives/CfgAmmo.hpp @@ -36,13 +36,14 @@ class CfgAmmo { }; class ACE_FlareTripMine_Wire_Ammo: APERSTripMine_Wire_Ammo { + GVAR(flareClass) = "F_40mm_White"; 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"; + explosionEffects = ""; CraterEffects = ""; soundTrigger[] = {"",1,1}; class CamShakeExplode { @@ -51,10 +52,17 @@ class CfgAmmo { frequency = 0; distance = 0; }; + class EventHandlers { + init = QUOTE(call FUNC(tripflare_init)); + }; + }; + class ACE_FlareTripMine_Wire_Ammo_Red: ACE_FlareTripMine_Wire_Ammo { + defaultMagazine = "ACE_FlareTripMine_Mag_Red"; + GVAR(flareClass) = "F_40mm_Red"; }; - class ACE_FlareTripMineAir_Wire_Ammo: ACE_FlareTripMine_Wire_Ammo { - defaultMagazine = "ACE_FlareTripMineAir_Mag"; - explosionEffects = "ACE_TripflareAirEffect"; + class ACE_FlareTripMine_Wire_Ammo_Green: ACE_FlareTripMine_Wire_Ammo { + defaultMagazine = "ACE_FlareTripMine_Mag_Green"; + GVAR(flareClass) = "F_40mm_Green"; }; class F_20mm_Red; diff --git a/addons/explosives/CfgCloudlets.hpp b/addons/explosives/CfgCloudlets.hpp deleted file mode 100644 index fb1c3c1a112..00000000000 --- a/addons/explosives/CfgCloudlets.hpp +++ /dev/null @@ -1,25 +0,0 @@ -class CfgCloudlets { - class Default; - class ACE_TripFlare: Default { - lifeTime = 0; - beforeDestroyScript = "\z\ace\addons\explosives\scripts\TripflareEffect.sqf"; - }; - class ACE_TripFlareAir: ACE_TripFlare { - beforeDestroyScript = "\z\ace\addons\explosives\scripts\TripflareAirEffect.sqf"; - }; -}; - -class ACE_TripflareEffect { - class SpawnFlare { - simulation = "particles"; - type = "ACE_TripFlare"; - position = "explosionPos"; - }; -}; -class ACE_TripflareAirEffect { - class SpawnFlare { - simulation = "particles"; - type = "ACE_TripFlareAir"; - position = "explosionPos"; - }; -}; diff --git a/addons/explosives/CfgMagazines.hpp b/addons/explosives/CfgMagazines.hpp index eac845dd04d..2ffc7b115de 100644 --- a/addons/explosives/CfgMagazines.hpp +++ b/addons/explosives/CfgMagazines.hpp @@ -47,10 +47,19 @@ class CfgMagazines { displayName = CSTRING(TripFlare_Name); descriptionShort = CSTRING(TripFlare_Description); class Library {libTextDesc = CSTRING(TripFlare_Description);}; + class ACE_Triggers { + SupportedTriggers[] = {"Tripwire", "Tripwire_Airburst"}; + class Tripwire; + class Tripwire_Airburst; + }; + }; + class ACE_FlareTripMine_Mag_Red: ACE_FlareTripMine_Mag { + ammo = "ACE_FlareTripMine_Wire_Ammo_Red"; + displayName = CSTRING(TripFlare_Name_Red); }; - class ACE_FlareTripMineAir_Mag: ACE_FlareTripMine_Mag { - ammo = "ACE_FlareTripMineAir_Wire_Ammo"; - displayName = CSTRING(TripFlareAir_Name); + class ACE_FlareTripMine_Mag_Green: ACE_FlareTripMine_Mag { + ammo = "ACE_FlareTripMine_Wire_Ammo_Green"; + displayName = CSTRING(TripFlare_Name_Green); }; class ClaymoreDirectionalMine_Remote_Mag: CA_Magazine { diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index 9450a8ba75c..7cc5d85231d 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -372,9 +372,13 @@ class CfgVehicles { ammo = "ACE_FlareTripMine_Wire_Ammo"; displayName = CSTRING(TripFlare_Name); }; - class ACE_FlareTripMineAir: ACE_FlareTripMine { - ammo = "ACE_FlareTripMineAir_Wire_Ammo"; - displayName = CSTRING(TripFlareAir_Name); + class ACE_FlareTripMineRed: ACE_FlareTripMine { + ammo = "ACE_FlareTripMine_Wire_Ammo_Red"; + displayName = CSTRING(TripFlare_Name_Red); + }; + class ACE_FlareTripMineGreen: ACE_FlareTripMine { + ammo = "ACE_FlareTripMine_Wire_Ammo_Green"; + displayName = CSTRING(TripFlare_Name_Green); }; class Claymore_F: MineBase { diff --git a/addons/explosives/CfgWeapons.hpp b/addons/explosives/CfgWeapons.hpp index b5c91aaeb88..7e11bcdae85 100644 --- a/addons/explosives/CfgWeapons.hpp +++ b/addons/explosives/CfgWeapons.hpp @@ -4,7 +4,7 @@ class CfgWeapons { muzzles[] += {QGVAR(muzzle)}; class PutMuzzle: Default {}; class GVAR(muzzle): PutMuzzle { - magazines[] = {"ACE_FlareTripMine_Mag", "ACE_APERSMine_ToePopper_Mag"}; + magazines[] = {"ACE_FlareTripMine_Mag", "ACE_FlareTripMine_Mag_Red", "ACE_FlareTripMine_Mag_Green", "ACE_APERSMine_ToePopper_Mag"}; }; }; diff --git a/addons/explosives/XEH_PREP.hpp b/addons/explosives/XEH_PREP.hpp index d7c9e8824c3..724280a0c0a 100644 --- a/addons/explosives/XEH_PREP.hpp +++ b/addons/explosives/XEH_PREP.hpp @@ -34,7 +34,6 @@ PREP(selectTrigger); PREP(setupExplosive); PREP(setPosition); PREP(setSpeedDial); -PREP(spawnFlare); PREP(startDefuse); PREP(startTimer); PREP(triggerType); @@ -42,3 +41,4 @@ PREP(allowDefuse); PREP(isAllowedDefuse); PREP(checkDetonateHandlers); PREP(woundsHandlerToePopper); +PREP(tripflare_init); diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index d3b5b3e9e95..442b5b80f05 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {"ACE_ModuleMine_SLAMBottomMine", "ACE_ModuleExplosive_IEDUrbanBig_Range", "ACE_ModuleExplosive_IEDLandBig_Range", "ACE_ModuleExplosive_IEDUrbanSmall_Range", "ACE_ModuleExplosive_IEDLandSmall_Range", "ACE_APERSMine_ToePopper"}; + units[] = {"ACE_ModuleMine_SLAMBottomMine", "ACE_ModuleExplosive_IEDUrbanBig_Range", "ACE_ModuleExplosive_IEDLandBig_Range", "ACE_ModuleExplosive_IEDUrbanSmall_Range", "ACE_ModuleExplosive_IEDLandSmall_Range", "ACE_APERSMine_ToePopper", "ACE_FlareTripMine_Mag", "ACE_FlareTripMine_Mag_Red", "ACE_FlareTripMine_Mag_Green"}; weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch", "ACE_Cellphone"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; @@ -21,7 +21,6 @@ class CfgPatches { #include "CfgMagazines.hpp" #include "CfgWeapons.hpp" #include "CfgVehicles.hpp" -#include "CfgCloudlets.hpp" #include "ACE_Triggers.hpp" #include "ACE_Arsenal_Stats.hpp" diff --git a/addons/explosives/functions/fnc_spawnFlare.sqf b/addons/explosives/functions/fnc_spawnFlare.sqf deleted file mode 100644 index 7236c954878..00000000000 --- a/addons/explosives/functions/fnc_spawnFlare.sqf +++ /dev/null @@ -1,27 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: VKing, MikeMF - * Spawns a flare for tripflare trigger - * - * Arguments: - * 0: Position - * - * Return Value: - * None - * - * Example: - * [getPos groundFlare] call ace_explosives_fnc_spawnFlare - * - * Public: no - */ - -params ["_posX","_posY","_posZ"]; -TRACE_3("Params",_posX,_posY,_posZ); - -private _flareClass = ["F_40mm_White", "F_40mm_Red", "F_40mm_Green"] select GVAR(tripflareColour); -private _flare = createVehicle [_flareClass, [_posX, _posY, _posZ], [], 0, "CAN_COLLIDE"]; -_flare setVelocity [0, 0, -1]; // Used for air mode, does nothing if already on the ground. - -TRACE_1("",_flare); - -["ace_tripflareTriggered", [_flare, [_posX,_posY,_posZ]]] call CBA_fnc_globalEvent; diff --git a/addons/explosives/functions/fnc_tripflare_init.sqf b/addons/explosives/functions/fnc_tripflare_init.sqf new file mode 100644 index 00000000000..4b248cbe38b --- /dev/null +++ b/addons/explosives/functions/fnc_tripflare_init.sqf @@ -0,0 +1,37 @@ +#include "..\script_component.hpp" +/* + * Author: VKing, MikeMF, PabstMirror + * Spawns a flare on the ground for tripflare trigger + * + * Arguments: + * 0: Ammo + * 1: Position ASL + * + * Return Value: + * None + * + * Example: + * [flare, [0,0,0]] call ace_explosives_fnc_tripflare_init + * + * Public: no + */ + +params ["_mine"]; +_mine addEventHandler ["Explode", { // runs where mine is local + params ["_projectile", "_posASL"]; + TRACE_2("tripflare-explode",_projectile,_posASL); + + private _flareClass = getText ((configOf _projectile) >> QGVAR(flareClass)); + if (_flareClass == "") exitWith { ERROR_1("bad flare cfg %1",typeOf _projectile) }; + + private _airburst = _projectile getVariable [QGVAR(airburst), false]; + if (_airburst) then { + _posASL set [2, _posASL # 2 + 200]; + }; + + private _flare = createVehicle [_flareClass, ASLToAGL _posASL, [], 0, "CAN_COLLIDE"]; + _flare setVelocity [0, 0, -1]; // Used for air mode, does nothing if already on the ground. + + TRACE_1("",_flare); + ["ace_tripflareTriggered", [_flare, ASLToAGL _posASL]] call CBA_fnc_globalEvent; +}]; diff --git a/addons/explosives/initSettings.inc.sqf b/addons/explosives/initSettings.inc.sqf index 57c7c71dc85..baa38f0d8f9 100644 --- a/addons/explosives/initSettings.inc.sqf +++ b/addons/explosives/initSettings.inc.sqf @@ -53,13 +53,3 @@ private _categoryStr = format ["ACE %1", LLSTRING(Menu)]; [_categoryStr, LLSTRING(ExplosiveTimer)], [0, 5999, TIMER_VALUE_DEFAULT] ] call CBA_fnc_addSetting; - -// Tripflares -[ - QGVAR(tripflareColour), - "LIST", - [LLSTRING(TripflareColour_DisplayName), LLSTRING(TripflareColour_Description)], - [_categoryStr, LLSTRING(Tripflares)], - [[0, 1, 2], ["$str_cfg_markercol_white", "$str_cfg_markercol_red", "$str_cfg_markercol_green"], 1], - 1 -] call CBA_fnc_addSetting; diff --git a/addons/explosives/scripts/TripflareAirEffect.sqf b/addons/explosives/scripts/TripflareAirEffect.sqf deleted file mode 100644 index b2b1c7486bb..00000000000 --- a/addons/explosives/scripts/TripflareAirEffect.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: VKing, MikeMF - * Spawns a flare in the air for tripflare trigger - * - * Arguments: - * 0: Position - * - * Return Value: - * None - * - * Example: - * beforeDestroyScript = "\z\ace\addons\explosives\scripts\TripflareAirEffect.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 set [2, ((_this select 2) + 200)]; - -[ace_explosives_fnc_spawnFlare, _this] call CBA_fnc_directCall; diff --git a/addons/explosives/scripts/TripflareEffect.sqf b/addons/explosives/scripts/TripflareEffect.sqf deleted file mode 100644 index c6781367c41..00000000000 --- a/addons/explosives/scripts/TripflareEffect.sqf +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - -[ace_explosives_fnc_spawnFlare, _this] call CBA_fnc_directCall; diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 487f654f2c0..b2d19f2f6f2 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -1044,6 +1044,12 @@ 絆線閃光地雷 绊线信号弹 + + Tripwire Flare (Red) + + + Tripwire Flare (Green) + Tripwire Nástražný drát @@ -1061,6 +1067,9 @@ Telli tuzak Botlódrót + + Tripwire - Airburst + APERS Mine (Toe-Popper) Mine APERS (Toe-Popper) @@ -1187,17 +1196,5 @@ Zamanlayıcı Időzítő - - Tripflares - - - Tripflare Colour - - - What colour the tripflare will be - - - Tripwire Flare (Air) -