From f9a7ab5ae05ea17ae83199ce3418b9352a7cb7d0 Mon Sep 17 00:00:00 2001 From: AKALegman Date: Sat, 6 Jun 2015 10:11:00 +0100 Subject: [PATCH] improved explosives --- addons/explosives/ACE_Settings.hpp | 4 ++++ addons/explosives/CfgAmmo.hpp | 6 +++++- addons/explosives/CfgMagazines.hpp | 4 ++-- addons/explosives/CfgModule.hpp | 6 ++++++ addons/explosives/functions/fnc_defuseExplosive.sqf | 4 +++- addons/explosives/functions/fnc_module.sqf | 2 ++ addons/explosives/stringtable.xml | 6 ++++++ 7 files changed, 28 insertions(+), 4 deletions(-) diff --git a/addons/explosives/ACE_Settings.hpp b/addons/explosives/ACE_Settings.hpp index 038f06291d..6f48e739cf 100644 --- a/addons/explosives/ACE_Settings.hpp +++ b/addons/explosives/ACE_Settings.hpp @@ -7,4 +7,8 @@ class ACE_Settings { value = 1; typeName = "BOOL"; }; + class GVAR(ExplodeOnDefuseChance) { + value = 0.02; + typeName = "SCALAR"; + }; }; diff --git a/addons/explosives/CfgAmmo.hpp b/addons/explosives/CfgAmmo.hpp index ace7d5ef02..15e742af31 100644 --- a/addons/explosives/CfgAmmo.hpp +++ b/addons/explosives/CfgAmmo.hpp @@ -72,7 +72,8 @@ class CfgAmmo { class IEDUrbanBig_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; - soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; + ACE_ExplodeOnDefuse = 1; + soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; class IEDUrbanBig_Command_Ammo: IEDUrbanBig_Remote_Ammo { mineTrigger = "RemoteTrigger"; @@ -83,6 +84,7 @@ class CfgAmmo { class IEDUrbanSmall_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; + ACE_ExplodeOnDefuse = 1; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; class IEDUrbanSmall_Command_Ammo: IEDUrbanSmall_Remote_Ammo { @@ -94,6 +96,7 @@ class CfgAmmo { class IEDLandBig_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; + ACE_ExplodeOnDefuse = 1; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; class IEDLandBig_Command_Ammo: IEDLandBig_Remote_Ammo { @@ -105,6 +108,7 @@ class CfgAmmo { class IEDLandSmall_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; + ACE_ExplodeOnDefuse = 1; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; class IEDLandSmall_Command_Ammo: IEDLandSmall_Remote_Ammo { diff --git a/addons/explosives/CfgMagazines.hpp b/addons/explosives/CfgMagazines.hpp index bb8b0080bb..68563d8b13 100644 --- a/addons/explosives/CfgMagazines.hpp +++ b/addons/explosives/CfgMagazines.hpp @@ -106,7 +106,7 @@ class CfgMagazines { class DeadmanSwitch: Command{}; class Cellphone: Command{}; class PressurePlate{ - displayName = $STR_ACE_Explosives_SLAME_Magnetic; + displayName = $STR_ACE_Explosives_PressurePlate; digDistance = 0; ammo = "IEDUrbanBig_Range_Ammo"; pitch = 0; @@ -136,7 +136,7 @@ class CfgMagazines { class DeadmanSwitch: Command {}; class Cellphone: Command {}; class PressurePlate { - displayName = $STR_ACE_Explosives_SLAME_Magnetic; + displayName = $STR_ACE_Explosives_PressurePlate; digDistance = 0; ammo = "IEDUrbanSmall_Range_Ammo"; pitch = 0; diff --git a/addons/explosives/CfgModule.hpp b/addons/explosives/CfgModule.hpp index 52f70ea3af..e614400191 100644 --- a/addons/explosives/CfgModule.hpp +++ b/addons/explosives/CfgModule.hpp @@ -22,6 +22,12 @@ class ACE_ModuleExplosive: Module_F { description = "$STR_ACE_Explosive_PunishNonSpecialists_Description"; typeName = "BOOL"; defaultValue = 1; + }; + class ExplodeOnDefuseChance { + displayName = "$STR_ACE_Explosive_ExplodeOnDefuseChance_DisplayName"; + description = "$STR_ACE_Explosive_ExplodeOnDefuseChance_Description"; + typeName = "NUMBER"; + defaultValue = 0.02; }; }; class ModuleDescription: ModuleDescription { diff --git a/addons/explosives/functions/fnc_defuseExplosive.sqf b/addons/explosives/functions/fnc_defuseExplosive.sqf index 5abfabe60f..e16a485fe7 100644 --- a/addons/explosives/functions/fnc_defuseExplosive.sqf +++ b/addons/explosives/functions/fnc_defuseExplosive.sqf @@ -17,7 +17,9 @@ #include "script_component.hpp" EXPLODE_2_PVT(_this,_unit,_explosive); -if (getNumber (ConfigFile >> "CfgAmmo" >> typeof _explosive >> "ACE_explodeOnDefuse") == 1) exitWith { +_explode = random 1.0; +if (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse") == 1 && + _explode < GVAR(ExplodeOnDefuseChance)) exitWith { [_unit, -1, [_explosive, 1], true] call FUNC(detonateExplosive); }; diff --git a/addons/explosives/functions/fnc_module.sqf b/addons/explosives/functions/fnc_module.sqf index 4080b41bde..67de88410d 100644 --- a/addons/explosives/functions/fnc_module.sqf +++ b/addons/explosives/functions/fnc_module.sqf @@ -27,5 +27,7 @@ if !(_activated) exitWith {}; call EFUNC(Common,readSettingFromModule); [_logic, QGVAR(PunishNonSpecialists),"PunishNonSpecialists"] call EFUNC(Common,readSettingFromModule); +[_logic, QGVAR(ExplodeOnDefuseChance),"ExplodeOnDefuseChance"] + call EFUNC(Common,readSettingFromModule); diag_log text "[ACE]: Explosive Module Initialized."; diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 5f5076175d..6ac5e09620 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -524,6 +524,12 @@ Increase the time it takes to complete actions for non-specialists? Default: Yes Zwiększyć ilość wymaganego czasu do ukończenia akcji dla nie-specjalistów? Domyślnie: Tak + + + Explode chance? + + + Chance for special explosives to explode on defuse? Default: 0.02 (2%)