From f3938ba0ccfb70185d4d49a6ec4252af4f065115 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Mon, 12 Aug 2024 15:18:21 +0200 Subject: [PATCH] Explosives - Use `triggerAmmo` instead of `setDamage` (#10182) * Use `triggerAmmo` instead of `setDamage` * Update docs/wiki/framework/explosives-framework.md --- addons/common/XEH_postInit.sqf | 1 + addons/explosives/CfgAmmo.hpp | 4 ---- addons/explosives/XEH_postInit.sqf | 2 +- docs/wiki/framework/explosives-framework.md | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 48fdab954b..44197df81a 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -216,6 +216,7 @@ if (isServer) then { [QGVAR(setVectorDirAndUp), {(_this select 0) setVectorDirAndUp (_this select 1)}] call CBA_fnc_addEventHandler; [QGVAR(addWeaponItem), {(_this select 0) addWeaponItem [(_this select 1), (_this select 2)]}] call CBA_fnc_addEventHandler; [QGVAR(removeMagazinesTurret), {(_this select 0) removeMagazinesTurret [_this select 1, _this select 2]}] call CBA_fnc_addEventHandler; +[QGVAR(triggerAmmo), {triggerAmmo _this}] call CBA_fnc_addEventHandler; [QGVAR(setVanillaHitPointDamage), { params ["_object", "_hitPointAnddamage"]; diff --git a/addons/explosives/CfgAmmo.hpp b/addons/explosives/CfgAmmo.hpp index c02885362e..2d925ba7e6 100644 --- a/addons/explosives/CfgAmmo.hpp +++ b/addons/explosives/CfgAmmo.hpp @@ -28,7 +28,6 @@ class CfgAmmo { class DirectionalBombBase; class ClaymoreDirectionalMine_Remote_Ammo: DirectionalBombBase { GVAR(magazine) = "ClaymoreDirectionalMine_Remote_Mag"; - GVAR(Explosive) = "ClaymoreDirectionalMine_Remote_Ammo_Scripted"; GVAR(size) = 0; GVAR(defuseObjectPosition)[] = {0, 0, 0.038}; soundActivation[] = {"", 0, 0, 0}; @@ -92,7 +91,6 @@ class CfgAmmo { class PipeBombBase; class DemoCharge_Remote_Ammo: PipeBombBase { GVAR(magazine) = "DemoCharge_Remote_Mag"; - GVAR(Explosive) = "DemoCharge_Remote_Ammo_Scripted"; // can probably remove as base ammo now has triggerWhenDestroyed GVAR(size) = 0; GVAR(defuseObjectPosition)[] = {0.07, 0, 0.055}; soundActivation[] = {"", 0, 0, 0}; @@ -103,7 +101,6 @@ class CfgAmmo { }; class SatchelCharge_Remote_Ammo: PipeBombBase { GVAR(magazine) = "SatchelCharge_Remote_Mag"; - GVAR(Explosive) = "SatchelCharge_Remote_Ammo_Scripted"; // can probably remove as base ammo now has triggerWhenDestroyed GVAR(size) = 0; GVAR(defuseObjectPosition)[] = {0.1, 0.1, 0.05}; soundActivation[] = {"", 0, 0, 0}; @@ -171,7 +168,6 @@ class CfgAmmo { // Orange DLC: class APERSMineDispenser_Ammo: PipeBombBase { GVAR(magazine) = "APERSMineDispenser_Mag"; - GVAR(Explosive) = "APERSMineDispenser_Ammo_Scripted"; // triggerWhenDestroyed = 1; GVAR(size) = 0; GVAR(defuseObjectPosition)[] = {0.0, -0.05, 0.15}; }; diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index 81ab1b5406..f47dbbe5bd 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -42,7 +42,7 @@ if (isServer) then { params ["_explosive"]; TRACE_1("exploding",_explosive); if (!isNull _explosive) then { - _explosive setDamage 1; + [QEGVAR(common,triggerAmmo), _explosive, _explosive] call CBA_fnc_targetEvent; }; }, _explosive, _delay] call CBA_fnc_waitAndExecute; }] call CBA_fnc_addEventHandler; diff --git a/docs/wiki/framework/explosives-framework.md b/docs/wiki/framework/explosives-framework.md index dfaf5bdafb..2864556559 100644 --- a/docs/wiki/framework/explosives-framework.md +++ b/docs/wiki/framework/explosives-framework.md @@ -51,7 +51,7 @@ class CfgAmmo { class SatchelCharge_Remote_Ammo: PipeBombBase { soundActivation[] = {"", 0, 0, 0}; // No sound on activation soundDeactivation[] = {"", 0, 0, 0}; // No sound on deactivation - triggerWhenDestroyed = 1; // (Optional) Explode when the object is shot and destroyed (after being placed) (0-disabled, 1-enabled). + triggerWhenDestroyed = 1; // (Optional) Explode when the object is shot and destroyed (after being placed) (0-disabled, 1-enabled). Required to be enabled prior to ACE 3.18.0. ACE_explodeOnDefuse = 0.02; // (Optional) Add a chance for the explosive to detonate after being disarmed (in percent) ACE_explosives_defuseObjectPosition[] = {-1.415, 0, 0.12}; // (Optional) The position relative to the model where the defuse helper object will be attached and thus the interaction point will be rendered ACE_explosives_size = 0; // (Optional) Setting to 1 will use a defusal action with a larger radius (useful for large mines or mines with a wide pressure plane trigger area)