From 5e67de4d66273430ad54372ec2b053f39edd512c Mon Sep 17 00:00:00 2001 From: Garth L-H de Wet Date: Mon, 12 Jan 2015 11:48:26 +0200 Subject: [PATCH] Ported AGM_Explosives to ace. Marked locations where Scheduled Delay Execution will probably need to be used. --- TO_MERGE/agm/Explosives/CfgAmmo.hpp | 84 ----- TO_MERGE/agm/Explosives/CfgMagazines.hpp | 155 --------- TO_MERGE/agm/Explosives/CfgVehicles.hpp | 65 ---- TO_MERGE/agm/Explosives/CfgWeapons.hpp | 55 ---- TO_MERGE/agm/Explosives/ExplosivesUI.hpp | 74 ----- TO_MERGE/agm/Explosives/Module.hpp | 46 --- TO_MERGE/agm/Explosives/config.cpp | 300 ------------------ .../functions/fn_HandleScrollWheel.sqf | 25 -- .../Explosives/functions/fn_JammerInit.sqf | 42 --- .../Explosives/functions/fn_Place_Approve.sqf | 106 ------- .../Explosives/functions/fn_Place_Cancel.sqf | 34 -- .../functions/fn_SetupExplosive.sqf | 65 ---- .../Explosives/functions/fn_StartDefuse.sqf | 65 ---- .../Explosives/functions/fn_initialise.sqf | 73 ----- .../Explosives/functions/fn_isSpecialist.sqf | 26 -- .../agm/Explosives/functions/fn_module.sqf | 27 -- .../functions/fn_openDetonateUI.sqf | 61 ---- .../functions/fn_openTimerSetUI.sqf | 27 -- .../functions/fn_openTransmitterUI.sqf | 51 --- addons/explosives/CfgACE_Triggers.hpp | 48 +++ addons/explosives/CfgAmmo.hpp | 86 +++++ addons/explosives/CfgEventHandlers.hpp | 20 ++ addons/explosives/CfgModule.hpp | 44 +++ addons/explosives/CfgVehicles.hpp | 248 +++++++++++++++ addons/explosives/CfgWeapons.hpp | 55 ++++ addons/explosives/CgMagazines.hpp | 98 ++++++ .../explosives}/Data/Audio/IED_Activated.wss | Bin .../explosives}/Data/UI/Clacker.paa | Bin .../explosives}/Data/UI/DeadmanSwitch.paa | Bin .../explosives}/Data/UI/MK16_Reciever_ca.paa | Bin .../Data/UI/MK26_Transmitter_ca.paa | Bin .../explosives/Data/UI/Pliers.paa | Bin .../explosives/Data/UI/PressurePlate.paa | Bin .../explosives/Data/UI/Timer.paa | Bin .../explosives}/Data/UI/Tripwire.paa | Bin addons/explosives/ExplosivesUI.hpp | 74 +++++ .../explosives/UI/Defuse_ca.paa | Bin .../explosives/UI/Explosives_Menu_ca.paa | Bin .../explosives}/UI/IconExplosives_ca.paa | Bin .../explosives}/UI/Place_Explosive_ca.paa | Bin addons/explosives/XEH_postInit.sqf | 69 ++++ addons/explosives/XEH_preInit.sqf | 50 +++ addons/explosives/config.cpp | 47 +++ .../explosives/functions/fnc_addClacker.sqf | 32 +- .../explosives/functions/fnc_canDefuse.sqf | 27 +- .../functions/fnc_defuseExplosive.sqf | 21 +- .../functions/fnc_detonateExplosive.sqf | 30 +- .../functions/fnc_getDetonators.sqf | 17 +- .../functions/fnc_getPlacedExplosives.sqf | 31 +- .../functions/fnc_handleScrollWheel.sqf | 26 ++ .../functions/fnc_hasExplosives.sqf | 19 +- .../functions/fnc_hasPlacedExplosives.sqf | 19 +- addons/explosives/functions/fnc_module.sqf | 28 ++ .../functions/fnc_openDetonateUI.sqf | 63 ++++ .../explosives/functions/fnc_openPlaceUI.sqf | 36 ++- .../functions/fnc_openTimerSetUI.sqf | 28 ++ .../functions/fnc_openTransmitterUI.sqf | 53 ++++ .../functions/fnc_openTriggerSelectionUI.sqf | 39 +-- .../functions/fnc_placeExplosive.sqf | 29 +- .../functions/fnc_place_Approve.sqf | 108 +++++++ .../explosives/functions/fnc_place_Cancel.sqf | 35 ++ .../functions/fnc_selectTrigger.sqf | 25 +- .../explosives/functions/fnc_setPosition.sqf | 15 +- .../functions/fnc_setupExplosive.sqf | 67 ++++ .../explosives/functions/fnc_startDefuse.sqf | 68 ++++ .../explosives/functions/fnc_startTimer.sqf | 21 +- .../explosives/functions/fnc_triggerType.sqf | 19 +- addons/explosives/script_component.hpp | 12 + .../explosives}/stringtable.xml | 86 ++--- 69 files changed, 1565 insertions(+), 1609 deletions(-) delete mode 100644 TO_MERGE/agm/Explosives/CfgAmmo.hpp delete mode 100644 TO_MERGE/agm/Explosives/CfgMagazines.hpp delete mode 100644 TO_MERGE/agm/Explosives/CfgVehicles.hpp delete mode 100644 TO_MERGE/agm/Explosives/CfgWeapons.hpp delete mode 100644 TO_MERGE/agm/Explosives/ExplosivesUI.hpp delete mode 100644 TO_MERGE/agm/Explosives/Module.hpp delete mode 100644 TO_MERGE/agm/Explosives/config.cpp delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_HandleScrollWheel.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_JammerInit.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_Place_Approve.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_Place_Cancel.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_SetupExplosive.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_StartDefuse.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_initialise.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_isSpecialist.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_module.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_openDetonateUI.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_openTimerSetUI.sqf delete mode 100644 TO_MERGE/agm/Explosives/functions/fn_openTransmitterUI.sqf create mode 100644 addons/explosives/CfgACE_Triggers.hpp create mode 100644 addons/explosives/CfgAmmo.hpp create mode 100644 addons/explosives/CfgEventHandlers.hpp create mode 100644 addons/explosives/CfgModule.hpp create mode 100644 addons/explosives/CfgVehicles.hpp create mode 100644 addons/explosives/CfgWeapons.hpp create mode 100644 addons/explosives/CgMagazines.hpp rename {TO_MERGE/agm/Explosives => addons/explosives}/Data/Audio/IED_Activated.wss (100%) rename {TO_MERGE/agm/Explosives => addons/explosives}/Data/UI/Clacker.paa (100%) rename {TO_MERGE/agm/Explosives => addons/explosives}/Data/UI/DeadmanSwitch.paa (100%) rename {TO_MERGE/agm/Explosives => addons/explosives}/Data/UI/MK16_Reciever_ca.paa (100%) rename {TO_MERGE/agm/Explosives => addons/explosives}/Data/UI/MK26_Transmitter_ca.paa (100%) rename TO_MERGE/agm/Explosives/Data/UI/pliers.paa => addons/explosives/Data/UI/Pliers.paa (100%) rename TO_MERGE/agm/Explosives/Data/UI/Pressure_plate.paa => addons/explosives/Data/UI/PressurePlate.paa (100%) rename TO_MERGE/agm/Explosives/Data/UI/timer.paa => addons/explosives/Data/UI/Timer.paa (100%) rename {TO_MERGE/agm/Explosives => addons/explosives}/Data/UI/Tripwire.paa (100%) create mode 100644 addons/explosives/ExplosivesUI.hpp rename TO_MERGE/agm/Explosives/UI/defuse_ca.paa => addons/explosives/UI/Defuse_ca.paa (100%) rename TO_MERGE/agm/Explosives/UI/Icon_Explosive_ca.paa => addons/explosives/UI/Explosives_Menu_ca.paa (100%) rename {TO_MERGE/agm/Explosives => addons/explosives}/UI/IconExplosives_ca.paa (100%) rename {TO_MERGE/agm/Explosives => addons/explosives}/UI/Place_Explosive_ca.paa (100%) create mode 100644 addons/explosives/XEH_postInit.sqf create mode 100644 addons/explosives/XEH_preInit.sqf create mode 100644 addons/explosives/config.cpp rename TO_MERGE/agm/Explosives/functions/fn_AddClacker.sqf => addons/explosives/functions/fnc_addClacker.sqf (57%) rename TO_MERGE/agm/Explosives/functions/fn_CanDefuse.sqf => addons/explosives/functions/fnc_canDefuse.sqf (58%) rename TO_MERGE/agm/Explosives/functions/fn_defuseExplosive.sqf => addons/explosives/functions/fnc_defuseExplosive.sqf (57%) rename TO_MERGE/agm/Explosives/functions/fn_DetonateExplosive.sqf => addons/explosives/functions/fnc_detonateExplosive.sqf (63%) rename TO_MERGE/agm/Explosives/functions/fn_getDetonators.sqf => addons/explosives/functions/fnc_getDetonators.sqf (68%) rename TO_MERGE/agm/Explosives/functions/fn_getPlacedExplosives.sqf => addons/explosives/functions/fnc_getPlacedExplosives.sqf (59%) create mode 100644 addons/explosives/functions/fnc_handleScrollWheel.sqf rename TO_MERGE/agm/Explosives/functions/fn_hasExplosives.sqf => addons/explosives/functions/fnc_hasExplosives.sqf (63%) rename TO_MERGE/agm/Explosives/functions/fn_hasPlacedExplosives.sqf => addons/explosives/functions/fnc_hasPlacedExplosives.sqf (55%) create mode 100644 addons/explosives/functions/fnc_module.sqf create mode 100644 addons/explosives/functions/fnc_openDetonateUI.sqf rename TO_MERGE/agm/Explosives/functions/fn_openPlaceUI.sqf => addons/explosives/functions/fnc_openPlaceUI.sqf (54%) create mode 100644 addons/explosives/functions/fnc_openTimerSetUI.sqf create mode 100644 addons/explosives/functions/fnc_openTransmitterUI.sqf rename TO_MERGE/agm/Explosives/functions/fn_openTriggerSelectionUI.sqf => addons/explosives/functions/fnc_openTriggerSelectionUI.sqf (52%) rename TO_MERGE/agm/Explosives/functions/fn_PlaceExplosive.sqf => addons/explosives/functions/fnc_placeExplosive.sqf (69%) create mode 100644 addons/explosives/functions/fnc_place_Approve.sqf create mode 100644 addons/explosives/functions/fnc_place_Cancel.sqf rename TO_MERGE/agm/Explosives/functions/fn_selectTrigger.sqf => addons/explosives/functions/fnc_selectTrigger.sqf (54%) rename TO_MERGE/agm/Explosives/functions/fn_setPos.sqf => addons/explosives/functions/fnc_setPosition.sqf (75%) create mode 100644 addons/explosives/functions/fnc_setupExplosive.sqf create mode 100644 addons/explosives/functions/fnc_startDefuse.sqf rename TO_MERGE/agm/Explosives/functions/fn_StartTimer.sqf => addons/explosives/functions/fnc_startTimer.sqf (56%) rename TO_MERGE/agm/Explosives/functions/fn_TriggerType.sqf => addons/explosives/functions/fnc_triggerType.sqf (61%) create mode 100644 addons/explosives/script_component.hpp rename {TO_MERGE/agm/Explosives => addons/explosives}/stringtable.xml (90%) diff --git a/TO_MERGE/agm/Explosives/CfgAmmo.hpp b/TO_MERGE/agm/Explosives/CfgAmmo.hpp deleted file mode 100644 index dd09fb296a..0000000000 --- a/TO_MERGE/agm/Explosives/CfgAmmo.hpp +++ /dev/null @@ -1,84 +0,0 @@ -class CfgAmmo { - // All explosive based Ammo classes. Theses are all listed in case they are required. - class Default; - - class TimeBombCore:Default { - AGM_DefuseTime = 5; - }; - /* - class BoundingMineCore:TimeBombCore; - class BoundingMineBase:BoundingMineCore; - class APERSBoundingMine_Range_Ammo:BoundingMineBase; - - class MineCore: TimeBombCore; - class MineBase:MineCore; - class APERSMine_Range_Ammo:MineBase; - class ATMine_Range_Ammo:MineBase; - - class UnderwaterMine_Range_Ammo:MineBase; - class UnderwaterMineAB_Range_Ammo:UnderwaterMine_Range_Ammo; - class UnderwaterMinePDM_Range_Ammo:UnderwaterMine_Range_Ammo; - - class DirectionalBombCore:TimeBombCore; - class DirectionalBombBase:DirectionalBombCore; - class APERSTripMine_Wire_Ammo:DirectionalBombBase; - - class SLAMDirectionalMine_Wire_Ammo:DirectionalBombBase; - - class PipeBombCore: TimeBombCore; - class PipeBombBase:PipeBombCore; - */ - class DirectionalBombBase; - class ClaymoreDirectionalMine_Remote_Ammo:DirectionalBombBase{ - AGM_Explosive = "ClaymoreDirectionalMine_Remote_Ammo_Scripted"; - soundActivation[] = {"",0,0,0}; - soundDeactivation[] = {"",0,0,0}; - }; - //class ClaymoreDirectionalMine_Remote_Ammo_Scripted:ClaymoreDirectionalMine_Remote_Ammo; - - class SLAMDirectionalMine_Wire_Ammo:DirectionalBombBase{ - indirectHitRange = 20; - AGM_explodeOnDefuse = 1; - }; - class SLAMDirectionalMine_Command_Ammo:SLAMDirectionalMine_Wire_Ammo { - mineTrigger = "RemoteTrigger"; - AGM_explodeOnDefuse = 0; - }; - class SLAMDirectionalMine_Timer_Ammo:SLAMDirectionalMine_Wire_Ammo { - mineTrigger = "TimeTrigger"; - AGM_explodeOnDefuse = 0; - }; - class SLAMDirectionalMine_Magnetic_Ammo:SLAMDirectionalMine_Wire_Ammo { - mineTrigger = "MagneticTrigger"; - }; - - class PipeBombBase; - class DemoCharge_Remote_Ammo:PipeBombBase{ - AGM_Explosive = "DemoCharge_Remote_Ammo_Scripted"; - soundActivation[] = {"",0,0,0}; - soundDeactivation[] = {"",0,0,0}; - hit = 500; - indirectHit = 500; - indirectHitRange = 7; - }; - //class DemoCharge_Remote_Ammo_Scripted:DemoCharge_Remote_Ammo; - class SatchelCharge_Remote_Ammo:PipeBombBase{ - AGM_Explosive = "SatchelCharge_Remote_Ammo_Scripted"; - soundActivation[] = {"",0,0,0}; - soundDeactivation[] = {"",0,0,0}; - }; - /*class SatchelCharge_Remote_Ammo_Scripted:SatchelCharge_Remote_Ammo; - - class IEDLandBig_Remote_Ammo:PipeBombBase{ - triggerWhenDestroyed = 1; - }; - class IEDLandSmall_Remote_Ammo:PipeBombBase{ - triggerWhenDestroyed = 1; - }; - class IEDUrbanBig_Remote_Ammo:PipeBombBase{ - triggerWhenDestroyed = 1; - }; - class IEDUrbanSmall_Remote_Ammo:PipeBombBase{ - triggerWhenDestroyed = 1; - };*/ -}; diff --git a/TO_MERGE/agm/Explosives/CfgMagazines.hpp b/TO_MERGE/agm/Explosives/CfgMagazines.hpp deleted file mode 100644 index 4a93ad84a5..0000000000 --- a/TO_MERGE/agm/Explosives/CfgMagazines.hpp +++ /dev/null @@ -1,155 +0,0 @@ -class CfgMagazines { - class CA_Magazine; - class ATMine_Range_Mag:CA_Magazine{ - AGM_Placeable = 1; - useAction = 0; - AGM_SetupObject = "AGM_Explosives_Place_ATMine"; // CfgVehicle class for setup object. - AGM_DelayTime = 2.5; - class AGM_Triggers { - AGM_Triggers[] = {"PressurePlate"}; - class PressurePlate { - digDistance = 0.1; - }; - }; - }; - class APERSBoundingMine_Range_Mag:ATMine_Range_Mag{ - AGM_SetupObject = "AGM_Explosives_Place_APERSBoundingMine"; - class AGM_Triggers { - AGM_Triggers[] = {"PressurePlate"}; - class PressurePlate { - digDistance = 0.075; - }; - }; - }; - class APERSMine_Range_Mag:ATMine_Range_Mag{ - AGM_SetupObject = "AGM_Explosives_Place_APERSMine"; - class AGM_Triggers { - AGM_Triggers[] = {"PressurePlate"}; - class PressurePlate { - digDistance = 0.05; - }; - }; - }; - class APERSTripMine_Wire_Mag:ATMine_Range_Mag{ - AGM_SetupObject = "AGM_Explosives_Place_APERSTripwireMine"; - class AGM_Triggers { - AGM_Triggers[] = {"Tripwire"}; - class Tripwire; - }; - }; - - class ClaymoreDirectionalMine_Remote_Mag:CA_Magazine{ - AGM_Placeable = 1; - useAction = 0; - AGM_SetupObject = "AGM_Explosives_Place_Claymore"; // CfgVehicle class for setup object. - AGM_DelayTime = 1.5; - class AGM_Triggers { - AGM_Triggers[] = {"Command"}; - class Command { - FuseTime = 0.5; - }; - }; - }; - - class SatchelCharge_Remote_Mag:CA_Magazine{ - AGM_Placeable = 1; - useAction = 0; - AGM_SetupObject = "AGM_Explosives_Place_SatchelCharge"; // CfgVehicle class for setup object. - AGM_DelayTime = 1; - class AGM_Triggers { - AGM_Triggers[] = {"Timer","Command", "MK16_Transmitter", "DeadmanSwitch"}; - class Timer { - FuseTime = 0.5; - }; - class Command { - FuseTime = 0.5; - }; - class MK16_Transmitter:Command{}; - class DeadmanSwitch:Command{}; - }; - }; - class DemoCharge_Remote_Mag:SatchelCharge_Remote_Mag{ - AGM_SetupObject = "AGM_Explosives_Place_DemoCharge"; // CfgVehicle class for setup object. - model = "\A3\Weapons_F\explosives\c4_charge_small_d"; - }; - - class SLAMDirectionalMine_Wire_Mag: ATMine_Range_Mag{ - AGM_SetupObject = "AGM_Explosives_Place_SLAM"; - class AGM_Triggers { - AGM_Triggers[] = {"IRSensor","PressurePlate","Timer","Command"}; - class PressurePlate{ - displayName = $STR_AGM_Explosives_SLAME_Magnetic; - digDistance = 0; - ammo = "SLAMDirectionalMine_Magnetic_Ammo"; - pitch = 90; - }; - class IRSensor{ - displayName = $STR_AGM_Explosives_SLAME_IRSensor; - }; - class Timer { - ammo = "SLAMDirectionalMine_Timer_Ammo"; - }; - class Command { - ammo = "SLAMDirectionalMine_Command_Ammo"; - fuseTime = 0.5; - }; - }; - }; -}; - -class CfgAGM_Triggers { -/* onPlace parameters: - 0: OBJECT - unit placing - 1: OBJECT - Placed explosive - 2: STRING - Magazine classname - 3: ARRAY - vars - Last Index: CfgAGM_Triggers config of trigger type. - onSetup parameters: - 0: STRING - Magazine Classname -*/ - class Command { - displayName = $STR_AGM_Explosives_clacker_displayName; - picture = "\AGM_Explosives\Data\UI\Clacker.paa"; - onPlace = "_this call AGM_Explosives_fnc_AddClacker;false"; - requires[] = {"AGM_Clacker"}; - }; - class MK16_Transmitter:Command { - displayName = $STR_AGM_Explosives_MK16_displayName; - picture = "\AGM_Explosives\Data\UI\MK16_Reciever_ca.paa"; - requires[] = {"AGM_M26_Clacker"}; - }; - class DeadManSwitch:Command { - displayName = $STR_AGM_Explosives_DeadManSwitch_displayName; - picture = "\AGM_Explosives\Data\UI\DeadmanSwitch.paa"; - requires[] = {"AGM_DeadManSwitch"}; - }; - class PressurePlate { - displayName = $STR_AGM_Explosives_PressurePlate; - picture = "AGM_Explosives\data\UI\Pressure_plate.paa"; - onPlace = "_dist=GetNumber(ConfigFile >> 'CfgMagazines' >> (_this select 2) >> 'AGM_Triggers' >> 'PressurePlate' >> 'digDistance');_ex=_this select 1;_ex setPosATL ((getPosATL _ex) vectorDiff ((VectorUp _ex) vectorCrossProduct [0,0,_dist]));false"; - }; - class IRSensor { - displayName = $STR_AGM_Explosives_IRSensor; - picture = "AGM_Explosives\data\UI\Pressure_plate.paa"; - onPlace = "false"; - }; - class Timer { - displayName = $STR_AGM_Explosives_timerName; - picture = "AGM_Explosives\data\UI\Timer.paa"; - onPlace = "[_this select 1, (_this select 3) select 0] call AGM_Explosives_fnc_startTimer;false"; - onSetup = "_this call AGM_Explosives_fnc_openTimerSetUI;true"; - }; - class Tripwire { - displayName = $STR_AGM_Explosives_TripWire; - picture = "AGM_Explosives\data\UI\Tripwire.paa"; - onPlace = "false"; - }; -}; - -class CfgMineTriggers { - class RangeTrigger; - class MagneticTrigger: RangeTrigger { - mineMagnetic = 1; - mineTriggerRange = 1; - }; -}; diff --git a/TO_MERGE/agm/Explosives/CfgVehicles.hpp b/TO_MERGE/agm/Explosives/CfgVehicles.hpp deleted file mode 100644 index ba31a7a5bc..0000000000 --- a/TO_MERGE/agm/Explosives/CfgVehicles.hpp +++ /dev/null @@ -1,65 +0,0 @@ -//class thingX; -class Items_base_F; -class AGM_Explosives_Place: Items_base_F { - author = "AGM"; - _generalMacro = "AGM_Explosives_Place"; - displayName = "Multi-meter"; - mapSize = 0.2; - icon = "iconObject_1x2"; - model = "\A3\Structures_F\Items\Tools\MultiMeter_F.p3d"; - scope = 2; - scopeCurator = 1; - vehicleClass = "Cargo"; - AGM_offset[] = {0,0,0}; -}; - -class AGM_Explosives_Place_DemoCharge:AGM_Explosives_Place { - displayName = "Demo Charge"; - model = "\A3\Weapons_F\explosives\c4_charge_small_d"; -}; -class AGM_Explosives_Place_APERSBoundingMine:AGM_Explosives_Place { - displayName = "APERS Bounding Mine"; - model = "\A3\Weapons_F\explosives\mine_AP_bouncing"; -}; -class AGM_Explosives_Place_APERSMine:AGM_Explosives_Place { - displayName = "APERS Mine"; - model = "\A3\Weapons_F\explosives\mine_ap"; -}; -class AGM_Explosives_Place_APERSTripwireMine:AGM_Explosives_Place { - displayName = "APERS Tripwire Mine"; - model = "\A3\Weapons_F\explosives\mine_AP_tripwire"; - AGM_offset[] = {1,0,0}; -}; - -class AGM_Explosives_Place_ATMine:AGM_Explosives_Place { - displayName = "AT Mine"; - model = "\A3\Weapons_f\Explosives\mine_at"; -}; - -class AGM_Explosives_Place_Claymore:AGM_Explosives_Place { - displayName = "Claymore"; - model = "\A3\Weapons_F\explosives\mine_AP_miniclaymore"; -}; - -class AGM_Explosives_Place_SatchelCharge:AGM_Explosives_Place { - displayName = "Satchel Charge"; - model = "\A3\Weapons_F\Explosives\satchel"; -}; - -class AGM_Explosives_Place_SLAM:AGM_Explosives_Place { - displayName = "SLAM"; - model = "\A3\Weapons_F\Explosives\mine_SLAM_directional"; -}; -/* -class AGM_Explosives_Place_NavalMine:AGM_Explosives_Place { - displayName = "Naval Mine"; - model = "\A3\Weapons_F\explosives\mine_naval"; -}; -class AGM_Explosives_Place_NavalABMine:AGM_Explosives_Place { - displayName = "Naval Mine"; - model = "\A3\Weapons_F\explosives\mine_naval2"; -}; -class AGM_Explosives_Place_NavalPDMMine:AGM_Explosives_Place { - displayName = "Naval Mine"; - model = "\A3\Weapons_F\explosives\mine_naval3"; -};*/ diff --git a/TO_MERGE/agm/Explosives/CfgWeapons.hpp b/TO_MERGE/agm/Explosives/CfgWeapons.hpp deleted file mode 100644 index 7ab255fcc2..0000000000 --- a/TO_MERGE/agm/Explosives/CfgWeapons.hpp +++ /dev/null @@ -1,55 +0,0 @@ -class CfgWeapons { - class AGM_ItemCore; - class InventoryItem_Base_f; - - class AGM_ExplosiveItem: InventoryItem_Base_f { - allowedSlots[] = {801,701,901}; - //type = 201; - }; - - class AGM_Clacker: AGM_ItemCore { - scope = 2; - displayName = $STR_AGM_Explosives_clacker_displayName; - descriptionShort = $STR_AGM_Explosives_clacker_description; - picture = "\AGM_Explosives\Data\UI\Clacker.paa"; - model = "\A3\weapons_F\ammo\mag_univ.p3d"; - AGM_range = 250; - AGM_Detonator = 1; - - class ItemInfo: AGM_ExplosiveItem { - mass = 3; - uniformModel = "\A3\weapons_F\ammo\mag_univ.p3d"; - }; - }; - class AGM_M26_Clacker: AGM_Clacker { - displayName = $STR_AGM_Explosives_M26_displayName; - picture = "\AGM_Explosives\Data\UI\MK26_Transmitter_ca.paa"; - AGM_range = 5000; - }; - class AGM_DefusalKit: AGM_ItemCore { - scope = 2; - displayName = $STR_AGM_Explosives_DefusalKit_displayName; - descriptionShort = $STR_AGM_Explosives_DefusalKit_description; - picture = "\AGM_Explosives\Data\UI\pliers.paa"; - model = "\A3\Structures_F\Items\Tools\Pliers_F.p3d"; - - class ItemInfo: AGM_ExplosiveItem { - mass = 5; - uniformModel = "\A3\Structures_F\Items\Tools\Pliers_F.p3d"; - }; - }; - class AGM_DeadManSwitch: AGM_ItemCore { - scope = 2; - displayName = $STR_AGM_Explosives_DeadManSwitch_displayName; - descriptionShort = $STR_AGM_Explosives_DeadManSwitch_description; - picture = "\AGM_Explosives\Data\UI\DeadmanSwitch.paa"; - model = "\A3\weapons_F\ammo\mag_univ.p3d"; - AGM_range = 100; - AGM_Detonator = 1; - - class ItemInfo: AGM_ExplosiveItem { - mass = 2; - uniformModel = "\A3\weapons_F\ammo\mag_univ.p3d"; - }; - }; -}; diff --git a/TO_MERGE/agm/Explosives/ExplosivesUI.hpp b/TO_MERGE/agm/Explosives/ExplosivesUI.hpp deleted file mode 100644 index ec17015c47..0000000000 --- a/TO_MERGE/agm/Explosives/ExplosivesUI.hpp +++ /dev/null @@ -1,74 +0,0 @@ -#define GUI_GRID_X (0) -#define GUI_GRID_Y (0) -#define GUI_GRID_W (0.025) -#define GUI_GRID_H (0.04) - -#define ST_CENTER 0x02 - -class RscText; -class RscButton; - -#define X_OFFSET 0.25 - -class RscXSliderH; -class IGUIBack; - -class Rsc_AGM_Timer_Slider:RscXSliderH{ - x = 0.4; - y = 0.2; - w = 0.3; - h = "1*((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0,0,0,0.5}; -}; - -class RscAGM_SelectTimeUI -{ - idd = 8854; - movingEnable = 0; - class controls { - class back:IGUIBack { - x = X_OFFSET; - y = 0; - w = 0.5; - h = 0.2; - colorBackground[] = {0, 0, 0, 0.5}; - }; - class header: RscText{ - idc = 8870; - x = X_OFFSET + 0.005; - y = 0.005; - w = 0.49; - h = 0.05; - style = ST_CENTER; - text = ""; - }; - class slider: Rsc_AGM_Timer_Slider { - idc = 8845; - x = X_OFFSET + 0.005; - y = 0.06; - w = 0.49; - h = 0.025; - onSliderPosChanged = "private ['_mins', '_secs'];_mins = floor((_this select 1)/60);_secs=floor((_this select 1) - (_mins*60));ctrlSetText [8870, format[localize 'STR_AGM_Explosives_TimerMenu',_mins, _secs]];"; - }; - class cancelBtn: RscButton { - idc = 8855; - x = X_OFFSET + 0.005; - w = 0.15; - h = 0.1; - y = 0.09; - style = ST_CENTER; - text = $STR_AGM_Explosives_Cancel; - action = "closeDialog 0;"; - }; - class approveBtn: RscButton { - idc = 8860; - x = X_OFFSET + 0.345; - y = 0.09; - h = 0.1; - w = 0.15; - style = ST_CENTER; - text = $STR_AGM_Explosives_SetTime; - action = "closeDialog 0;"; - }; - }; -}; diff --git a/TO_MERGE/agm/Explosives/Module.hpp b/TO_MERGE/agm/Explosives/Module.hpp deleted file mode 100644 index 6f80acc369..0000000000 --- a/TO_MERGE/agm/Explosives/Module.hpp +++ /dev/null @@ -1,46 +0,0 @@ -class Module_F; -class AGM_ModuleExplosive: Module_F { - author = "AGM Team"; - category = "AGM"; - displayName = "Explosive System"; - function = "AGM_Explosives_fnc_module"; - scope = 2; - isGlobal = 1; - icon = "\AGM_Explosives\UI\IconExplosives_ca.paa"; - class Arguments { - class RequireSpecialist { - displayName = "Require specialists?"; - //description = "Require explosive specialists to plant/disable explosives? Default: No"; - // The above distinction is commented out due to the explanation in fn_SetupExplosive.sqf - description = "Require explosive specialists to disable explosives? Default: No"; - typeName = "BOOL"; - class values { - class Yes { - name = "Yes"; - value = 1; - }; - class No { - default = 1; - name = "No"; - value = 0; - }; - }; - }; - class PunishNonSpecialists { - displayName = "Punish non-specialists?"; - description = "Increase the time it takes to complete actions for non-specialists? Default: Yes"; - typeName = "BOOL"; - class values { - class Yes { - default = 1; - name = "Yes"; - value = 1; - }; - class No { - name = "No"; - value = 0; - }; - }; - }; - }; -}; diff --git a/TO_MERGE/agm/Explosives/config.cpp b/TO_MERGE/agm/Explosives/config.cpp deleted file mode 100644 index ba8cd53029..0000000000 --- a/TO_MERGE/agm/Explosives/config.cpp +++ /dev/null @@ -1,300 +0,0 @@ -class CfgPatches { - class AGM_Explosives { - units[] = {}; - weapons[] = {"AGM_Clacker", "AGM_DefusalKit", "AGM_M26_Clacker", "AGM_DeadManSwitch"}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core, AGM_Interaction}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"Garth 'L-H' de Wet"}; - authorUrl = "https://github.com/corruptedheart/"; - }; -}; - -class CfgFunctions { - class AGM_Explosives { - class Explosives { - file="AGM_Explosives\functions"; - - class AddClacker; - class CanDefuse; - class DefuseExplosive; - class DetonateExplosive; - class HandleScrollWheel; - - class hasExplosives; - class hasPlacedExplosives; - - class getDetonators; - class getPlacedExplosives; - - class initialise{postInit=1;}; - //class JammerInit; - - class openDetonateUI; - class openPlaceUI; - class openTransmitterUI; - class openTimerSetUI; - class openTriggerSelectionUI; - - class Place_Approve; - class Place_Cancel; - class PlaceExplosive; - - class SelectTrigger; - class SetupExplosive; - class SetPos; - class StartDefuse; - class StartTimer; - - class TriggerType; - }; - }; -}; - -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ -}; - -#define MACRO_DETONATEACTION class AGM_SelfActions { \ - class AGM_Explosives { \ - displayName = $STR_AGM_Explosives_Menu;\ - condition = "true";\ - statement = "";\ - exceptions[] = {"AGM_Interaction_isNotSwimming"}; \ - showDisabled = 1;\ - priority = 4;\ - icon = "AGM_Explosives\UI\Icon_Explosive_ca.paa"; \ - subMenu[] = {"AGM_Explosives", 1};\ - hotkey = "X";\ - class AGM_Detonate {\ - displayName = $STR_AGM_Explosives_Detonate;\ - condition = "[_player] call AGM_Explosives_fnc_hasPlacedExplosives and {count ([_player] call AGM_Explosives_fnc_getDetonators) > 0}";\ - statement = "[_player] call AGM_Explosives_fnc_openTransmitterUI;";\ - exceptions[] = {"AGM_Interaction_isNotSwimming"}; \ - icon = "AGM_Explosives\UI\Icon_Explosive_ca.paa"; \ - showDisabled = 1;\ - priority = 2;\ - hotkey = "T";\ - };\ - };\ - }; - -class CfgVehicles { - class Man; - - class CAManBase: Man { - class AGM_SelfActions { - class AGM_Explosives { - displayName = $STR_AGM_Explosives_Menu; - condition = "!(_player getVariable ['AGM_PlantingExplosive', false])"; - statement = ""; - exceptions[] = {"AGM_Interaction_isNotSwimming"}; \ - showDisabled = 1; - priority = 4; - icon = "AGM_Explosives\UI\Icon_Explosive_ca.paa"; - subMenu[] = {"AGM_Explosives", 1}; - hotkey = "X"; - //Sub-menu items - class AGM_Detonate { - displayName = $STR_AGM_Explosives_Detonate; - condition = "[_player] call AGM_Explosives_fnc_hasPlacedExplosives and {count ([_player] call AGM_Explosives_fnc_getDetonators) > 0}"; - statement = "[_player] call AGM_Explosives_fnc_openTransmitterUI;"; - exceptions[] = {"AGM_Interaction_isNotSwimming"}; \ - showDisabled = 1; - icon = "AGM_Explosives\UI\Icon_Explosive_ca.paa"; - priority = 2; - hotkey = "T"; - }; - class AGM_Place { - displayName = $STR_AGM_Explosives_Place; - condition = "(vehicle _player == _player) and {[_player] call AGM_Explosives_fnc_hasExplosives}"; - statement = "[_player] call AGM_Explosives_fnc_openPlaceUI;"; - exceptions[] = {"AGM_Interaction_isNotSwimming"}; \ - showDisabled = 1; - icon = "AGM_Explosives\UI\Place_Explosive_ca.paa"; - priority = 1; - hotkey = "P"; - }; - class AGM_Defuse { - displayName = $STR_AGM_Explosives_Defuse; - condition = "[_player] call AGM_Explosives_fnc_CanDefuse"; - statement = "[_player, AGM_Interaction_Target] call AGM_Explosives_fnc_StartDefuse;"; - exceptions[] = {"AGM_Interaction_isNotSwimming"}; \ - showDisabled = 0; - icon = "AGM_Explosives\UI\defuse_ca.paa"; - priority = 0.8; - hotkey = "F"; - }; - }; - }; - }; - - #include "CfgVehicles.hpp" - - class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class FIA_Box_Base_F; - class Box_NATO_Support_F; - - class Box_NATO_AmmoOrd_F: NATO_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_Clacker,12) - MACRO_ADDITEM(AGM_M26_Clacker,6) - MACRO_ADDITEM(AGM_DefusalKit,12) - }; - }; - - class Box_East_AmmoOrd_F: EAST_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_Clacker,12) - MACRO_ADDITEM(AGM_M26_Clacker,6) - MACRO_ADDITEM(AGM_DefusalKit,12) - }; - }; - - class Box_IND_AmmoOrd_F: IND_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_Clacker,12) - MACRO_ADDITEM(AGM_M26_Clacker,6) - MACRO_ADDITEM(AGM_DefusalKit,12) - MACRO_ADDITEM(AGM_Deadmanswitch,2) - }; - }; - - class Box_FIA_Ammo_F: FIA_Box_Base_F { - class TransportItems { - MACRO_ADDITEM(AGM_Clacker,2) - MACRO_ADDITEM(AGM_M26_Clacker,2) - MACRO_ADDITEM(AGM_DefusalKit,2) - MACRO_ADDITEM(AGM_Deadmanswitch,1) - }; - }; - - class AGM_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(AGM_Clacker,12) - MACRO_ADDITEM(AGM_M26_Clacker,6) - MACRO_ADDITEM(AGM_DefusalKit,12) - MACRO_ADDITEM(AGM_Deadmanswitch,6) - }; - }; - - class B_Kitbag_rgr; - class B_Kitbag_rgr_Exp: B_Kitbag_rgr { - class TransportItems { - class _xx_ToolKit { // xXToOlKiT420mLgXx - count = 0; - }; - }; - }; - class B_Carryall_ocamo; - class B_Carryall_ocamo_Exp: B_Carryall_ocamo { - class TransportItems { - class _xx_ToolKit { - count = 0; - }; - }; - }; - class B_Carryall_oucamo; - class B_Carryall_oucamo_Exp: B_Carryall_oucamo { - class TransportItems { - class _xx_ToolKit { - count = 0; - }; - }; - }; - class B_Carryall_oli; - class G_Carryall_Exp: B_Carryall_oli { - class TransportItems { - class _xx_ToolKit { - count = 0; - }; - }; - }; - class I_Carryall_oli_Exp: B_Carryall_oli { - class TransportItems { - class _xx_ToolKit { - count = 0; - }; - }; - }; - - #include "Module.hpp" - - // Add AGM_Clacker and AGM_DefusalKit to every explosive unit. - #define MACRO_ADDMINEKIT \ - items[] = {"FirstAidKit", "AGM_Clacker", "AGM_DefusalKit"}; \ - respawnitems[] = {"FirstAidKit", "AGM_Clacker", "AGM_DefusalKit"}; - - class B_Soldier_base_F; class B_soldier_exp_F:B_Soldier_base_F {MACRO_ADDMINEKIT}; - class B_Soldier_03_f; class B_engineer_F:B_Soldier_03_f {MACRO_ADDMINEKIT}; - class B_Soldier_diver_base_F; class B_diver_exp_F:B_Soldier_diver_base_F {MACRO_ADDMINEKIT}; - class B_Soldier_recon_base; class B_recon_exp_F:B_Soldier_recon_base {MACRO_ADDMINEKIT}; - class B_CTRG_soldier_engineer_exp_F:B_Soldier_base_F {MACRO_ADDMINEKIT}; - class I_G_Soldier_base_F; class I_G_engineer_F:I_G_Soldier_base_F {MACRO_ADDMINEKIT}; - class I_G_Soldier_exp_F:I_G_Soldier_base_F {MACRO_ADDMINEKIT}; - class B_G_engineer_F:I_G_engineer_F {MACRO_ADDMINEKIT}; - class O_G_engineer_F:I_G_engineer_F {MACRO_ADDMINEKIT}; - class B_G_Soldier_exp_F:I_G_Soldier_exp_F {MACRO_ADDMINEKIT}; - class O_G_Soldier_exp_F:I_G_Soldier_exp_F {MACRO_ADDMINEKIT}; - class I_Soldier_02_F; class I_Soldier_exp_F:I_Soldier_02_F {MACRO_ADDMINEKIT}; - class I_Soldier_base_F; class I_engineer_F:I_Soldier_base_F {MACRO_ADDMINEKIT}; - class I_Soldier_diver_base_F; class I_diver_exp_F:I_Soldier_diver_base_F {MACRO_ADDMINEKIT}; - class O_Soldier_base_F; class O_soldier_exp_F:O_Soldier_base_F {MACRO_ADDMINEKIT}; - class O_engineer_F:O_Soldier_base_F {MACRO_ADDMINEKIT}; - class O_Soldier_diver_base_F; class O_diver_exp_F:O_Soldier_diver_base_F {MACRO_ADDMINEKIT}; - class O_Soldier_recon_base; class O_recon_exp_F:O_Soldier_recon_base {MACRO_ADDMINEKIT}; - class O_Soldier_Urban_base; class O_soldierU_exp_F:O_Soldier_Urban_base {MACRO_ADDMINEKIT}; - class O_engineer_U_F:O_Soldier_Urban_base {MACRO_ADDMINEKIT}; - class B_Protagonist_VR_F:B_Soldier_base_F {MACRO_ADDMINEKIT}; - class O_Protagonist_VR_F:O_Soldier_base_F {MACRO_ADDMINEKIT}; - class I_Protagonist_VR_F:I_Soldier_base_F {MACRO_ADDMINEKIT}; - class B_Soldier_F; class b_soldier_universal_f:B_Soldier_F {MACRO_ADDMINEKIT}; - class B_G_Soldier_F; class b_g_soldier_universal_f:B_G_Soldier_F {MACRO_ADDMINEKIT}; - class O_Soldier_F; class o_soldier_universal_f:O_Soldier_F {MACRO_ADDMINEKIT}; - class O_G_Soldier_F; class o_g_soldier_universal_f:O_G_Soldier_F {MACRO_ADDMINEKIT}; - class I_soldier_F; class i_soldier_universal_f:I_soldier_F {MACRO_ADDMINEKIT}; - class I_G_Soldier_F; class i_g_soldier_universal_f:I_G_Soldier_F {MACRO_ADDMINEKIT}; - - // Add AGM_Clacker to snipers and spotters for setting off Claymores - #define MACRO_ADDCLAYMOREKIT \ - items[] = {"FirstAidKit","AGM_Clacker"}; \ - respawnitems[] = {"FirstAidKit","AGM_Clacker"}; - - class B_Soldier_sniper_base_F; - class B_sniper_F: B_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; - class B_spotter_F: B_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; - class I_Soldier_sniper_base_F; - class I_Sniper_F: I_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; - class I_Spotter_F: I_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; - class O_Soldier_sniper_base_F; - class O_sniper_F: O_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; - class O_spotter_F: O_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; - -}; - -#include "CfgAmmo.hpp" -#include "CfgMagazines.hpp" -#include "CfgWeapons.hpp" - -#include "ExplosivesUI.hpp" - -class CfgActions { - class None; - class Deactivate:None { - show = 0; - }; - class DeactivateMine:None { - show = 0; - }; -}; - -class AGM_Parameters_Boolean { - // Boolean Parameters (0/1) - AGM_Explosives_RequireSpecialist = 0; - AGM_Explosives_PunishNonSpecialists = 1; -}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_HandleScrollWheel.sqf b/TO_MERGE/agm/Explosives/functions/fn_HandleScrollWheel.sqf deleted file mode 100644 index a25e544360..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_HandleScrollWheel.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/* - Name: AGM_Explosives_fnc_HandleScrollWheel - - Author(s): - L-H - - Description: - Handles rotating of Explosives - - Parameters: - Number: Scroll amount - - Returns: - Boolean: Handled or not. - - Example: - 1.2 call AGM_Explosives_fnc_HandleScrollWheel; -*/ -private ["_obj"]; -if (isNull(AGM_Explosives_Setup) || {AGM_Modifier == 0} || !AGM_Explosives_pfeh_running) exitWith {false}; - -AGM_Explosives_Setup setDir ((getDir AGM_Explosives_Setup) + (_this*5)); -AGM_Explosives_TweakedAngle = AGM_Explosives_TweakedAngle + _this*5; - -true diff --git a/TO_MERGE/agm/Explosives/functions/fn_JammerInit.sqf b/TO_MERGE/agm/Explosives/functions/fn_JammerInit.sqf deleted file mode 100644 index 20b2e72035..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_JammerInit.sqf +++ /dev/null @@ -1,42 +0,0 @@ -/* - Name: AGM_Explosives_fnc_JammerInit - - Author(s): - Garth de Wet (LH) - - Description: - - - Parameters: - 0:OBJECT - unit carrying - 1:OBJECT - Jammer - - Returns: - Nothing - - Example: - [player,JammerObject] call AGM_Explosives_fnc_JammerInit; -*/ -if (isClass (configFile >> "CfgVehicles" >> (typeof (_this select 1))) and {getNumber(configFile >> "CfgVehicles" >> (typeof (_this select 1)) >> "AGM_JammerRange") > 0}) then { - private ["_found"]; - _found = false; - { - if ((_x select 2) == (_this select 1)) exitWith { - _x set [0, (_this select 0)]; - _found = true; - }; - } count AGM_Explosives_Jammers; - if !(_found) then { - AGM_Explosives_Jammers pushBack [(_this select 0), getNumber(configFile >> "CfgVehicles" >> (typeof (_this select 1)) >> "AGM_JammerRange"),(_this select 1)]; - }; - publicVariable "AGM_Explosives_Jammers"; - private "_check"; - _check = (_this select 1) getVariable "AGM_JammerCharge"; - if (isNil "_check") then { - (_this select 1) setVariable ["AGM_JammerCharge", getNumber(configFile >> "CfgVehicles" >> (typeof (_this select 1)) >> "AGM_JammerMaxCharge"), true]; - }; - _check = (_this select 1) getVariable "AGM_JammerEnabled"; - if (isNil "_check") then { - (_this select 1) setVariable ["AGM_JammerEnabled", false, true]; - }; -}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_Place_Approve.sqf b/TO_MERGE/agm/Explosives/functions/fn_Place_Approve.sqf deleted file mode 100644 index d00ed213fd..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_Place_Approve.sqf +++ /dev/null @@ -1,106 +0,0 @@ -/* - Name: AGM_Explosives_fnc_Place_Approve - - Author(s): - Garth de Wet (LH) - - Description: - Approves placement of the explosive, releases the placement object for it to settle in a location suitable for the explosive to be created. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call AGM_Explosives_fnc_Place_Approve; -*/ -if (AGM_Explosives_pfeh_running) then { - ["AGM_Explosives_Placement","OnEachFrame"] call BIS_fnc_removeStackedEventHandler; - AGM_Explosives_pfeh_running = false; -}; -private ["_mag", "_setup", "_player"]; -_setup = AGM_Explosives_Setup; -AGM_Explosives_Setup = objNull; -[AGM_Explosives_placer, "AGM_Explosives", false] call AGM_Core_fnc_setForceWalkStatus; -AGM_Explosives_placer = objNull; -_player = AGM_player; -[_player, "DefaultAction", _player getVariable ["AGM_Explosive_Place", -1]] call AGM_Core_fnc_removeActionEventHandler; -[_player, "MenuBack", _player getVariable ["AGM_Explosive_Cancel", -1]] call AGM_Core_fnc_removeActionEventHandler; -call AGM_Interaction_fnc_hideMouseHint; -if ((_setup getVariable ["AGM_Class", ""]) != "") then { - _dir = (getDir _setup); - if (_dir > 180) then { - _dir = _dir - 180; - } else { - _dir = 180 + _dir; - }; - _setup setVariable ["AGM_Dir", _dir]; - _player setVariable ["AGM_PlantingExplosive", true]; - _setup addEventHandler ["EpeContactStart", { - if (!((_this select 0) getVariable ["AGM_Handled", false])) then { - private ["_player", "_pos", "_attachTo"]; - _player = AGM_player; - _pos = getPosATL (_this select 0); - (_this select 0) enableSimulationGlobal false; - if (surfaceIsWater _pos) then { - _pos = getPosASL (_this select 0); - (_this select 0) setPosASL _pos; - }else{ - (_this select 0) setPosATL _pos; - }; - (_this select 0) setVariable ["AGM_Handled", true]; - _player setVariable ["AGM_PlantingExplosive", false]; - _attachTo = objNull; - if (!isNull (_this select 1) && {(_this select 1) isKindOf "AllVehicles"}) then { - _attachTo = (_this select 1); - }; - [(_this select 0),_attachTo, _pos] spawn { - private ["_mag", "_setup", "_dir", "_player"]; - _setup = _this select 0; - _player = AGM_player; - _mag = _setup getVariable ["AGM_Class", ""]; - _dir = _setup getVariable ["AGM_Dir", 0]; - - sleep getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "AGM_DelayTime"); - _explosive = [_player, _this select 2, _dir, _mag, _setup getVariable "AGM_Trigger", [_setup getVariable "AGM_Timer"], isNull (_this select 1)] call AGM_Explosives_fnc_PlaceExplosive; - deleteVehicle _setup; - if (!isNull(_explosive)) then { - _player RemoveMagazine _mag; - sleep 0.2; - if (!isNull (_this select 1)) then { - _explosive attachTo [(_this select 1)]; - _dir = _dir - (getDir (_this select 1)); - [[_explosive, _dir, 0], "AGM_Explosives_fnc_setPos"] call AGM_Core_fnc_execRemoteFnc; - }; - }; - }; - }; - }]; - _setup enableSimulationGlobal true; - _player playActionNow "MedicOther"; - [_setup] spawn { - private ["_setup", "_player"]; - _setup = _this select 0; - _player = AGM_player; - sleep 5; - if (!isNull _setup) then { - private ["_mag", "_dir", "_delayTime"]; - _mag = _setup getVariable ["AGM_Class", ""]; - _dir = _setup getVariable ["AGM_Dir", 0]; - _delayTime = (getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "AGM_DelayTime")) - 5; - if (_delayTime > 0) then { - sleep _delayTime; - }; - if (!isNull _setup) then { - [_player, GetPosATL _setup, _dir, _mag, _setup getVariable "AGM_Trigger", [_setup getVariable "AGM_Timer"], true] call AGM_Explosives_fnc_PlaceExplosive; - deleteVehicle _setup; - _player RemoveMagazine _mag; - _player setVariable ["AGM_PlantingExplosive", false]; - }; - }; - }; -}else{ - deleteVehicle _setup; -}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_Place_Cancel.sqf b/TO_MERGE/agm/Explosives/functions/fn_Place_Cancel.sqf deleted file mode 100644 index 76e883d356..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_Place_Cancel.sqf +++ /dev/null @@ -1,34 +0,0 @@ -/* - Name: AGM_Explosives_fnc_Place_Cancel - - Author(s): - Garth de Wet (LH) - - Description: - Cancels placement of the explosive - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call AGM_Explosives_fnc_Place_Cancel; -*/ -if (AGM_Explosives_pfeh_running) then { - ["AGM_Explosives_Placement","OnEachFrame"] call BIS_fnc_removeStackedEventHandler; - AGM_Explosives_pfeh_running = false; -}; -if (!isNull (AGM_Explosives_Setup)) then { - deleteVehicle AGM_Explosives_Setup; -}; -AGM_Explosives_Setup = objNull; -if (isNil {AGM_Explosives_placer}) then { - AGM_Explosives_placer = objNull; -}; -[AGM_Explosives_placer, "AGM_Explosives", false] call AGM_Core_fnc_setForceWalkStatus; -AGM_Explosives_placer = objNull; -call AGM_Interaction_fnc_hideMouseHint; -[AGM_player, "DefaultAction", AGM_player getVariable ["AGM_Explosive_Place", -1]] call AGM_Core_fnc_removeActionEventHandler; -[AGM_player, "MenuBack", AGM_player getVariable ["AGM_Explosive_Cancel", -1]] call AGM_Core_fnc_removeActionEventHandler; \ No newline at end of file diff --git a/TO_MERGE/agm/Explosives/functions/fn_SetupExplosive.sqf b/TO_MERGE/agm/Explosives/functions/fn_SetupExplosive.sqf deleted file mode 100644 index d5fedf00cb..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_SetupExplosive.sqf +++ /dev/null @@ -1,65 +0,0 @@ -/* - Name: AGM_Explosives_fnc_SetupExplosive - - Author(s): - Garth de Wet (LH) - - Description: - Starts the setup process for the passed explosive. - - Parameters: - 0: OBJECT - Unit placing explosive. - 1: STRING - Classname of explosive to place. (CfgMagazine class) - 2: Config - Trigger Config - 3: NUMBER - (optional) timer - - Returns: - Nothing - - Example: - [player, "SatchelCharge_Remote_Mag", "Command"] call AGM_Explosives_fnc_SetupExplosive; -*/ -_this spawn { - private ["_unit", "_class", "_config", "_timer"]; - _unit = _this select 0; - _class = _this select 1; - _config = _this select 2; - _timer = _this select 3; - AGM_Explosives_placer = _unit; - // Commented out due to the fact there is a distinction between who can deactivate mines and who can plant them in standard configs. - // Would require custom config entries (AGM_ExplosiveSpecialist/AGM_Specialist) which excludes custom mods. - //if (AGM_Explosives_RequireSpecialist && {!([_unit] call AGM_Core_fnc_isEOD)}) exitWith {}; - if (isNil "_config") then { - _config = getArray(ConfigFile >> "CfgMagazines" >> _class >> "AGM_Triggers" >> "AGM_Triggers") select 0; - }; - - AGM_Explosives_Setup = getText(ConfigFile >> "CfgMagazines" >> _class >> "AGM_SetupObject") createVehicleLocal [0,0,-10000]; - - AGM_Explosives_Setup enableSimulationGlobal false; - AGM_Explosives_Setup setVariable ["AGM_Class", _class]; - AGM_Explosives_Setup setVariable ["AGM_Trigger", _config]; - //AGM_Explosives_Setup setVariable ["AGM_Offset", GetArray(ConfigFile >> "CfgVehicles" >> typeof AGM_Explosives_Setup >> "AGM_Offset")]; - if (!isNil "_timer") then { - AGM_Explosives_Setup setVariable ["AGM_Timer", _timer]; - }; - - [_unit, "AGM_Explosives", true] call AGM_Core_fnc_setForceWalkStatus; - AGM_Explosives_TweakedAngle = 180; - ["AGM_Explosives_Placement","OnEachFrame", { - private "_player"; - _player = AGM_player; - if (AGM_Explosives_placer != _player) exitWith { - call AGM_Explosives_fnc_Place_Cancel; - }; - AGM_Explosives_pfeh_running = true; - _pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); - //_pos = _pos vectorAdd ((VectorDir AGM_Explosives_setup) vectorCrossProduct (AGM_Explosives_setup getVariable ["AGM_Offset", [0,0,0]])); - AGM_Explosives_Setup setPosATL _pos; - if (AGM_Modifier == 0) then { - AGM_Explosives_Setup setDir (AGM_Explosives_TweakedAngle + getDir _player); - }; - }] call BIS_fnc_addStackedEventHandler; - [localize "STR_AGM_Explosives_PlaceAction", localize "STR_AGM_Explosives_CancelAction",localize "STR_AGM_Explosives_ScrollAction"] call AGM_Interaction_fnc_showMouseHint; - _unit setVariable ["AGM_Explosive_Place", [_unit, "DefaultAction", {AGM_Explosives_pfeh_running AND !isNull (AGM_Explosives_setup)}, {call AGM_Explosives_fnc_Place_Approve;}] call AGM_Core_fnc_AddActionEventHandler]; - _unit setVariable ["AGM_Explosive_Cancel", [_unit, "MenuBack", {AGM_Explosives_pfeh_running AND !isNull (AGM_Explosives_setup)}, {call AGM_Explosives_fnc_Place_Cancel;}] call AGM_Core_fnc_AddActionEventHandler]; -}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_StartDefuse.sqf b/TO_MERGE/agm/Explosives/functions/fn_StartDefuse.sqf deleted file mode 100644 index 292244209e..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_StartDefuse.sqf +++ /dev/null @@ -1,65 +0,0 @@ -/* - Name: AGM_Explosives_fnc_StartDefuse - - Author: Garth de Wet (LH) - - Description: - Starts defusing an explosive - - Parameters: - 0: OBJECT - Unit to defuse explosive - 1: OBJECT - Target explosive - - Returns: - Nothing - - Example: - [player, AGM_Interaction_Target] call AGM_Explosives_fnc_StartDefuse; -*/ -private ["_unit","_target"]; -_unit = _this select 0; -_target = _this select 1; - -// [_specialist, _target] call _fnc_DefuseTime; -_fnc_DefuseTime = { - _target = _this select 1; - - _defuseTime = 5; - if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "AGM_DefuseTime")) then { - _defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "AGM_DefuseTime"); - }; - if (!(_this select 0) && {AGM_Explosives_PunishNonSpecialists}) then { - _defuseTime = _defuseTime * 1.5; - }; - _defuseTime -}; -_actionToPlay = "MedicOther"; -if (STANCE _unit == "Prone") then { - _actionToPlay = "PutDown"; -}; - -if (AGM_player != _unit) then { - // If the unit is a player, call the function on the player. - if (isPlayer _unit) then { - [[_unit, _target], "AGM_Explosives_fnc_StartDefuse", _unit] call AGM_Core_fnc_execRemoteFnc; - } else { - [_unit, _target, [[_unit] call AGM_Core_fnc_isEOD, _target] call _fnc_DefuseTime] spawn { - (_this select 0) playActionNow _actionToPlay; - (_this select 0) disableAI "MOVE"; - (_this select 0) disableAI "TARGET"; - sleep (_this select 2); - [(_this select 0), (_this select 1)] call AGM_Explosives_fnc_DefuseExplosive; - (_this select 0) enableAI "MOVE"; - (_this select 0) enableAI "TARGET"; - }; - }; -} else { - _unit playActionNow _actionToPlay; - if (AGM_Explosives_RequireSpecialist) then { - if ([_unit] call AGM_Core_fnc_isEOD) then { - [[true, _target] call _fnc_DefuseTime, [_unit,_target], "AGM_Explosives_fnc_DefuseExplosive", localize "STR_AGM_Explosives_DefusingExplosive"] call AGM_Core_fnc_progressBar; - }; - } else { - [[([_unit] call AGM_Core_fnc_isEOD), _target] call _fnc_DefuseTime, [_unit,_target], "AGM_Explosives_fnc_DefuseExplosive", localize "STR_AGM_Explosives_DefusingExplosive"] call AGM_Core_fnc_progressBar; - }; -}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_initialise.sqf b/TO_MERGE/agm/Explosives/functions/fn_initialise.sqf deleted file mode 100644 index f1186f6714..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_initialise.sqf +++ /dev/null @@ -1,73 +0,0 @@ -/* - Name: AGM_Explosives_fnc_Initialise - - Author(s): - Garth de Wet (LH) - - Description: - Initialises explosive behaviour. - - Parameters: - None - - Returns: - None - - Example: - None -*/ -if !(hasInterface) exitWith {}; -AGM_Explosives_PlacedCount = 0; -AGM_Explosives_Setup = objNull; -AGM_Explosives_pfeh_running = false; -AGM_Explosives_null = [] spawn { - waitUntil {sleep 0.356;!isNull(player)}; - [{(_this select 0) call AGM_Explosives_fnc_HandleScrollWheel;}] call AGM_Core_fnc_addScrollWheelEventHandler; - player addEventHandler ["Respawn", { - [(_this select 0)] call AGM_Explosives_fnc_initialiseUnit; - }]; - player addEventHandler ["Killed", { - private "_deadman"; - call AGM_Explosives_fnc_Place_Cancel; - _deadman = [(_this select 0), "DeadManSwitch"] call AGM_Explosives_fnc_getPlacedExplosives; - { - [(_this select 0), -1, _x, true] call AGM_Explosives_fnc_DetonateExplosive; - } count _deadman; - }]; - player addEventHandler ["Take", { - private ["_item", "_getter", "_giver", "_config"]; - _item = _this select 2; - _getter = _this select 0; - _giver = _this select 1; - - _config = ConfigFile >> "CfgWeapons" >> _item; - if (isClass _config && {getNumber(_config >> "AGM_Detonator") == 1}) then { - private ["_clackerItems"]; - _clackerItems = _giver getVariable ["AGM_Clacker", []]; - _getter SetVariable ["AGM_Clacker", (_getter getVariable ["AGM_Clacker", []]) + _clackerItems, true]; - - _detonators = [_giver] call AGM_Explosives_fnc_getDetonators; - if (count _detonators == 0) then { - _giver setVariable ["AGM_Clacker", nil, true]; - }; - }; - }]; - player addEventHandler ["Put", { - private ["_item", "_getter", "_giver", "_config"]; - _item = _this select 2; - _getter = _this select 1; - _giver = _this select 0; - - _config = ConfigFile >> "CfgWeapons" >> _item; - if (isClass _config && {getNumber(_config >> "AGM_Detonator") == 1}) then { - private ["_clackerItems"]; - _clackerItems = _giver getVariable ["AGM_Clacker", []]; - _getter SetVariable ["AGM_Clacker", (_getter getVariable ["AGM_Clacker", []]) + _clackerItems, true]; - - _detonators = [_giver] call AGM_Explosives_fnc_getDetonators; - if (count _detonators == 0) then { - _giver setVariable ["AGM_Clacker", nil, true]; - }; - }; - }]; -}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_isSpecialist.sqf b/TO_MERGE/agm/Explosives/functions/fn_isSpecialist.sqf deleted file mode 100644 index 99ab01dbc4..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_isSpecialist.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/* - Name: AGM_Explosives_fnc_isSpecialist - - Author: Garth de Wet (LH) - - Description: - Checks whether the passed unit is an explosive specialist. - Either through config entry: "canDeactivateMines" - or - unit setVariable ["AGM_isEOD", true] - - Parameters: - OBJECT - Unit to check if is a specialist - - Returns: - BOOLEAN - - Example: - _isSpecialist = player call AGM_Explosives_fnc_isSpecialist; -*/ -private "_isSpecialist"; -_isSpecialist = _this getVariable "AGM_isEOD"; -if (isNil "_isSpecialist") then { - _isSpecialist = getNumber(ConfigFile >> "CfgVehicles" >> typeof _this >> "canDeactivateMines") == 1; -}; -_isSpecialist diff --git a/TO_MERGE/agm/Explosives/functions/fn_module.sqf b/TO_MERGE/agm/Explosives/functions/fn_module.sqf deleted file mode 100644 index 2b1a45ac4f..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_module.sqf +++ /dev/null @@ -1,27 +0,0 @@ -/* - Name: AGM_Explosives_fnc_module - - Author: Garth de Wet (LH) - - Description: - Initialises the explosives module - - Parameters: - Things - - Returns: - Nothing - - Example: - -*/ -if !(isServer) exitWith {}; -_logic = _this select 0; -_activated = _this select 2; - -if !(_activated) exitWith {}; - -[_logic, "AGM_Explosives_RequireSpecialist", "RequireSpecialist" ] call AGM_Core_fnc_readBooleanParameterFromModule; -[_logic, "AGM_Explosives_PunishNonSpecialists", "PunishNonSpecialists" ] call AGM_Core_fnc_readBooleanParameterFromModule; - -diag_log text "[AGM]: Explosive Module Initialized."; diff --git a/TO_MERGE/agm/Explosives/functions/fn_openDetonateUI.sqf b/TO_MERGE/agm/Explosives/functions/fn_openDetonateUI.sqf deleted file mode 100644 index 0fcec6a262..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_openDetonateUI.sqf +++ /dev/null @@ -1,61 +0,0 @@ -/* - Name: AGM_Explosives_fnc_openDetonateUI - - Author: Garth de Wet (LH) - - Description: - Opens the UI for explosive detonation selection - - Parameters: - 0: OBJECT - unit - 0: STRING - Classname of detonator - - Returns: - Nothing - - Example: - [player, "AGM_M26_Clacker"] call AGM_Explosives_fnc_openDetonateUI; -*/ -private ["_unit","_result", "_item"]; -call AGM_Interaction_fnc_hideMenu; -_unit = _this select 0; -_detonator = _this select 1; -_range = GetNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "AGM_Range"); - -_result = [_unit] call AGM_Explosives_fnc_getPlacedExplosives; -_actions = [localize "STR_AGM_Explosives_DetonateMenu", localize "STR_AGM_Explosives_Detonate"] call AGM_Interaction_fnc_prepareSelectMenu; -_count = 0; -{ - if (!isNull(_x select 0)) then { - _required = getArray (ConfigFile >> "CfgAGM_Triggers" >> (_x select 4) >> "requires"); - if (_detonator in _required) then { - _item = ConfigFile >> "CfgMagazines" >> (_x select 3); - _actions = [ - _actions, - _x select 2, - getText(_item >> "picture"), - [_foreachIndex, _range] - ] call AGM_Interaction_fnc_AddSelectableItem; - _count = _count + 1; - }; - }; -} foreach _result; -if (_count > 0) then { - [ - _actions, - { - [ - AGM_player, - [_this select 1] call AGM_Core_fnc_toNumber, - (AGM_player getVariable ["AGM_Clacker", []]) select ([_this select 0] call AGM_Core_fnc_toNumber), - false - ] call AGM_Explosives_fnc_DetonateExplosive; - call AGM_Interaction_fnc_hideMenu; - }, - {[AGM_player] call AGM_Explosives_fnc_openTransmitterUI;} - ] call AGM_Interaction_fnc_openSelectMenu; -}else{ - call AGM_Interaction_fnc_hideMenu; - [AGM_player] call AGM_Explosives_fnc_openTransmitterUI; - [localize "STR_AGM_Explosives_NoExplosivesAvailable"] call AGM_Core_fnc_displayTextStructured; -}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_openTimerSetUI.sqf b/TO_MERGE/agm/Explosives/functions/fn_openTimerSetUI.sqf deleted file mode 100644 index 2248b68fdb..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_openTimerSetUI.sqf +++ /dev/null @@ -1,27 +0,0 @@ -/* - Name: AGM_Explosives_fnc_openTimerSetUI - - Author: Garth de Wet (LH) - - Description: - Opens the UI for timer setting of an explosive - - Parameters: - 0: String - Magazine - - Returns: - Nothing - - Example: - [player] call AGM_Explosives_fnc_openTimerSetUI; -*/ -private ["_mag"]; -_mag = _this select 0; -createDialog "RscAGM_SelectTimeUI"; -sliderSetRange [8845, 5, 900]; // 5seconds - 15minutes -sliderSetPosition [8845, 30]; - -buttonSetAction [8860, format["[AGM_player, '%1', 'Timer', floor(sliderPosition 8845)] call AGM_Explosives_fnc_SetupExplosive;closeDialog 0;", _mag]]; -buttonSetAction [8855, format["['%1'] call AGM_Explosives_fnc_openTriggerSelectionUI;", _mag]]; - -ctrlSetText [8870, format[localize "STR_AGM_Explosives_TimerMenu",0, 30]]; diff --git a/TO_MERGE/agm/Explosives/functions/fn_openTransmitterUI.sqf b/TO_MERGE/agm/Explosives/functions/fn_openTransmitterUI.sqf deleted file mode 100644 index 5e18912d3e..0000000000 --- a/TO_MERGE/agm/Explosives/functions/fn_openTransmitterUI.sqf +++ /dev/null @@ -1,51 +0,0 @@ -/* - Name: AGM_Explosives_fnc_openTransmitterUI - - Author: Garth de Wet (LH) - - Description: - Opens the UI for selecting the transmitter - - Parameters: - 0: OBJECT - Unit - - Returns: - Nothing - - Example: - [player] call AGM_Explosives_fnc_openTransmitterUI; -*/ -private ["_items", "_unit", "_count", "_actions", "_config"]; -_unit = _this select 0; -_items = (items _unit); - -_actions = [localize "STR_AGM_Explosives_TriggerMenu", localize "STR_AGM_Explosives_SelectTrigger"] call AGM_Interaction_fnc_prepareSelectMenu; -_detonators = [_unit] call AGM_Explosives_fnc_getDetonators; -{ - _config = ConfigFile >> "CfgWeapons" >> _x; - _actions = [ - _actions, - getText(_config >> "displayName"), - getText(_config >> "picture"), - _x - ] call AGM_Interaction_fnc_AddSelectableItem; -} count _detonators; - -if (count _detonators == 0) then { - call AGM_Interaction_fnc_hideMenu; - "AGM_Explosives" call AGM_Interaction_fnc_openMenuSelf; - [format[localize "STR_AGM_Explosives_NoTriggersAvailable", "player"]] call AGM_Core_fnc_displayTextStructured; -}else{ - [ - _actions, - { - [AGM_player, _this] call AGM_Explosives_fnc_openDetonateUI; - }, - { - call AGM_Interaction_fnc_hideMenu; - if !(profileNamespace getVariable ["AGM_Interaction_AutoCloseMenu", false]) then { - "AGM_Explosives" call AGM_Interaction_fnc_openMenuSelf; - }; - } - ] call AGM_Interaction_fnc_openSelectMenu; -}; diff --git a/addons/explosives/CfgACE_Triggers.hpp b/addons/explosives/CfgACE_Triggers.hpp new file mode 100644 index 0000000000..eb3df6a906 --- /dev/null +++ b/addons/explosives/CfgACE_Triggers.hpp @@ -0,0 +1,48 @@ +class CfgACE_Triggers { + /* onPlace parameters: + 0: OBJECT - unit placing + 1: OBJECT - Placed explosive + 2: STRING - Magazine classname + 3: ARRAY - vars + Last Index: CfgACE_Triggers config of trigger type. + onSetup parameters: + 0: STRING - Magazine Classname + */ + class Command { + displayName = $STR_ACE_Explosives_clacker_displayName; + picture = "\ACE_Explosives\Data\UI\Clacker.paa"; + onPlace = QUOTE( _this call FUNC(AddClacker);false ); + requires[] = {"ACE_Clacker"}; + }; + class MK16_Transmitter:Command { + displayName = $STR_ACE_Explosives_MK16_displayName; + picture = "\ACE_Explosives\Data\UI\MK16_Reciever_ca.paa"; + requires[] = {"ACE_M26_Clacker"}; + }; + class DeadManSwitch:Command { + displayName = $STR_ACE_Explosives_DeadManSwitch_displayName; + picture = "\ACE_Explosives\Data\UI\DeadmanSwitch.paa"; + requires[] = {"ACE_DeadManSwitch"}; + }; + class PressurePlate { + displayName = $STR_ACE_Explosives_PressurePlate; + picture = "ACE_Explosives\data\UI\PressurePlate.paa"; + onPlace = "_dist=GetNumber(ConfigFile >> 'CfgMagazines' >> (_this select 2) >> 'ACE_Triggers' >> 'PressurePlate' >> 'digDistance');_ex=_this select 1;_ex setPosATL ((getPosATL _ex) vectorDiff ((VectorUp _ex) vectorCrossProduct [0,0,_dist]));false"; + }; + class IRSensor { + displayName = $STR_ACE_Explosives_IRSensor; + picture = "ACE_Explosives\data\UI\PressurePlate.paa"; + onPlace = "false"; + }; + class Timer { + displayName = $STR_ACE_Explosives_timerName; + picture = "ACE_Explosives\data\UI\Timer.paa"; + onPlace = QUOTE( [_this select 1, (_this select 3) select 0] call FUNC(startTimer);false ); + onSetup = QUOTE( _this call FUNC(openTimerSetUI);true ); + }; + class Tripwire { + displayName = $STR_ACE_Explosives_TripWire; + picture = "ACE_Explosives\data\UI\Tripwire.paa"; + onPlace = "false"; + }; +}; diff --git a/addons/explosives/CfgAmmo.hpp b/addons/explosives/CfgAmmo.hpp new file mode 100644 index 0000000000..4a6e898886 --- /dev/null +++ b/addons/explosives/CfgAmmo.hpp @@ -0,0 +1,86 @@ +class CfgAmmo { + // All explosive based Ammo classes. These are all listed in case they become required. + class Default; + + class TimeBombCore:Default { + ACE_DefuseTime = 5; + }; + /* + class BoundingMineCore:TimeBombCore; + class BoundingMineBase:BoundingMineCore; + class APERSBoundingMine_Range_Ammo:BoundingMineBase; + + class MineCore: TimeBombCore; + class MineBase:MineCore; + class APERSMine_Range_Ammo:MineBase; + class ATMine_Range_Ammo:MineBase; + + class UnderwaterMine_Range_Ammo:MineBase; + class UnderwaterMineAB_Range_Ammo:UnderwaterMine_Range_Ammo; + class UnderwaterMinePDM_Range_Ammo:UnderwaterMine_Range_Ammo; + + class DirectionalBombCore:TimeBombCore; + class DirectionalBombBase:DirectionalBombCore; + class APERSTripMine_Wire_Ammo:DirectionalBombBase; + + class SLAMDirectionalMine_Wire_Ammo:DirectionalBombBase; + + class PipeBombCore: TimeBombCore; + class PipeBombBase:PipeBombCore; + */ + class DirectionalBombBase; + class ClaymoreDirectionalMine_Remote_Ammo:DirectionalBombBase{ + ACE_Explosive = "ClaymoreDirectionalMine_Remote_Ammo_Scripted"; + soundActivation[] = {"",0,0,0}; + soundDeactivation[] = {"",0,0,0}; + }; + //class ClaymoreDirectionalMine_Remote_Ammo_Scripted:ClaymoreDirectionalMine_Remote_Ammo; + + class SLAMDirectionalMine_Wire_Ammo:DirectionalBombBase{ + indirectHitRange = 20; + ACE_explodeOnDefuse = 1; + }; + class SLAMDirectionalMine_Command_Ammo:SLAMDirectionalMine_Wire_Ammo { + mineTrigger = "RemoteTrigger"; + ACE_explodeOnDefuse = 0; + }; + class SLAMDirectionalMine_Timer_Ammo:SLAMDirectionalMine_Wire_Ammo { + mineTrigger = "TimeTrigger"; + ACE_explodeOnDefuse = 0; + }; + class SLAMDirectionalMine_Magnetic_Ammo:SLAMDirectionalMine_Wire_Ammo { + mineTrigger = "MagneticTrigger"; + }; + + class PipeBombBase; + class DemoCharge_Remote_Ammo:PipeBombBase{ + ACE_Explosive = "DemoCharge_Remote_Ammo_Scripted"; + soundActivation[] = {"",0,0,0}; + soundDeactivation[] = {"",0,0,0}; + hit = 500; + indirectHit = 500; + indirectHitRange = 7; + }; + class SatchelCharge_Remote_Ammo:PipeBombBase{ + ACE_Explosive = "SatchelCharge_Remote_Ammo_Scripted"; + soundActivation[] = {"",0,0,0}; + soundDeactivation[] = {"",0,0,0}; + }; + /* + class DemoCharge_Remote_Ammo_Scripted:DemoCharge_Remote_Ammo; + class SatchelCharge_Remote_Ammo_Scripted:SatchelCharge_Remote_Ammo; + +TODO: Configure IEDs to use the system. + class IEDLandBig_Remote_Ammo:PipeBombBase{ + triggerWhenDestroyed = 1; +}; +class IEDLandSmall_Remote_Ammo:PipeBombBase{ +triggerWhenDestroyed = 1; +}; +class IEDUrbanBig_Remote_Ammo:PipeBombBase{ +triggerWhenDestroyed = 1; +}; +class IEDUrbanSmall_Remote_Ammo:PipeBombBase{ +triggerWhenDestroyed = 1; +};*/ +}; diff --git a/addons/explosives/CfgEventHandlers.hpp b/addons/explosives/CfgEventHandlers.hpp new file mode 100644 index 0000000000..6b125bba1b --- /dev/null +++ b/addons/explosives/CfgEventHandlers.hpp @@ -0,0 +1,20 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_preInit.sqf) ); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_postInit.sqf) ); + }; +}; + +/* +TODO: Move the addEventHandlers out of PostInit into here or separate eventHandlers, + to enable them on all units, so unit switching works for explosives properly. +class Extended_Init_EventHandlers { + class CAManBase { + init = ""; + } +} +*/ diff --git a/addons/explosives/CfgModule.hpp b/addons/explosives/CfgModule.hpp new file mode 100644 index 0000000000..6dd23fea86 --- /dev/null +++ b/addons/explosives/CfgModule.hpp @@ -0,0 +1,44 @@ +class Module_F; +class ACE_ModuleExplosive: Module_F { + author = "ACE Team"; + category = "ACE"; + displayName = "Explosive System"; + function = QUOTE( FUNC(module) ); + scope = 2; + isGlobal = 1; + icon = "\ACE_Explosives\UI\IconExplosives_ca.paa"; + class Arguments { + class RequireSpecialist { + displayName = "Require specialists?"; + description = "Require explosive specialists to disable explosives? Default: No"; + typeName = "BOOL"; + class values { + class Yes { + name = "Yes"; + value = 1; + }; + class No { + default = 1; + name = "No"; + value = 0; + }; + }; + }; + class PunishNonSpecialists { + displayName = "Punish non-specialists?"; + description = "Increase the time it takes to complete actions for non-specialists? Default: Yes"; + typeName = "BOOL"; + class values { + class Yes { + default = 1; + name = "Yes"; + value = 1; + }; + class No { + name = "No"; + value = 0; + }; + }; + }; + }; +}; diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp new file mode 100644 index 0000000000..40863cf917 --- /dev/null +++ b/addons/explosives/CfgVehicles.hpp @@ -0,0 +1,248 @@ +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ +}; + +class CfgVehicles { + class Man; + + class CAManBase: Man { + class ACE_SelfActions { + class GVAR(Explosives) { + displayName = $STR_ACE_Explosives_Menu; + condition = QUOTE( !(_player getVariable [QGVAR(PlantingExplosive), false]) ); + statement = ""; + exceptions[] = {"ACE_Interaction_isNotSwimming"}; \ + showDisabled = 1; + priority = 4; + icon = "ACE_Explosives\UI\Explosives_Menu_ca.paa"; + subMenu[] = {"ACE_Explosives", 1}; + hotkey = "X"; + //Sub-menu items + class ACE_Detonate { + displayName = $STR_ACE_Explosives_Detonate; + condition = QUOTE( [_player] call FUNC(hasPlacedExplosives) AND ) and {count ([_player] call FUNC(getDetonators)) > 0} ); + statement = QUOTE( [_player] call FUNC(openTransmitterUI); ); + exceptions[] = {"ACE_Interaction_isNotSwimming"}; \ + showDisabled = 1; + icon = "ACE_Explosives\UI\Explosives_Menu_ca.paa"; + priority = 2; + hotkey = "T"; + }; + class ACE_Place { + displayName = $STR_ACE_Explosives_Place; + condition = QUOTE( (vehicle _player == _player) and {[_player] call FUNC(hasExplosives)} ); + statement = QUOTE( [_player] call FUNC(openPlaceUI); ); + exceptions[] = {"ACE_Interaction_isNotSwimming"}; \ + showDisabled = 1; + icon = "ACE_Explosives\UI\Place_Explosive_ca.paa"; + priority = 1; + hotkey = "P"; + }; + class ACE_Defuse { + displayName = $STR_ACE_Explosives_Defuse; + condition = QUOTE( [_player] call FUNC(canDefuse) ); + statement = QUOTE( [_player, EGVAR(Interaction, Target)] call FUNC(startDefuse); ); + exceptions[] = {"ACE_Interaction_isNotSwimming"}; \ + showDisabled = 0; + icon = "ACE_Explosives\UI\Defuse_ca.paa"; + priority = 0.8; + hotkey = "F"; + }; + }; + }; + }; + + class Items_base_F; + class ACE_Explosives_Place: Items_base_F { + author = "ACE"; + _generalMacro = "ACE_Explosives_Place"; + displayName = "Multi-meter"; + mapSize = 0.2; + icon = "iconObject_1x2"; + model = "\A3\Structures_F\Items\Tools\MultiMeter_F.p3d"; + scope = 2; + scopeCurator = 1; + vehicleClass = "Cargo"; + ACE_offset[] = {0,0,0}; + }; + + class ACE_Explosives_Place_DemoCharge:ACE_Explosives_Place { + displayName = "Demo Charge"; + model = "\A3\Weapons_F\explosives\c4_charge_small_d"; + }; + class ACE_Explosives_Place_APERSBoundingMine:ACE_Explosives_Place { + displayName = "APERS Bounding Mine"; + model = "\A3\Weapons_F\explosives\mine_AP_bouncing"; + }; + class ACE_Explosives_Place_APERSMine:ACE_Explosives_Place { + displayName = "APERS Mine"; + model = "\A3\Weapons_F\explosives\mine_ap"; + }; + class ACE_Explosives_Place_APERSTripwireMine:ACE_Explosives_Place { + displayName = "APERS Tripwire Mine"; + model = "\A3\Weapons_F\explosives\mine_AP_tripwire"; + ACE_offset[] = {1,0,0}; + }; + + class ACE_Explosives_Place_ATMine:ACE_Explosives_Place { + displayName = "AT Mine"; + model = "\A3\Weapons_f\Explosives\mine_at"; + }; + + class ACE_Explosives_Place_Claymore:ACE_Explosives_Place { + displayName = "Claymore"; + model = "\A3\Weapons_F\explosives\mine_AP_miniclaymore"; + }; + + class ACE_Explosives_Place_SatchelCharge:ACE_Explosives_Place { + displayName = "Satchel Charge"; + model = "\A3\Weapons_F\Explosives\satchel"; + }; + + class ACE_Explosives_Place_SLAM:ACE_Explosives_Place { + displayName = "SLAM"; + model = "\A3\Weapons_F\Explosives\mine_SLAM_directional"; + }; + + class NATO_Box_Base; + class EAST_Box_Base; + class IND_Box_Base; + class FIA_Box_Base_F; + class Box_NATO_Support_F; + + class Box_NATO_AmmoOrd_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_Clacker,12) + MACRO_ADDITEM(ACE_M26_Clacker,6) + MACRO_ADDITEM(ACE_DefusalKit,12) + }; + }; + + class Box_East_AmmoOrd_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_Clacker,12) + MACRO_ADDITEM(ACE_M26_Clacker,6) + MACRO_ADDITEM(ACE_DefusalKit,12) + }; + }; + + class Box_IND_AmmoOrd_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_Clacker,12) + MACRO_ADDITEM(ACE_M26_Clacker,6) + MACRO_ADDITEM(ACE_DefusalKit,12) + MACRO_ADDITEM(ACE_Deadmanswitch,2) + }; + }; + + class Box_FIA_Ammo_F: FIA_Box_Base_F { + class TransportItems { + MACRO_ADDITEM(ACE_Clacker,2) + MACRO_ADDITEM(ACE_M26_Clacker,2) + MACRO_ADDITEM(ACE_DefusalKit,2) + MACRO_ADDITEM(ACE_Deadmanswitch,1) + }; + }; + + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_Clacker,12) + MACRO_ADDITEM(ACE_M26_Clacker,6) + MACRO_ADDITEM(ACE_DefusalKit,12) + MACRO_ADDITEM(ACE_Deadmanswitch,6) + }; + }; + + class B_Kitbag_rgr; + class B_Kitbag_rgr_Exp: B_Kitbag_rgr { + class TransportItems { + class _xx_ToolKit { // xXToOlKiT420mLgXx + count = 0; + }; + }; + }; + class B_Carryall_ocamo; + class B_Carryall_ocamo_Exp: B_Carryall_ocamo { + class TransportItems { + class _xx_ToolKit { + count = 0; + }; + }; + }; + class B_Carryall_oucamo; + class B_Carryall_oucamo_Exp: B_Carryall_oucamo { + class TransportItems { + class _xx_ToolKit { + count = 0; + }; + }; + }; + class B_Carryall_oli; + class G_Carryall_Exp: B_Carryall_oli { + class TransportItems { + class _xx_ToolKit { + count = 0; + }; + }; + }; + class I_Carryall_oli_Exp: B_Carryall_oli { + class TransportItems { + class _xx_ToolKit { + count = 0; + }; + }; + }; + + #include "CfgModule.hpp" + + // Add ACE_Clacker and ACE_DefusalKit to every explosive unit. + #define MACRO_ADDMINEKIT \ + items[] = {"FirstAidKit", "ACE_Clacker", "ACE_DefusalKit"}; \ + respawnitems[] = {"FirstAidKit", "ACE_Clacker", "ACE_DefusalKit"}; + + class B_Soldier_base_F; class B_soldier_exp_F:B_Soldier_base_F {MACRO_ADDMINEKIT}; + class B_Soldier_03_f; class B_engineer_F:B_Soldier_03_f {MACRO_ADDMINEKIT}; + class B_Soldier_diver_base_F; class B_diver_exp_F:B_Soldier_diver_base_F {MACRO_ADDMINEKIT}; + class B_Soldier_recon_base; class B_recon_exp_F:B_Soldier_recon_base {MACRO_ADDMINEKIT}; + class B_CTRG_soldier_engineer_exp_F:B_Soldier_base_F {MACRO_ADDMINEKIT}; + class I_G_Soldier_base_F; class I_G_engineer_F:I_G_Soldier_base_F {MACRO_ADDMINEKIT}; + class I_G_Soldier_exp_F:I_G_Soldier_base_F {MACRO_ADDMINEKIT}; + class B_G_engineer_F:I_G_engineer_F {MACRO_ADDMINEKIT}; + class O_G_engineer_F:I_G_engineer_F {MACRO_ADDMINEKIT}; + class B_G_Soldier_exp_F:I_G_Soldier_exp_F {MACRO_ADDMINEKIT}; + class O_G_Soldier_exp_F:I_G_Soldier_exp_F {MACRO_ADDMINEKIT}; + class I_Soldier_02_F; class I_Soldier_exp_F:I_Soldier_02_F {MACRO_ADDMINEKIT}; + class I_Soldier_base_F; class I_engineer_F:I_Soldier_base_F {MACRO_ADDMINEKIT}; + class I_Soldier_diver_base_F; class I_diver_exp_F:I_Soldier_diver_base_F {MACRO_ADDMINEKIT}; + class O_Soldier_base_F; class O_soldier_exp_F:O_Soldier_base_F {MACRO_ADDMINEKIT}; + class O_engineer_F:O_Soldier_base_F {MACRO_ADDMINEKIT}; + class O_Soldier_diver_base_F; class O_diver_exp_F:O_Soldier_diver_base_F {MACRO_ADDMINEKIT}; + class O_Soldier_recon_base; class O_recon_exp_F:O_Soldier_recon_base {MACRO_ADDMINEKIT}; + class O_Soldier_Urban_base; class O_soldierU_exp_F:O_Soldier_Urban_base {MACRO_ADDMINEKIT}; + class O_engineer_U_F:O_Soldier_Urban_base {MACRO_ADDMINEKIT}; + class B_Protagonist_VR_F:B_Soldier_base_F {MACRO_ADDMINEKIT}; + class O_Protagonist_VR_F:O_Soldier_base_F {MACRO_ADDMINEKIT}; + class I_Protagonist_VR_F:I_Soldier_base_F {MACRO_ADDMINEKIT}; + class B_Soldier_F; class b_soldier_universal_f:B_Soldier_F {MACRO_ADDMINEKIT}; + class B_G_Soldier_F; class b_g_soldier_universal_f:B_G_Soldier_F {MACRO_ADDMINEKIT}; + class O_Soldier_F; class o_soldier_universal_f:O_Soldier_F {MACRO_ADDMINEKIT}; + class O_G_Soldier_F; class o_g_soldier_universal_f:O_G_Soldier_F {MACRO_ADDMINEKIT}; + class I_soldier_F; class i_soldier_universal_f:I_soldier_F {MACRO_ADDMINEKIT}; + class I_G_Soldier_F; class i_g_soldier_universal_f:I_G_Soldier_F {MACRO_ADDMINEKIT}; + + // Add ACE_Clacker to snipers and spotters for setting off Claymores + #define MACRO_ADDCLAYMOREKIT \ + items[] = {"FirstAidKit","ACE_Clacker"}; \ + respawnitems[] = {"FirstAidKit","ACE_Clacker"}; + + class B_Soldier_sniper_base_F; + class B_sniper_F: B_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; + class B_spotter_F: B_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; + class I_Soldier_sniper_base_F; + class I_Sniper_F: I_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; + class I_Spotter_F: I_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; + class O_Soldier_sniper_base_F; + class O_sniper_F: O_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; + class O_spotter_F: O_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; +}; diff --git a/addons/explosives/CfgWeapons.hpp b/addons/explosives/CfgWeapons.hpp new file mode 100644 index 0000000000..97332ed8f6 --- /dev/null +++ b/addons/explosives/CfgWeapons.hpp @@ -0,0 +1,55 @@ +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_f; + + class ACE_ExplosiveItem: InventoryItem_Base_f { + allowedSlots[] = {801,701,901}; + //type = 201; + }; + + class ACE_Clacker: ACE_ItemCore { + scope = 2; + displayName = $STR_ACE_Explosives_clacker_displayName; + descriptionShort = $STR_ACE_Explosives_clacker_description; + picture = "\ACE_Explosives\Data\UI\Clacker.paa"; + model = "\A3\weapons_F\ammo\mag_univ.p3d"; + ACE_Range = 250; + ACE_Detonator = 1; + + class ItemInfo: ACE_ExplosiveItem { + mass = 3; + uniformModel = "\A3\weapons_F\ammo\mag_univ.p3d"; + }; + }; + class ACE_M26_Clacker: ACE_Clacker { + displayName = $STR_ACE_Explosives_M26_displayName; + picture = "\ACE_Explosives\Data\UI\MK26_Transmitter_ca.paa"; + ACE_Range = 5000; + }; + class ACE_DefusalKit: ACE_ItemCore { + scope = 2; + displayName = $STR_ACE_Explosives_DefusalKit_displayName; + descriptionShort = $STR_ACE_Explosives_DefusalKit_description; + picture = "\ACE_Explosives\Data\UI\Pliers.paa"; + model = "\A3\Structures_F\Items\Tools\Pliers_F.p3d"; + + class ItemInfo: ACE_ExplosiveItem { + mass = 5; + uniformModel = "\A3\Structures_F\Items\Tools\Pliers_F.p3d"; + }; + }; + class ACE_DeadManSwitch: ACE_ItemCore { + scope = 2; + displayName = $STR_ACE_Explosives_DeadManSwitch_displayName; + descriptionShort = $STR_ACE_Explosives_DeadManSwitch_description; + picture = "\ACE_Explosives\Data\UI\DeadmanSwitch.paa"; + model = "\A3\weapons_F\ammo\mag_univ.p3d"; + ACE_Range = 100; + ACE_Detonator = 1; + + class ItemInfo: ACE_ExplosiveItem { + mass = 2; + uniformModel = "\A3\weapons_F\ammo\mag_univ.p3d"; + }; + }; +}; diff --git a/addons/explosives/CgMagazines.hpp b/addons/explosives/CgMagazines.hpp new file mode 100644 index 0000000000..7cc1c8a8bd --- /dev/null +++ b/addons/explosives/CgMagazines.hpp @@ -0,0 +1,98 @@ +class CfgMagazines { + class CA_Magazine; + class ATMine_Range_Mag:CA_Magazine{ + ACE_Placeable = 1; + useAction = 0; + ACE_SetupObject = "ACE_Explosives_Place_ATMine"; // CfgVehicle class for setup object. + ACE_DelayTime = 2.5; + class ACE_Triggers { + SupportedTriggers[] = {"PressurePlate"}; + class PressurePlate { + digDistance = 0.1; + }; + }; + }; + class APERSBoundingMine_Range_Mag:ATMine_Range_Mag{ + ACE_SetupObject = "ACE_Explosives_Place_APERSBoundingMine"; + class ACE_Triggers { + SupportedTriggers[] = {"PressurePlate"}; + class PressurePlate { + digDistance = 0.075; + }; + }; + }; + class APERSMine_Range_Mag:ATMine_Range_Mag{ + ACE_SetupObject = "ACE_Explosives_Place_APERSMine"; + class ACE_Triggers { + SupportedTriggers[] = {"PressurePlate"}; + class PressurePlate { + digDistance = 0.05; + }; + }; + }; + class APERSTripMine_Wire_Mag:ATMine_Range_Mag{ + ACE_SetupObject = "ACE_Explosives_Place_APERSTripwireMine"; + class ACE_Triggers { + SupportedTriggers[] = {"Tripwire"}; + class Tripwire; + }; + }; + + class ClaymoreDirectionalMine_Remote_Mag:CA_Magazine{ + ACE_Placeable = 1; + useAction = 0; + ACE_SetupObject = "ACE_Explosives_Place_Claymore"; + ACE_DelayTime = 1.5; + class ACE_Triggers { + SupportedTriggers[] = {"Command"}; + class Command { + FuseTime = 0.5; + }; + }; + }; + + class SatchelCharge_Remote_Mag:CA_Magazine{ + ACE_Placeable = 1; + useAction = 0; + ACE_SetupObject = "ACE_Explosives_Place_SatchelCharge"; + ACE_DelayTime = 1; + class ACE_Triggers { + SupportedTriggers[] = {"Timer","Command", "MK16_Transmitter", "DeadmanSwitch"}; + class Timer { + FuseTime = 0.5; + }; + class Command { + FuseTime = 0.5; + }; + class MK16_Transmitter:Command{}; + class DeadmanSwitch:Command{}; + }; + }; + class DemoCharge_Remote_Mag:SatchelCharge_Remote_Mag{ + ACE_SetupObject = "ACE_Explosives_Place_DemoCharge"; + model = "\A3\Weapons_F\explosives\c4_charge_small_d"; + }; + + class SLAMDirectionalMine_Wire_Mag: ATMine_Range_Mag{ + ACE_SetupObject = "ACE_Explosives_Place_SLAM"; + class ACE_Triggers { + SupportedTriggers[] = {"IRSensor","PressurePlate","Timer","Command"}; + class PressurePlate{ + displayName = $STR_ACE_Explosives_SLAME_Magnetic; + digDistance = 0; + ammo = "SLAMDirectionalMine_Magnetic_Ammo"; + pitch = 90; + }; + class IRSensor{ + displayName = $STR_ACE_Explosives_SLAME_IRSensor; + }; + class Timer { + ammo = "SLAMDirectionalMine_Timer_Ammo"; + }; + class Command { + ammo = "SLAMDirectionalMine_Command_Ammo"; + fuseTime = 0.5; + }; + }; + }; +}; diff --git a/TO_MERGE/agm/Explosives/Data/Audio/IED_Activated.wss b/addons/explosives/Data/Audio/IED_Activated.wss similarity index 100% rename from TO_MERGE/agm/Explosives/Data/Audio/IED_Activated.wss rename to addons/explosives/Data/Audio/IED_Activated.wss diff --git a/TO_MERGE/agm/Explosives/Data/UI/Clacker.paa b/addons/explosives/Data/UI/Clacker.paa similarity index 100% rename from TO_MERGE/agm/Explosives/Data/UI/Clacker.paa rename to addons/explosives/Data/UI/Clacker.paa diff --git a/TO_MERGE/agm/Explosives/Data/UI/DeadmanSwitch.paa b/addons/explosives/Data/UI/DeadmanSwitch.paa similarity index 100% rename from TO_MERGE/agm/Explosives/Data/UI/DeadmanSwitch.paa rename to addons/explosives/Data/UI/DeadmanSwitch.paa diff --git a/TO_MERGE/agm/Explosives/Data/UI/MK16_Reciever_ca.paa b/addons/explosives/Data/UI/MK16_Reciever_ca.paa similarity index 100% rename from TO_MERGE/agm/Explosives/Data/UI/MK16_Reciever_ca.paa rename to addons/explosives/Data/UI/MK16_Reciever_ca.paa diff --git a/TO_MERGE/agm/Explosives/Data/UI/MK26_Transmitter_ca.paa b/addons/explosives/Data/UI/MK26_Transmitter_ca.paa similarity index 100% rename from TO_MERGE/agm/Explosives/Data/UI/MK26_Transmitter_ca.paa rename to addons/explosives/Data/UI/MK26_Transmitter_ca.paa diff --git a/TO_MERGE/agm/Explosives/Data/UI/pliers.paa b/addons/explosives/Data/UI/Pliers.paa similarity index 100% rename from TO_MERGE/agm/Explosives/Data/UI/pliers.paa rename to addons/explosives/Data/UI/Pliers.paa diff --git a/TO_MERGE/agm/Explosives/Data/UI/Pressure_plate.paa b/addons/explosives/Data/UI/PressurePlate.paa similarity index 100% rename from TO_MERGE/agm/Explosives/Data/UI/Pressure_plate.paa rename to addons/explosives/Data/UI/PressurePlate.paa diff --git a/TO_MERGE/agm/Explosives/Data/UI/timer.paa b/addons/explosives/Data/UI/Timer.paa similarity index 100% rename from TO_MERGE/agm/Explosives/Data/UI/timer.paa rename to addons/explosives/Data/UI/Timer.paa diff --git a/TO_MERGE/agm/Explosives/Data/UI/Tripwire.paa b/addons/explosives/Data/UI/Tripwire.paa similarity index 100% rename from TO_MERGE/agm/Explosives/Data/UI/Tripwire.paa rename to addons/explosives/Data/UI/Tripwire.paa diff --git a/addons/explosives/ExplosivesUI.hpp b/addons/explosives/ExplosivesUI.hpp new file mode 100644 index 0000000000..c6c76e573c --- /dev/null +++ b/addons/explosives/ExplosivesUI.hpp @@ -0,0 +1,74 @@ +#define GUI_GRID_X (0) +#define GUI_GRID_Y (0) +#define GUI_GRID_W (0.025) +#define GUI_GRID_H (0.04) + +#define ST_CENTER 0x02 + +class RscText; +class RscButton; + +#define X_OFFSET 0.25 + +class RscXSliderH; +class IGUIBack; + +class Rsc_ACE_Timer_Slider:RscXSliderH{ + x = 0.4; + y = 0.2; + w = 0.3; + h = "1*((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + colorBackground[] = {0,0,0,0.5}; +}; + +class RscACE_SelectTimeUI +{ + idd = 8854; + movingEnable = 0; + class controls { + class back:IGUIBack { + x = X_OFFSET; + y = 0; + w = 0.5; + h = 0.2; + colorBackground[] = {0, 0, 0, 0.5}; + }; + class header: RscText{ + idc = 8870; + x = X_OFFSET + 0.005; + y = 0.005; + w = 0.49; + h = 0.05; + style = ST_CENTER; + text = ""; + }; + class slider: Rsc_ACE_Timer_Slider { + idc = 8845; + x = X_OFFSET + 0.005; + y = 0.06; + w = 0.49; + h = 0.025; + onSliderPosChanged = "private ['_mins', '_secs'];_mins = floor((_this select 1)/60);_secs=floor((_this select 1) - (_mins*60));ctrlSetText [8870, format[localize 'STR_ACE_Explosives_TimerMenu',_mins, _secs]];"; + }; + class cancelBtn: RscButton { + idc = 8855; + x = X_OFFSET + 0.005; + w = 0.15; + h = 0.1; + y = 0.09; + style = ST_CENTER; + text = $STR_ACE_Explosives_Cancel; + action = "closeDialog 0;"; + }; + class approveBtn: RscButton { + idc = 8860; + x = X_OFFSET + 0.345; + y = 0.09; + h = 0.1; + w = 0.15; + style = ST_CENTER; + text = $STR_ACE_Explosives_SetTime; + action = "closeDialog 0;"; + }; + }; +}; diff --git a/TO_MERGE/agm/Explosives/UI/defuse_ca.paa b/addons/explosives/UI/Defuse_ca.paa similarity index 100% rename from TO_MERGE/agm/Explosives/UI/defuse_ca.paa rename to addons/explosives/UI/Defuse_ca.paa diff --git a/TO_MERGE/agm/Explosives/UI/Icon_Explosive_ca.paa b/addons/explosives/UI/Explosives_Menu_ca.paa similarity index 100% rename from TO_MERGE/agm/Explosives/UI/Icon_Explosive_ca.paa rename to addons/explosives/UI/Explosives_Menu_ca.paa diff --git a/TO_MERGE/agm/Explosives/UI/IconExplosives_ca.paa b/addons/explosives/UI/IconExplosives_ca.paa similarity index 100% rename from TO_MERGE/agm/Explosives/UI/IconExplosives_ca.paa rename to addons/explosives/UI/IconExplosives_ca.paa diff --git a/TO_MERGE/agm/Explosives/UI/Place_Explosive_ca.paa b/addons/explosives/UI/Place_Explosive_ca.paa similarity index 100% rename from TO_MERGE/agm/Explosives/UI/Place_Explosive_ca.paa rename to addons/explosives/UI/Place_Explosive_ca.paa diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf new file mode 100644 index 0000000000..adc6c1108e --- /dev/null +++ b/addons/explosives/XEH_postInit.sqf @@ -0,0 +1,69 @@ +/* + Name: XEH_postInit.sqf + + Author(s): + Garth de Wet (LH) + + Description: + Initialises explosive behaviour. + + Parameters: + None + + Returns: + None + + Example: + None +*/ +#include "script_component.hpp" +if !(hasInterface) exitWith {}; +GVAR(PlacedCount) = 0; +GVAR(Setup) = objNull; +GVAR(pfeh_running) = false; + +[{(_this select 0) call FUNC(handleScrollWheel);}] call FUNC(Core,addScrollWheelEventHandler); +player addEventHandler ["Killed", { + private "_deadman"; + call FUNC(place_Cancel); + _deadman = [(_this select 0), "DeadManSwitch"] call FUNC(getPlacedExplosives); + { + [(_this select 0), -1, _x, true] call FUNC(detonateExplosive); + } count _deadman; +}]; +player addEventHandler ["Take", { + private ["_item", "_getter", "_giver", "_config"]; + _item = _this select 2; + _getter = _this select 0; + _giver = _this select 1; + + _config = ConfigFile >> "CfgWeapons" >> _item; + if (isClass _config && {getNumber(_config >> "AGM_Detonator") == 1}) then { + private ["_clackerItems"]; + _clackerItems = _giver getVariable [QGVAR(Clackers), []]; + _getter SetVariable [QGVAR(Clackers), (_getter getVariable [QGVAR(Clackers), []]) + _clackerItems, true]; + + _detonators = [_giver] call FUNC(getDetonators); + if (count _detonators == 0) then { + _giver setVariable [QGVAR(Clackers), nil, true]; + }; + }; +}]; +player addEventHandler ["Put", { + private ["_item", "_getter", "_giver", "_config"]; + _item = _this select 2; + _getter = _this select 1; + _giver = _this select 0; + + _config = ConfigFile >> "CfgWeapons" >> _item; + if (isClass _config && {getNumber(_config >> "AGM_Detonator") == 1}) then { + private ["_clackerItems"]; + _clackerItems = _giver getVariable [QGVAR(Clackers), []]; + _getter SetVariable [QGVAR(Clackers), (_getter getVariable [QGVAR(Clackers), []]) + _clackerItems, true]; + + _detonators = [_giver] call FUNC(getDetonators); + if (count _detonators == 0) then { + _giver setVariable [QGVAR(Clackers), nil, true]; + }; + }; +}]; diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf new file mode 100644 index 0000000000..df24682b1d --- /dev/null +++ b/addons/explosives/XEH_preInit.sqf @@ -0,0 +1,50 @@ +/* +Name: XEH_preInit.sqf + +Author(s): +Garth de Wet (LH) + +Description: +Prepares the functions + +Parameters: +None + +Returns: +None + +Example: +None +*/ +#include "script_component.hpp" + +PREP(addClacker); +PREP(canDefuse); +PREP(defuseExplosive); +PREP(detonateExplosive); + +PREP(handleScrollWheel); + +PREP(hasExplosives); +PREP(hasPlacedExplosives); + +PREP(getDetonators); +PREP(getPlacedExplosives); + +PREP(openDetonateUI); +PREP(openPlaceUI); +PREP(openTransmitterUI); +PREP(openTimerSetUI); +PREP(openTriggerSelectionUI); + +PREP(place_Approve); +PREP(place_Cancel); + +PREP(placeExplosive); + +PREP(selectTrigger); +PREP(setupExplosive); +PREP(setPosition); +PREP(startDefuse); +PREP(startTimer); +PREP(triggerType); diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp new file mode 100644 index 0000000000..2c93bcc6c4 --- /dev/null +++ b/addons/explosives/config.cpp @@ -0,0 +1,47 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch"}; + requiredVersion = 0.60; + requiredAddons[] = {ace_core, ace_interaction}; + version = "0.95"; + versionStr = "0.95"; + versionAr[] = {0,95,0}; + author[] = {"Garth 'L-H' de Wet"}; + authorUrl = "http://garth.snakebiteink.co.za/"; + }; +}; + +#include "CfgEventHandlers.hpp" + +#include "CfgAmmo.hpp" +#include "CfgMagazines.hpp" +#include "CfgWeapons.hpp" +#include "CfgVehicles.hpp" + +#include "ExplosivesUI.hpp" + +class CfgActions { + class None; + class Deactivate:None { + show = 0; + }; + class DeactivateMine:None { + show = 0; + }; +}; + +class CfgMineTriggers { + class RangeTrigger; + class MagneticTrigger: RangeTrigger { + mineMagnetic = 1; + mineTriggerRange = 1; + }; +}; + +class ACE_Parameters_Boolean { + GVAR(RequireSpecialist) = 0; + GVAR(PunishNonSpecialists) = 1; +}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_AddClacker.sqf b/addons/explosives/functions/fnc_addClacker.sqf similarity index 57% rename from TO_MERGE/agm/Explosives/functions/fn_AddClacker.sqf rename to addons/explosives/functions/fnc_addClacker.sqf index 5d203ef4a9..c1f7b51c46 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_AddClacker.sqf +++ b/addons/explosives/functions/fnc_addClacker.sqf @@ -1,24 +1,25 @@ /* - Name: AGM_Explosives_fnc_AddClacker - + Name: ACE_Explosives_fnc_addClacker + Author(s): Garth de Wet (LH) - + Description: - Adds an explosive as a clacker item to the passed unit if the unit has a AGM_Clacker item. - + Adds an explosive as a clacker item to the passed unit if the unit has a ACE_Clacker item. + Parameters: 0: OBJECT - unit 1: OBJECT - Explosive 2: STRING - Magazine 3: ARRAY - Extra vars - + Returns: Nothing - + Example: - [_unit, _explosive, "SatchelCharge_Remote_Mag", [ConfigFile >> "CfgAGM_Triggers" >> "Command"]] call AGM_Explosives_fnc_AddClacker; + [_unit, _explosive, "SatchelCharge_Remote_Mag", [ConfigFile >> "CfgACE_Triggers" >> "Command"]] call ACE_Explosives_fnc_AddClacker; */ +#include "script_component.hpp" private ["_unit", "_explosive", "_clacker", "_config", "_magazineClass", "_requiredItems", "_hasRequired"]; _unit = _this select 0; _explosive = _this select 1; @@ -28,7 +29,7 @@ _config = (_this select 3) select (count (_this select 3) - 1); _requiredItems = getArray(_config >> "requires"); _hasRequired = true; -_detonators = [AGM_player] call AGM_Explosives_fnc_getDetonators; +_detonators = [_unit] call FUNC(getDetonators); { if !(_x in _detonators) exitWith{ _hasRequired = false; @@ -36,10 +37,11 @@ _detonators = [AGM_player] call AGM_Explosives_fnc_getDetonators; } count _requiredItems; if !(_hasRequired) exitWith {}; -_config = ConfigFile >> "CfgMagazines" >> _magazineClass >> "AGM_Triggers" >> configName _config; +_config = ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> configName _config; -_clacker = _unit getVariable ["AGM_Clacker", []]; -AGM_Explosives_PlacedCount = AGM_Explosives_PlacedCount + 1; -_clacker pushBack [_explosive, getNumber(_config >> "FuseTime"), format [localize "STR_AGM_Explosives_DetonateCode", AGM_Explosives_PlacedCount], _magazineClass, configName ((_this select 3) select (count (_this select 3) - 1))]; -_unit setVariable ["AGM_Clacker", _clacker, true]; -_unit sideChat format [localize "STR_AGM_Explosives_DetonateCode", AGM_Explosives_PlacedCount]; \ No newline at end of file +_clacker = _unit getVariable [QGVAR(Clackers), []]; +GVAR(PlacedCount) = GVAR(PlacedCount) + 1; +_clacker pushBack [_explosive, getNumber(_config >> "FuseTime"), format [localize "STR_ACE_Explosives_DetonateCode", + GVAR(PlacedCount)], _magazineClass, configName ((_this select 3) select (count (_this select 3) - 1))]; +_unit setVariable [QGVAR(Clackers), _clacker, true]; +_unit sideChat format [localize "STR_ACE_Explosives_DetonateCode", GVAR(PlacedCount)]; diff --git a/TO_MERGE/agm/Explosives/functions/fn_CanDefuse.sqf b/addons/explosives/functions/fnc_canDefuse.sqf similarity index 58% rename from TO_MERGE/agm/Explosives/functions/fn_CanDefuse.sqf rename to addons/explosives/functions/fnc_canDefuse.sqf index d7c423e734..5d8830571b 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_CanDefuse.sqf +++ b/addons/explosives/functions/fnc_canDefuse.sqf @@ -1,26 +1,27 @@ /* - Name: AGM_Explosives_fnc_CanDefuse - + Name: ACE_Explosives_fnc_canDefuse + Author: Garth de Wet (LH) - + Description: Checks if a unit can defuse an explosive - - Parameters: + + Parameters: 0: OBJECT - unit - + Returns: Nothing - + Example: - [player] call AGM_Explosives_fnc_CanDefuse; + [player] call ACE_Explosives_fnc_CanDefuse; */ +#include "script_component.hpp" private "_unit"; _unit = _this select 0; -if (vehicle _unit != _unit || {!("AGM_DefusalKit" in (items _unit))}) exitWith {false}; -_isSpecialist = ([_unit] call AGM_Core_fnc_isEOD); +if (vehicle _unit != _unit || {!("ACE_DefusalKit" in (items _unit))}) exitWith {false}; +_isSpecialist = [_unit] call EFUNC(Core,isEOD); -if (AGM_Explosives_RequireSpecialist && {!_isSpecialist}) exitWith {false}; +if (GVAR(RequireSpecialist) && {!_isSpecialist}) exitWith {false}; _timeBombCore = nearestObject [_unit, "TimeBombCore"]; _mineBase = nearestObject [_unit, "MineBase"]; @@ -30,10 +31,10 @@ _distBase = _unit distance _mineBase; _distance = 10; if (_distCore < _distBase) then { _distance = _distCore; - AGM_Interaction_Target = _timeBombCore; + EGVAR(Interaction,Target) = _timeBombCore; }else{ _distance = _distBase; - AGM_Interaction_Target = _mineBase; + EGVAR(Interaction,Target) = _mineBase; }; if (isNil "_distance") exitWith {false}; _distance < 4 diff --git a/TO_MERGE/agm/Explosives/functions/fn_defuseExplosive.sqf b/addons/explosives/functions/fnc_defuseExplosive.sqf similarity index 57% rename from TO_MERGE/agm/Explosives/functions/fn_defuseExplosive.sqf rename to addons/explosives/functions/fnc_defuseExplosive.sqf index d291b6535f..243e6b44e0 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_defuseExplosive.sqf +++ b/addons/explosives/functions/fnc_defuseExplosive.sqf @@ -1,27 +1,28 @@ /* - Name: AGM_Explosives_fnc_DefuseExplosive - + Name: ACE_Explosives_fnc_defuseExplosive + Author: Garth de Wet (LH) - + Description: Defuses an Explosive - - Parameters: + + Parameters: 0: OBJECT - unit 1: OBJECT - Explosive - + Returns: Nothing - + Example: - [player, AGM_Interaction_Target] call AGM_Explosives_fnc_DefuseExplosive; + [player, ACE_Interaction_Target] call ACE_Explosives_fnc_defuseExplosive; */ +#include "script_component.hpp" private ["_unit", "_explosive"]; _unit = _this select 0; _explosive = _this select 1; -if (getNumber (ConfigFile >> "CfgAmmo" >> typeof _explosive >> "AGM_explodeOnDefuse") == 1) exitWith { - [_unit, -1, [_explosive, 1], true] call AGM_Explosives_fnc_DetonateExplosive; +if (getNumber (ConfigFile >> "CfgAmmo" >> typeof _explosive >> "ACE_explodeOnDefuse") == 1) exitWith { + [_unit, -1, [_explosive, 1], true] call FUNC(detonateExplosive); }; _unit action ["Deactivate", _unit, _explosive]; diff --git a/TO_MERGE/agm/Explosives/functions/fn_DetonateExplosive.sqf b/addons/explosives/functions/fnc_detonateExplosive.sqf similarity index 63% rename from TO_MERGE/agm/Explosives/functions/fn_DetonateExplosive.sqf rename to addons/explosives/functions/fnc_detonateExplosive.sqf index 9832af6856..9443be6bc1 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_DetonateExplosive.sqf +++ b/addons/explosives/functions/fnc_detonateExplosive.sqf @@ -1,50 +1,40 @@ /* - Name: AGM_Explosives_fnc_DetonateExplosive - + Name: ACE_Explosives_fnc_detonateExplosive + Author(s): Garth de Wet (LH) - + Description: Detonates a remote Explosive. - + Parameters: 0: OBJECT - Unit detonating explosive 1: NUMBER - Max range (-1 to ignore) 2: ARRAY - Explosive 0: OBJECT - Explosive 1: NUMBER - Fuse Time - 3: BOOLEAN - Ignore Jammer - + Returns: Nothing - + Example: // Clacker - [player, 100, [Explosive, 1], false] call AGM_Explosives_fnc_DetonateExplosive; + [player, 100, [Explosive, 1]] call ACE_Explosives_fnc_detonateExplosive; */ -private ["_item","_result", "_ignoreRange", "_ignoreJammer", "_unit", "_range"]; +#include "script_component.hpp" +private ["_item","_result", "_ignoreRange", "_unit", "_range"]; _unit = _this select 0; _range = _this select 1; _item = _this select 2; _ignoreRange = (_range == -1); -_ignoreJammer = true;//(_this select 4); // disabled while jammers aren't in place. _result = true; if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {false}; -if (!_ignoreJammer) then { - { - if (((_x select 2) getVariable ["AGM_JammerEnabled",false]) and {(_x select 0) distance (_item select 0) <= (_x select 1)}) exitWith { - _result = false; - }; - } count AGM_Explosives_Jammers; -}; -if (!_result) exitWith{}; - if (getNumber (ConfigFile >> "CfgAmmo" >> typeof (_item select 0) >> "TriggerWhenDestroyed") == 0) then { private ["_exp", "_previousExp"]; _previousExp = _item select 0; - _exp = getText (ConfigFile >> "CfgAmmo" >> typeof (_previousExp) >> "AGM_Explosive"); + _exp = getText (ConfigFile >> "CfgAmmo" >> typeof (_previousExp) >> "ACE_Explosive"); if (_exp != "") then { _exp = createVehicle [_exp, [0,0,15001], [], 0, "NONE"]; _exp setDir (getDir _previousExp); diff --git a/TO_MERGE/agm/Explosives/functions/fn_getDetonators.sqf b/addons/explosives/functions/fnc_getDetonators.sqf similarity index 68% rename from TO_MERGE/agm/Explosives/functions/fn_getDetonators.sqf rename to addons/explosives/functions/fnc_getDetonators.sqf index b770a9938e..77549c0e3b 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_getDetonators.sqf +++ b/addons/explosives/functions/fnc_getDetonators.sqf @@ -1,21 +1,22 @@ /* - Name: AGM_Explosives_fnc_getDetonators - + Name: ACE_Explosives_fnc_getDetonators + Author(s): Garth de Wet (LH) - + Description: Gets all the detonators of a specific unit - + Parameters: 0: OBJECT - Unit to get detonators of - + Returns: ARRAY - Configs of all detonators. - + Example: - _detonators = [player] call AGM_Explosives_fnc_getDetonators; + _detonators = [player] call ACE_Explosives_fnc_getDetonators; */ +#include "script_component.hpp" private ["_unit", "_items", "_result", "_config"]; _unit = _this select 0; _items = (items _unit); @@ -23,7 +24,7 @@ _result = []; { _config = ConfigFile >> "CfgWeapons" >> _x; - if (getNumber (_config >> "AGM_Detonator") == 1) then { + if (getNumber (_config >> "ACE_Detonator") == 1) then { _result pushBack _x; }; } forEach _items; diff --git a/TO_MERGE/agm/Explosives/functions/fn_getPlacedExplosives.sqf b/addons/explosives/functions/fnc_getPlacedExplosives.sqf similarity index 59% rename from TO_MERGE/agm/Explosives/functions/fn_getPlacedExplosives.sqf rename to addons/explosives/functions/fnc_getPlacedExplosives.sqf index 0747693dd1..0343b76521 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_getPlacedExplosives.sqf +++ b/addons/explosives/functions/fnc_getPlacedExplosives.sqf @@ -1,38 +1,39 @@ /* - Name: AGM_Explosives_fnc_getPlacedExplosives - + Name: ACE_Explosives_fnc_getPlacedExplosives + Author: Garth de Wet (LH) - + Description: Gets all placed explosives, whether Clacker based or not. - - Parameters: + + Parameters: 0: OBJECT - unit 1: STRING - (OPTIONAL) Trigger classname for filter. - + Returns: Array: Explosives. - + Example: - _allExplosives = [player] call AGM_Explosives_fnc_getPlacedExplosives; - _deadmanExplosives = [player, "DeadManSwitch"] call AGM_Explosives_fnc_getPlacedExplosives; + _allExplosives = [player] call ACE_Explosives_fnc_getPlacedExplosives; + _deadmanExplosives = [player, "DeadManSwitch"] call ACE_Explosives_fnc_getPlacedExplosives; */ +#include "script_component.hpp" private ["_unit", "_clackerList", "_adjustedList", "_list", "_filter"]; _unit = _this select 0; _filter = nil; if (count _this > 1) then { - _filter = ConfigFile >> "CfgAGM_Triggers" >> (_this select 1); + _filter = ConfigFile >> "CfgACE_Triggers" >> (_this select 1); }; _clackerList = []; _adjustedList = false; -_clackerList = _unit getVariable ["AGM_Clacker", []]; +_clackerList = _unit getVariable [QGVAR(Clackers), []]; _list = []; { if isNull (_x select 0) then { _clackerList set [_foreachIndex, "X"]; _adjustedList = true; } else { - if (isNil "_filter" || {(ConfigFile >> "CfgAGM_Triggers" >> (_x select 4)) == _filter}) then { + if (isNil "_filter" || {(ConfigFile >> "CfgACE_Triggers" >> (_x select 4)) == _filter}) then { _list pushBack _x; }; }; @@ -40,10 +41,10 @@ _list = []; if (_adjustedList) then { _clackerList = _clackerList - ["X"]; if (count _clackerList == 0) then { - _unit SetVariable ["AGM_Clacker", nil, true]; + _unit SetVariable [QGVAR(Clackers), nil, true]; } else { - _unit SetVariable ["AGM_Clacker", _clackerList, true]; + _unit SetVariable [QGVAR(Clackers), _clackerList, true]; }; }; -_list \ No newline at end of file +_list diff --git a/addons/explosives/functions/fnc_handleScrollWheel.sqf b/addons/explosives/functions/fnc_handleScrollWheel.sqf new file mode 100644 index 0000000000..12c31911e6 --- /dev/null +++ b/addons/explosives/functions/fnc_handleScrollWheel.sqf @@ -0,0 +1,26 @@ +/* + Name: ACE_Explosives_fnc_HandleScrollWheel + + Author(s): + L-H + + Description: + Handles rotating of Explosives + + Parameters: + Number: Scroll amount + + Returns: + Boolean: Handled or not. + + Example: + 1.2 call ACE_Explosives_fnc_HandleScrollWheel; +*/ +#include "script_component.hpp" +private ["_obj"]; +if (isNull(GVAR(Setup)) || {ACE_Modifier == 0} || !GVAR(pfeh_running)) exitWith {false}; +_this = _this * 5; +GVAR(Setup) setDir ((getDir GVAR(Setup) + _this); +GVAR(TweakedAngle) = GVAR(TweakedAngle) + _this; + +true diff --git a/TO_MERGE/agm/Explosives/functions/fn_hasExplosives.sqf b/addons/explosives/functions/fnc_hasExplosives.sqf similarity index 63% rename from TO_MERGE/agm/Explosives/functions/fn_hasExplosives.sqf rename to addons/explosives/functions/fnc_hasExplosives.sqf index 491bb8927d..79596b1b1e 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_hasExplosives.sqf +++ b/addons/explosives/functions/fnc_hasExplosives.sqf @@ -1,26 +1,27 @@ /* - Name: AGM_Explosives_fnc_hasExplosives - + Name: ACE_Explosives_fnc_hasExplosives + Author: Garth de Wet (LH) - + Description: Whether the passed unit has any explosives on them. - - Parameters: + + Parameters: 0: OBJECT - unit - + Returns: BOOLEAN - True if the unit has explosives. - + Example: - _hasExplosives = [player] call AGM_Explosives_fnc_hasExplosives; + _hasExplosives = [player] call ACE_Explosives_fnc_hasExplosives; */ +#include "script_component.hpp" private ["_unit", "_result", "_magazines"]; _result = false; _unit = _this select 0; _magazines = magazines _unit; { - if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> "AGM_Placeable") == 1) exitWith { + if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> "ACE_Placeable") == 1) exitWith { _result = true; }; } count _magazines; diff --git a/TO_MERGE/agm/Explosives/functions/fn_hasPlacedExplosives.sqf b/addons/explosives/functions/fnc_hasPlacedExplosives.sqf similarity index 55% rename from TO_MERGE/agm/Explosives/functions/fn_hasPlacedExplosives.sqf rename to addons/explosives/functions/fnc_hasPlacedExplosives.sqf index 5932ee20ad..ad6f29a02e 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_hasPlacedExplosives.sqf +++ b/addons/explosives/functions/fnc_hasPlacedExplosives.sqf @@ -1,18 +1,19 @@ /* - Name: AGM_Explosives_fnc_hasPlacedExplosives - + Name: ACE_Explosives_fnc_hasPlacedExplosives + Author: Garth de Wet (LH) - + Description: Whether the passed unit has placed any explosives or has a clacker that was used when explosives were placed. - - Parameters: + + Parameters: 0: OBJECT - unit - + Returns: BOOLEAN - True if the unit has explosives. - + Example: - _hasPLacedExplosives = [player] call AGM_Explosives_fnc_hasPlacedExplosives; + _hasPLacedExplosives = [player] call ACE_Explosives_fnc_hasPlacedExplosives; */ -(count (_this call AGM_Explosives_fnc_getPlacedExplosives) > 0) \ No newline at end of file +#include "script_component.hpp" +(count (_this call FUNC(getPlacedExplosives)) > 0) diff --git a/addons/explosives/functions/fnc_module.sqf b/addons/explosives/functions/fnc_module.sqf new file mode 100644 index 0000000000..e4186edf4e --- /dev/null +++ b/addons/explosives/functions/fnc_module.sqf @@ -0,0 +1,28 @@ +/* + Name: ACE_Explosives_fnc_module + + Author: Garth de Wet (LH) + + Description: + Initialises the explosives module + + Parameters: + Things + + Returns: + Nothing + + Example: + +*/ +#include "script_component.hpp" +if !(isServer) exitWith {}; +_logic = _this select 0; +_activated = _this select 2; + +if !(_activated) exitWith {}; + +[_logic, QGVAR(RequireSpecialist), "RequireSpecialist" ] call EFUNC(Core,readBooleanParameterFromModule); +[_logic, QGVAR(PunishNonSpecialists), "PunishNonSpecialists" ] call EFUNC(Core,readBooleanParameterFromModule); + +diag_log text "[ACE]: Explosive Module Initialized."; diff --git a/addons/explosives/functions/fnc_openDetonateUI.sqf b/addons/explosives/functions/fnc_openDetonateUI.sqf new file mode 100644 index 0000000000..1073bcb5fa --- /dev/null +++ b/addons/explosives/functions/fnc_openDetonateUI.sqf @@ -0,0 +1,63 @@ +/* + Name: ACE_Explosives_fnc_openDetonateUI + + Author: Garth de Wet (LH) + + Description: + Opens the UI for explosive detonation selection + + Parameters: + 0: OBJECT - unit + 0: STRING - Classname of detonator + + Returns: + Nothing + + Example: + [player, "ACE_M26_Clacker"] call ACE_Explosives_fnc_openDetonateUI; +*/ +#include "script_component.hpp" +private ["_unit","_result", "_item"]; +call EFUNC(Interaction,hideMenu); +_unit = _this select 0; +_detonator = _this select 1; +_range = GetNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range"); + +_result = [_unit] call FUNC(getPlacedExplosives); +_actions = [localize "STR_ACE_Explosives_DetonateMenu", localize "STR_ACE_Explosives_Detonate"] + call EFUNC(Interaction,prepareSelectMenu); +_count = 0; +{ + if (!isNull(_x select 0)) then { + _required = getArray (ConfigFile >> "CfgACE_Triggers" >> (_x select 4) >> "requires"); + if (_detonator in _required) then { + _item = ConfigFile >> "CfgMagazines" >> (_x select 3); + _actions = [ + _actions, + _x select 2, + getText(_item >> "picture"), + [_foreachIndex, _range] + ] call EFUNC(Interaction,AddSelectableItem); + _count = _count + 1; + }; + }; +} foreach _result; +if (_count > 0) then { + [ + _actions, + { + [ + ACE_player, + [_this select 1] call EFUNC(Core,toNumber), + (ACE_player getVariable [QGVAR(Clackers), []]) select ([_this select 0] call EFUNC(Core,toNumber)), + false + ] call FUNC(detonateExplosive); + call EFUNC(Interaction,hideMenu); + }, + {[ACE_player] call FUNC(openTransmitterUI);} + ] call EFUNC(Interaction,openSelectMenu); +}else{ + call EFUNC(Interaction,hideMenu); + [ACE_player] call FUNC(openTransmitterUI); + [localize "STR_ACE_Explosives_NoExplosivesAvailable"] call EFUNC(Core,displayTextStructured); +}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_openPlaceUI.sqf b/addons/explosives/functions/fnc_openPlaceUI.sqf similarity index 54% rename from TO_MERGE/agm/Explosives/functions/fn_openPlaceUI.sqf rename to addons/explosives/functions/fnc_openPlaceUI.sqf index 0f33dc6b20..fa14a108fc 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_openPlaceUI.sqf +++ b/addons/explosives/functions/fnc_openPlaceUI.sqf @@ -1,30 +1,31 @@ /* - Name: AGM_Explosives_fnc_openPlaceUI - + Name: ACE_Explosives_fnc_openPlaceUI + Author: Garth de Wet (LH) - + Description: Opens the UI for explosive placement selection - - Parameters: + + Parameters: 0: OBJECT - unit - + Returns: Nothing - + Example: - [player] call AGM_Explosives_fnc_openPlaceUI; + [player] call ACE_Explosives_fnc_openPlaceUI; */ +#include "script_component.hpp" private ["_unit","_mags", "_item", "_index", "_actions"]; _unit = _this select 0; -call AGM_Explosives_fnc_Place_Cancel; +call FUNC(place_Cancel); _mags = magazines _unit; _list = []; _itemCount = []; { _item = ConfigFile >> "CfgMagazines" >> _x; - if (getNumber(_item >> "AGM_Placeable") == 1) then { + if (getNumber(_item >> "ACE_Placeable") == 1) then { _index = _list find _item; if (_index != -1) then { _itemCount set [_index, (_itemCount select _index) + 1]; @@ -34,25 +35,26 @@ _itemCount = []; }; }; } forEach _mags; -_actions = [localize "STR_AGM_Explosives_PlaceMenu", localize "STR_AGM_Explosives_Place"] call AGM_Interaction_fnc_prepareSelectMenu; +_actions = [localize "STR_ACE_Explosives_PlaceMenu", localize "STR_ACE_Explosives_Place"] + call EFUNC(Interaction,prepareSelectMenu); { _actions = [ _actions, format [getText(_x >> "displayName") + " (%1)", _itemCount select _foreachIndex], getText(_x >> "picture"), configName _x - ] call AGM_Interaction_fnc_AddSelectableItem; + ] call EFUNC(Interaction,AddSelectableItem); } foreach _list; [ _actions, { - [_this] call AGM_Explosives_fnc_openTriggerSelectionUI; + [_this] call FUNC(openTriggerSelectionUI); }, { - call AGM_Interaction_fnc_hideMenu; - if !(profileNamespace getVariable ["AGM_Interaction_AutoCloseMenu", false]) then { - "AGM_Explosives" call AGM_Interaction_fnc_openMenuSelf; + call EFUNC(Interaction,hideMenu); + if !(profileNamespace getVariable ["ACE_Interaction_AutoCloseMenu", false]) then { + "ACE_Explosives" call EFUNC(Interaction,openMenuSelf); }; } -] call AGM_Interaction_fnc_openSelectMenu; +] call EFUNC(Interaction,openSelectMenu); diff --git a/addons/explosives/functions/fnc_openTimerSetUI.sqf b/addons/explosives/functions/fnc_openTimerSetUI.sqf new file mode 100644 index 0000000000..dda771f98d --- /dev/null +++ b/addons/explosives/functions/fnc_openTimerSetUI.sqf @@ -0,0 +1,28 @@ +/* + Name: ACE_Explosives_fnc_openTimerSetUI + + Author: Garth de Wet (LH) + + Description: + Opens the UI for timer setting of an explosive + + Parameters: + 0: String - Magazine + + Returns: + Nothing + + Example: + [player] call ACE_Explosives_fnc_openTimerSetUI; +*/ +#include "script_component.hpp" +private ["_mag"]; +_mag = _this select 0; +createDialog "RscACE_SelectTimeUI"; +sliderSetRange [8845, 5, 900]; // 5seconds - 15minutes +sliderSetPosition [8845, 30]; + +buttonSetAction [8860, format[QUOTE([ACE_player, '%1', 'Timer', floor(sliderPosition 8845)] call FUNC(setupExplosive);closeDialog 0;), _mag]]; +buttonSetAction [8855, format[QUOTE(['%1'] call FUNC(openTriggerSelectionUI);), _mag]]; + +ctrlSetText [8870, format[localize "STR_ACE_Explosives_TimerMenu",0, 30]]; diff --git a/addons/explosives/functions/fnc_openTransmitterUI.sqf b/addons/explosives/functions/fnc_openTransmitterUI.sqf new file mode 100644 index 0000000000..6929ffc82c --- /dev/null +++ b/addons/explosives/functions/fnc_openTransmitterUI.sqf @@ -0,0 +1,53 @@ +/* + Name: ACE_Explosives_fnc_openTransmitterUI + + Author: Garth de Wet (LH) + + Description: + Opens the UI for selecting the transmitter + + Parameters: + 0: OBJECT - Unit + + Returns: + Nothing + + Example: + [player] call ACE_Explosives_fnc_openTransmitterUI; +*/ +#include "script_component.hpp" +private ["_items", "_unit", "_count", "_actions", "_config"]; +_unit = _this select 0; +_items = (items _unit); + +_actions = [localize "STR_ACE_Explosives_TriggerMenu", localize "STR_ACE_Explosives_SelectTrigger"] + call EFUNC(Interaction,prepareSelectMenu); +_detonators = [_unit] call FUNC(getDetonators); +{ + _config = ConfigFile >> "CfgWeapons" >> _x; + _actions = [ + _actions, + getText(_config >> "displayName"), + getText(_config >> "picture"), + _x + ] call EFUNC(Interaction,addSelectableItem); +} count _detonators; + +if (count _detonators == 0) then { + call EFUNC(Interaction,hideMenu); + "ACE_Explosives" call EFUNC(Interaction,openMenuSelf); + [format[localize "STR_ACE_Explosives_NoTriggersAvailable", "player"]] call EFUNC(Core,displayTextStructured); +}else{ + [ + _actions, + { + [ACE_player, _this] call FUNC(openDetonateUI); + }, + { + call EFUNC(Interaction,hideMenu); + if !(profileNamespace getVariable ["ACE_Interaction_AutoCloseMenu", false]) then { + "ACE_Explosives" call EFUNC(Interaction,openMenuSelf); + }; + } + ] call EFUNC(Interaction,openSelectMenu); +}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_openTriggerSelectionUI.sqf b/addons/explosives/functions/fnc_openTriggerSelectionUI.sqf similarity index 52% rename from TO_MERGE/agm/Explosives/functions/fn_openTriggerSelectionUI.sqf rename to addons/explosives/functions/fnc_openTriggerSelectionUI.sqf index 31a35bd499..7a87cb062e 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_openTriggerSelectionUI.sqf +++ b/addons/explosives/functions/fnc_openTriggerSelectionUI.sqf @@ -1,27 +1,29 @@ /* - Name: AGM_Explosives_fnc_openTriggerSelectionUI - + Name: ACE_Explosives_fnc_openTriggerSelectionUI + Author: Garth de Wet (LH) - + Description: Opens the UI for explosive trigger selection - - Parameters: + + Parameters: 0: String - explosive magazine - + Returns: Nothing - + Example: - [lbData [8866, lbCurSel 8866]] call AGM_Explosives_fnc_openTriggerSelectionUI; + [lbData [8866, lbCurSel 8866]] call ACE_Explosives_fnc_openTriggerSelectionUI; */ +#include "script_component.hpp" private ["_magazine", "_hasRequiredItems","_triggerTypes", "_actions", "_detonators", "_required", "_magTriggers"]; _magazine = _this select 0; -_detonators = [AGM_player] call AGM_Explosives_fnc_getDetonators; +_detonators = [ACE_player] call FUNC(getDetonators); -_triggerTypes = [_magazine] call AGM_Explosives_fnc_TriggerType; -_magTriggers = ConfigFile >> "CfgMagazines" >> _magazine >> "AGM_Triggers"; -_actions = [localize "STR_AGM_Explosives_TriggerMenu", localize "STR_AGM_Explosives_SelectTrigger"] call AGM_Interaction_fnc_prepareSelectMenu; +_triggerTypes = [_magazine] call FUNC(triggerType); +_magTriggers = ConfigFile >> "CfgMagazines" >> _magazine >> "ACE_Triggers"; +_actions = [localize "STR_ACE_Explosives_TriggerMenu", localize "STR_ACE_Explosives_SelectTrigger"] + call EFUNC(Interaction,prepareSelectMenu); _count = 0; { _required = getArray (_x >> "requires"); @@ -37,20 +39,21 @@ _count = 0; if(isText(_magTriggers >> configName _x >> "displayName"))then{getText(_magTriggers >> configName _x >> "displayName")}else{getText(_x >> "displayName")}, if(isText(_magTriggers >> configName _x >> "picture"))then{getText(_magTriggers >> configName _x >> "picture")}else{getText(_x >> "picture")}, [configName _x, _magazine] - ] call AGM_Interaction_fnc_AddSelectableItem; + ] call EFUNC(Interaction,addSelectableItem); _count = _count + 1; }; } count _triggerTypes; if (_count == 0) then { - [AGM_player] call AGM_Explosives_fnc_openPlaceUI; - [format[localize "STR_AGM_Explosives_NoTriggersAvailable", getText(configFile >> "CfgMagazines" >> _magazine >> "DisplayName")]] call AGM_Core_fnc_displayTextStructured; + [ACE_player] call FUNC(openPlaceUI); + [format[localize "STR_ACE_Explosives_NoTriggersAvailable", + getText(configFile >> "CfgMagazines" >> _magazine >> "DisplayName")]] call EFUNC(Core,displayTextStructured); }else{ [ _actions, { - [_this select 1, _this select 0] call AGM_Explosives_fnc_selectTrigger; + [_this select 1, _this select 0] call FUNC(selectTrigger); }, - {[AGM_player] call AGM_Explosives_fnc_openPlaceUI;} - ] call AGM_Interaction_fnc_openSelectMenu; + {[ACE_player] call FUNC(openPlaceUI);} + ] call EFUNC(Interaction,openSelectMenu); }; diff --git a/TO_MERGE/agm/Explosives/functions/fn_PlaceExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf similarity index 69% rename from TO_MERGE/agm/Explosives/functions/fn_PlaceExplosive.sqf rename to addons/explosives/functions/fnc_placeExplosive.sqf index 08ba299450..c059798867 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_PlaceExplosive.sqf +++ b/addons/explosives/functions/fnc_placeExplosive.sqf @@ -1,12 +1,12 @@ /* - Name: AGM_Explosives_fnc_PlaceExplosive - + Name: ACE_Explosives_fnc_PlaceExplosive + Author(s): Garth de Wet (LH) - + Description: Places an explosive at the requested position - + Parameters: 0: OBJECT - unit 1: POSITION - Position to place explosive @@ -14,13 +14,14 @@ 3: STRING - Magazine class 4: Config - Config of trigger 5: ARRAY - variables required for the trigger type - + Returns: OBJECT: Placed explosive - + Example: - _explosive = [player, player modelToWorld [0,0.5, 0.1], 134, "SatchelCharge_Remote_Mag", "Command", []] call AGM_Explosives_fnc_PlaceExplosive; + _explosive = [player, player modelToWorld [0,0.5, 0.1], 134, "SatchelCharge_Remote_Mag", "Command", []] call ACE_Explosives_fnc_PlaceExplosive; */ +#include "script_component.hpp" private ["_pos", "_dir", "_magazineClass", "_ammo", "_triggerSpecificVars", "_unit", "_triggerConfig", "_explosive"]; _unit = _this select 0; _pos = _this select 1; @@ -34,15 +35,15 @@ if (count _this > 6) then { }; if (isNil "_triggerConfig") exitWith { - diag_log format ["AGM_Explosives: Error config not passed to PlaceExplosive: %1", _this]; + diag_log format ["ACE_Explosives: Error config not passed to PlaceExplosive: %1", _this]; objNull }; -_magazineTrigger = ConfigFile >> "CfgMagazines" >> _magazineClass >> "AGM_Triggers" >> _triggerConfig; -_triggerConfig = ConfigFile >> "CfgAGM_Triggers" >> _triggerConfig; +_magazineTrigger = ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> _triggerConfig; +_triggerConfig = ConfigFile >> "CfgACE_Triggers" >> _triggerConfig; if (isNil "_triggerConfig") exitWith { - diag_log format ["AGM_Explosives: Error config not found in PlaceExplosive: %1", _this]; + diag_log format ["ACE_Explosives: Error config not found in PlaceExplosive: %1", _this]; objNull }; @@ -52,8 +53,10 @@ if (isText(_magazineTrigger >> "ammo")) then { }; _triggerSpecificVars pushBack _triggerConfig; _explosive = createVehicle [_ammo, _pos, [], 0, "NONE"]; -if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars] call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {_explosive}; +if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_triggerSpecificVars] + call compile (getText (_triggerConfig >> "onPlace"))}) exitWith {_explosive}; if (_setDir) then { - [[_explosive, _dir, getNumber (_magazineTrigger >> "pitch")], "AGM_Explosives_fnc_setPos"] call AGM_Core_fnc_execRemoteFnc; + [[_explosive, _dir, getNumber (_magazineTrigger >> "pitch")], QUOTE(FUNC(setPosition))] + call EFUNC(Core,execRemoteFnc); }; _explosive diff --git a/addons/explosives/functions/fnc_place_Approve.sqf b/addons/explosives/functions/fnc_place_Approve.sqf new file mode 100644 index 0000000000..38cf9f5788 --- /dev/null +++ b/addons/explosives/functions/fnc_place_Approve.sqf @@ -0,0 +1,108 @@ +/* + Name: ACE_Explosives_fnc_Place_Approve + + Author(s): + Garth de Wet (LH) + + Description: + Approves placement of the explosive, releases the placement object for it to settle in a location suitable for the explosive to be created. + + Parameters: + Nothing + + Returns: + Nothing + + Example: + call ACE_Explosives_fnc_Place_Approve; +*/ +#include "script_component.hpp" +if (GVAR(pfeh_running)) then { + [QGVAR(Placement),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; + GVAR(pfeh_running) = false; +}; +private ["_mag", "_setup", "_player"]; +_setup = GVAR(Setup); +GVAR(Setup) = objNull; +[GVAR(placer), "ACE_Explosives", false] call EFUNC(Core,setForceWalkStatus); +GVAR(placer) = objNull; +_player = ACE_player; +[_player, "DefaultAction", _player getVariable [QGVAR(Place), -1]] call EFUNC(Core,removeActionEventHandler); +[_player, "MenuBack", _player getVariable [QGVAR(Cancel), -1]] call EFUNC(Core,removeActionEventHandler); +call EFUNC(Interaction,hideMouseHint); +if ((_setup getVariable [QGVAR(Class), ""]) != "") then { + _dir = (getDir _setup); + if (_dir > 180) then { + _dir = _dir - 180; + } else { + _dir = 180 + _dir; + }; + _setup setVariable [QGVAR(Direction), _dir]; + _player setVariable [QGVAR(PlantingExplosive), true]; + _setup addEventHandler ["EpeContactStart", { + if (!((_this select 0) getVariable [QGVAR(Handled), false])) then { + private ["_player", "_pos", "_attachTo"]; + _player = ACE_player; + _pos = getPosATL (_this select 0); + (_this select 0) enableSimulationGlobal false; + if (surfaceIsWater _pos) then { + _pos = getPosASL (_this select 0); + (_this select 0) setPosASL _pos; + }else{ + (_this select 0) setPosATL _pos; + }; + (_this select 0) setVariable [QGVAR(Handled), true]; + _player setVariable [QGVAR(PlantingExplosive), false]; + _attachTo = objNull; + if (!isNull (_this select 1) && {(_this select 1) isKindOf "AllVehicles"}) then { + _attachTo = (_this select 1); + }; + [(_this select 0),_attachTo, _pos] spawn { // TODO: Change to scheduled delay execution + private ["_mag", "_setup", "_dir", "_player"]; + _setup = _this select 0; + _player = ACE_player; + _mag = _setup getVariable [QGVAR(Class), ""]; + _dir = _setup getVariable [QGVAR(Direction), 0]; + + sleep getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime"); + _explosive = [_player, _this select 2, _dir, _mag, _setup getVariable QGVAR(Trigger), + [_setup getVariable QGVAR(Timer)], isNull (_this select 1)] call FUNC(placeExplosive); + deleteVehicle _setup; + if (!isNull(_explosive)) then { + _player RemoveMagazine _mag; + if (!isNull (_this select 1)) then { + _explosive attachTo [(_this select 1)]; + _dir = _dir - (getDir (_this select 1)); + [[_explosive, _dir, 0], QUOTE(FUNC(setPosition))] call EFUNC(Core,execRemoteFnc); + }; + }; + }; + }; + }]; + _setup enableSimulationGlobal true; + _player playActionNow "MedicOther"; + [_setup] spawn { // TODO: Change to scheduled delay execution + private ["_setup", "_player"]; + _setup = _this select 0; + _player = ACE_player; + sleep 5; + if (!isNull _setup) then { + private ["_mag", "_dir", "_delayTime"]; + _mag = _setup getVariable [QGVAR(Class), ""]; + _dir = _setup getVariable [QGVAR(Direction), 0]; + _delayTime = (getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime")) - 5; + if (_delayTime > 0) then { + sleep _delayTime; + }; + if (!isNull _setup) then { + [_player, GetPosATL _setup, _dir, _mag, _setup getVariable QGVAR(Trigger), + [_setup getVariable QGVAR(Timer)], true] call FUNC(placeExplosive); + deleteVehicle _setup; + _player RemoveMagazine _mag; + _player setVariable [QGVAR(PlantingExplosive), false]; + }; + }; + }; +}else{ + deleteVehicle _setup; +}; diff --git a/addons/explosives/functions/fnc_place_Cancel.sqf b/addons/explosives/functions/fnc_place_Cancel.sqf new file mode 100644 index 0000000000..57a270023c --- /dev/null +++ b/addons/explosives/functions/fnc_place_Cancel.sqf @@ -0,0 +1,35 @@ +/* + Name: ACE_Explosives_fnc_Place_Cancel + + Author(s): + Garth de Wet (LH) + + Description: + Cancels placement of the explosive + + Parameters: + Nothing + + Returns: + Nothing + + Example: + call ACE_Explosives_fnc_Place_Cancel; +*/ +#include "script_component.hpp" +if (GVAR(pfeh_running)) then { + [QGVAR(Placement),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; + GVAR(pfeh_running) = false; +}; +if (!isNull (GVAR(Setup))) then { + deleteVehicle GVAR(Setup); +}; +GVAR(Setup) = objNull; +if (isNil {GVAR(placer)}) then { + GVAR(placer) = objNull; +}; +[GVAR(placer), "ACE_Explosives", false] call EFUNC(Core,setForceWalkStatus); +GVAR(placer) = objNull; +call EFUNC(Interaction,hideMouseHint); +[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Place), -1]] call EFUNC(Core,removeActionEventHandler); +[ACE_player, "MenuBack", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Core,removeActionEventHandler); diff --git a/TO_MERGE/agm/Explosives/functions/fn_selectTrigger.sqf b/addons/explosives/functions/fnc_selectTrigger.sqf similarity index 54% rename from TO_MERGE/agm/Explosives/functions/fn_selectTrigger.sqf rename to addons/explosives/functions/fnc_selectTrigger.sqf index ed4bfb755c..8009cb1c9d 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_selectTrigger.sqf +++ b/addons/explosives/functions/fnc_selectTrigger.sqf @@ -1,29 +1,30 @@ /* - Name: AGM_Explosives_fnc_selectTrigger - + Name: ACE_Explosives_fnc_selectTrigger + Author: Garth de Wet (LH) - + Description: Selects a trigger for an explosive. - - Parameters: + + Parameters: 0: String - Magazine - 1: String - trigger index in AGM_triggers of magazine class - + 1: String - trigger index in ACE_triggers of magazine class + Returns: Nothing - + Example: - ["SatchelCharge_Remote_Mag","Timer"] call AGM_Explosives_fnc_selectTrigger; + ["SatchelCharge_Remote_Mag","Timer"] call ACE_Explosives_fnc_selectTrigger; */ +#include "script_component.hpp" private ["_magazine","_trigger"]; closeDialog 0; _magazine = _this select 0; _trigger = _this select 1; -_config = ConfigFile >> "CfgAGM_Triggers" >> _trigger; -call AGM_Interaction_fnc_hideMenu; +_config = ConfigFile >> "CfgACE_Triggers" >> _trigger; +call EFUNC(Interaction,hideMenu); // If the onSetup function returns true, it is handled elsewhere if (isText(_config >> "onSetup") && {[_magazine] call compile getText (_config >> "onSetup")}) exitWith {}; -[AGM_player, _magazine, _trigger] call AGM_Explosives_fnc_SetupExplosive; +[ACE_player, _magazine, _trigger] call FUNC(setupExplosive); diff --git a/TO_MERGE/agm/Explosives/functions/fn_setPos.sqf b/addons/explosives/functions/fnc_setPosition.sqf similarity index 75% rename from TO_MERGE/agm/Explosives/functions/fn_setPos.sqf rename to addons/explosives/functions/fnc_setPosition.sqf index 88f727e1fe..a4cba8a107 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_setPos.sqf +++ b/addons/explosives/functions/fnc_setPosition.sqf @@ -1,23 +1,24 @@ /* - Name: AGM_Explosives_fnc_SetPos - + Name: ACE_Explosives_fnc_SetPos + Author(s): Garth de Wet (LH) - + Description: Sets the Dir and pitch - + Parameters: 0: OBJECT - Object 1: NUMBER - Direction 2: NUMBER - Pitch - + Returns: Nothing - + Example: - [_explosive, 150, 90] call AGM_Explosives_fnc_SetPos; + [_explosive, 150, 90] call ACE_Explosives_fnc_SetPos; */ +#include "script_component.hpp" private "_ex"; _ex=_this select 0; _ex setDir (_this select 1); diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf new file mode 100644 index 0000000000..dcb30415c4 --- /dev/null +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -0,0 +1,67 @@ +/* + Name: ACE_Explosives_fnc_SetupExplosive + + Author(s): + Garth de Wet (LH) + + Description: + Starts the setup process for the passed explosive. + + Parameters: + 0: OBJECT - Unit placing explosive. + 1: STRING - Classname of explosive to place. (CfgMagazine class) + 2: Config - Trigger Config + 3: NUMBER - (optional) timer + + Returns: + Nothing + + Example: + [player, "SatchelCharge_Remote_Mag", "Command"] call ACE_Explosives_fnc_SetupExplosive; +*/ +#include "script_component.hpp" +private ["_unit", "_class", "_config", "_timer"]; +_unit = _this select 0; +_class = _this select 1; +_config = _this select 2; +_timer = _this select 3; +GVAR(placer) = _unit; +// Commented out due to the fact there is a distinction between who can deactivate mines and who can plant them in standard configs. +// Would require custom config entries (ACE_ExplosiveSpecialist/ACE_Specialist) which excludes custom mods. +//if (ACE_Explosives_RequireSpecialist && {!([_unit] call ACE_Core_fnc_isEOD)}) exitWith {}; +if (isNil "_config") then { + _config = getArray(ConfigFile >> "CfgMagazines" >> _class >> "ACE_Triggers" >> "ACE_Triggers") select 0; +}; + +GVAR(Setup) = getText(ConfigFile >> "CfgMagazines" >> _class >> "ACE_SetupObject") createVehicleLocal [0,0,-10000]; + +GVAR(Setup) enableSimulationGlobal false; +GVAR(Setup) setVariable [QGVAR(Class), _class]; +GVAR(Setup) setVariable [QGVAR(Trigger), _config]; +//GVAR(Setup) setVariable [QGVAR(Offset), GetArray(ConfigFile >> "CfgVehicles" >> typeof GVAR(Setup) >> "ACE_Offset")]; +if (!isNil "_timer") then { + GVAR(Setup) setVariable [QGVAR(Timer), _timer]; +}; + +[_unit, "ACE_Explosives", true] call EFUNC(Core,setForceWalkStatus); +GVAR(TweakedAngle) = 180; +[QGVAR(Placement),"OnEachFrame", { + private "_player"; + _player = ACE_player; + if (GVAR(placer) != _player) exitWith { + call Func(place_Cancel); + }; + GVAR(pfeh_running) = true; + _pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); + //_pos = _pos vectorAdd ((VectorDir GVAR(Setup)) vectorCrossProduct (GVAR(Setup) getVariable [QGVAR(Offset), [0,0,0]])); + GVAR(Setup) setPosATL _pos; + if (ACE_Modifier == 0) then { + GVAR(Setup) setDir (GVAR(TweakedAngle) + getDir _player); + }; +}] call BIS_fnc_addStackedEventHandler; +[localize "STR_ACE_Explosives_PlaceAction", localize "STR_ACE_Explosives_CancelAction", + localize "STR_ACE_Explosives_ScrollAction"] call EFUNC(Interaction,showMouseHint); +_unit setVariable [QGVAR(Place), [_unit, "DefaultAction", + {GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call Func(place_Approve);}] call EFUNC(Core,AddActionEventHandler)]; +_unit setVariable [QGVAR(Cancel), [_unit, "MenuBack", + {GVAR(pfeh_running) AND !isNull (GVAR(Setup))}, {call Func(place_Cancel);}] call EFUNC(Core,AddActionEventHandler)]; diff --git a/addons/explosives/functions/fnc_startDefuse.sqf b/addons/explosives/functions/fnc_startDefuse.sqf new file mode 100644 index 0000000000..77964b3224 --- /dev/null +++ b/addons/explosives/functions/fnc_startDefuse.sqf @@ -0,0 +1,68 @@ +/* + Name: ACE_Explosives_fnc_StartDefuse + + Author: Garth de Wet (LH) + + Description: + Starts defusing an explosive + + Parameters: + 0: OBJECT - Unit to defuse explosive + 1: OBJECT - Target explosive + + Returns: + Nothing + + Example: + [player, ACE_Interaction_Target] call ACE_Explosives_fnc_StartDefuse; +*/ +#include "script_component.hpp" +private ["_unit","_target"]; +_unit = _this select 0; +_target = _this select 1; + +_fnc_DefuseTime = { + _target = _this select 1; + + _defuseTime = 5; + if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then { + _defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime"); + }; + if (!(_this select 0) && {GVAR(PunishNonSpecialists)}) then { + _defuseTime = _defuseTime * 1.5; + }; + _defuseTime +}; +_actionToPlay = "MedicOther"; +if (STANCE _unit == "Prone") then { + _actionToPlay = "PutDown"; +}; + +if (ACE_player != _unit) then { + // If the unit is a player, call the function on the player. + if (isPlayer _unit) then { + [[_unit, _target], QUOTE(FUNC(startDefuse)), _unit] call EFUNC(Core,execRemoteFnc); + } else { + // TODO: use scheduled delay execution + [_unit, _target, [[_unit] call EFUNC(Core,isEOD), _target] call _fnc_DefuseTime] spawn { + (_this select 0) playActionNow _actionToPlay; + (_this select 0) disableAI "MOVE"; + (_this select 0) disableAI "TARGET"; + sleep (_this select 2); + [(_this select 0), (_this select 1)] call Func(defuseExplosive); + (_this select 0) enableAI "MOVE"; + (_this select 0) enableAI "TARGET"; + }; + }; +} else { + _unit playActionNow _actionToPlay; + if (GVAR(RequireSpecialist)) then { + if ([_unit] call EFUNC(Core,isEOD)) then { + [[true, _target] call _fnc_DefuseTime, [_unit,_target], + QUOTE(FUNC(defuseExplosive)), localize "STR_ACE_Explosives_DefusingExplosive"] call EFUNC(Core,progressBar); + }; + } else { + [[([_unit] call EFUNC(Core,isEOD)), _target] call _fnc_DefuseTime, [_unit,_target], + QUOTE(FUNC(defuseExplosive)), localize "STR_ACE_Explosives_DefusingExplosive"] call EFUNC(Core,progressBar); + }; +}; diff --git a/TO_MERGE/agm/Explosives/functions/fn_StartTimer.sqf b/addons/explosives/functions/fnc_startTimer.sqf similarity index 56% rename from TO_MERGE/agm/Explosives/functions/fn_StartTimer.sqf rename to addons/explosives/functions/fnc_startTimer.sqf index b07d86bd3c..61a0fc5246 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_StartTimer.sqf +++ b/addons/explosives/functions/fnc_startTimer.sqf @@ -1,29 +1,30 @@ /* - Name: AGM_Explosives_fnc_startTimer - + Name: ACE_Explosives_fnc_startTimer + Author(s): Garth de Wet (LH) - + Description: Starts a timer for an explosive. - + Parameters: 0: OBJECT - Explosive 1: NUMBER - time till detonation - + Returns: Nothing - + Example: - [_explosive, 10] call AGM_Explosives_fnc_startTimer; + [_explosive, 10] call ACE_Explosives_fnc_startTimer; */ -_this spawn { +#include "script_component.hpp" +_this spawn { // TODO: use scheduled delay execution private ["_explosive", "_timer"]; _explosive = _this select 0; _timer = _this select 1; - + sleep _timer; if (!isNull _explosive) then { - [_explosive, -1, [_explosive, 0], true] call AGM_Explosives_fnc_DetonateExplosive; + [_explosive, -1, [_explosive, 0], true] call FUNC(detonateExplosive); }; }; diff --git a/TO_MERGE/agm/Explosives/functions/fn_TriggerType.sqf b/addons/explosives/functions/fnc_triggerType.sqf similarity index 61% rename from TO_MERGE/agm/Explosives/functions/fn_TriggerType.sqf rename to addons/explosives/functions/fnc_triggerType.sqf index fb19da9f12..dead725a7a 100644 --- a/TO_MERGE/agm/Explosives/functions/fn_TriggerType.sqf +++ b/addons/explosives/functions/fnc_triggerType.sqf @@ -1,27 +1,28 @@ /* - Name: AGM_Explosives_fnc_TriggerType - + Name: ACE_Explosives_fnc_TriggerType + Author(s): Garth de Wet (LH) - + Description: Gets the types of triggers associated with the explosive - + Parameters: 0: String - Explosive magazine - + Returns: ARRAY - + Example: - _supports = ["SatchelCharge_Remote_Mag"] call AGM_Explosives_fnc_TriggerType; + _supports = ["SatchelCharge_Remote_Mag"] call ACE_Explosives_fnc_TriggerType; */ +#include "script_component.hpp" private "_result"; _result = []; -_config = getArray (ConfigFile >> "CfgMagazines" >> (_this select 0) >> "AGM_Triggers" >> "AGM_Triggers"); +_config = getArray (ConfigFile >> "CfgMagazines" >> (_this select 0) >> "ACE_Triggers" >> "SupportedTriggers"); _count = count _config; for "_index" from 0 to (_count - 1) do { - _result set [_index, ConfigFile >> "CfgAGM_Triggers" >> (_config select _index)]; + _result set [_index, ConfigFile >> "CfgACE_Triggers" >> (_config select _index)]; }; _result diff --git a/addons/explosives/script_component.hpp b/addons/explosives/script_component.hpp new file mode 100644 index 0000000000..fa8b2bac4d --- /dev/null +++ b/addons/explosives/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT explosives +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_EXPLOSIVES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_EXPLOSIVES + #define DEBUG_SETTINGS DEBUG_SETTINGS_EXPLOSIVES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/TO_MERGE/agm/Explosives/stringtable.xml b/addons/explosives/stringtable.xml similarity index 90% rename from TO_MERGE/agm/Explosives/stringtable.xml rename to addons/explosives/stringtable.xml index 7ca6bf5870..0b67fe5a7e 100644 --- a/TO_MERGE/agm/Explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -1,8 +1,8 @@ - + - + - + Explosives >> Sprengstoffe >> Explosivos >> @@ -14,7 +14,7 @@ Explosivos >> Взрывчатка >> - + Place >> Platzieren >> Colocar >> @@ -26,7 +26,7 @@ Colocar >> Установить >> - + Detonate >> Zünden >> Detonar >> @@ -38,7 +38,7 @@ Detonar >> Подрыв >> - + Explosive code: %1 Sprengstoffcode: %1 Código del explosivo: %1 @@ -50,7 +50,7 @@ Código do explosivo: %1 Взрывная код: %1 - + Place Platzieren Colocar @@ -62,7 +62,7 @@ Colocar Положить - + Cancel Abbrechen Cancelar @@ -74,7 +74,7 @@ Cancelar Отмена - + + Modifier, rotates + Modifikator, drehen + Modificador, girar @@ -86,7 +86,7 @@ + Modificador, rotaciona + Bращать - + Turn On Thor III Thor III aktivieren Encender Thor III @@ -98,7 +98,7 @@ Ativar Thor III Активировать Thor III - + Turn Off Thor III Thor III deaktivieren Apagar Thor III @@ -110,7 +110,7 @@ Desativar Thor III Деактивировать Thor III - + Cellphone Mobiltelefon Télefono móvil @@ -122,7 +122,7 @@ Celular Сотовый телефон - + Used to remotely trigger explosives Wird benutzt um Sprengstoffe fernzuzünden Usado para detonar remotamente explosivos @@ -134,7 +134,7 @@ Usado para acionar explosivos remotamente Используется для удаленного запуска взрывчатку - + M57 Firing Device M57 Zündvorrichtung Dispositivo de detonación M57 @@ -146,7 +146,7 @@ M57 Dispositivo de Detonação Взрыватель M57 - + Used to remotely trigger explosives Wird benutzt um Sprengstoffe fernzuzünden Usado para detonar remotamente explosivos @@ -158,7 +158,7 @@ Usado para acionar explosivos remotamente Используется для удаленного запуска взрывчатку - + M26 Firing Device M26 Zündvorrichtung Dispositivo de detonación MK26 @@ -170,7 +170,7 @@ M26 Dispositivo de Detonação Взрыватель M26 - + M152 RAMS M152 RAMS M152 RAMS @@ -182,7 +182,7 @@ M152 RAMS M152 RAMS - + Defusal Kit Entschärfungskit Kit de desactivación @@ -194,7 +194,7 @@ Kit de desarme Разминирование комплект - + Allows defusing of explosives Erlaubt die Entschärfung von Sprengstoffen Permite desactivar explosivos @@ -206,7 +206,7 @@ Permite o desarme de explosivos Allows defusing of explosives - + Add to Speed Dial Zur Schnellauswahl hinzufügen Agregar a marcado rápido @@ -218,7 +218,7 @@ Adicionar à ligação rápida Добавить в ускоренный набор - + Clear Löschen Borrar @@ -230,7 +230,7 @@ Limpar Pассеиваться - + Dial Wählen Marcar @@ -242,7 +242,7 @@ Discar Hабрать - + Up Hoch Arriba @@ -254,7 +254,7 @@ Cima Поднять - + Down Runter Abajo @@ -266,7 +266,7 @@ Baixo Опустить - + Cancel Abbrechen Cancelar @@ -278,7 +278,7 @@ Cancelar Отмена - + Detonate Menu "Zünden"-Menü Menú de detonación @@ -290,7 +290,7 @@ Menu de detonação Меню Подрыв - + Place Menu "Platzieren"-Menü Menú de colocación @@ -302,7 +302,7 @@ Menu de posicionamento Меню Установить - + Defuse Entschärfen Desactivar @@ -314,7 +314,7 @@ Desarmar Обезвредить - + Defusing Explosive... Entschärfe Sprengstoff... Desactivando explosivo... @@ -326,7 +326,7 @@ Desarmando Explosivo... Обезвреживание... - + Timer Zeitzünder Temporizador @@ -338,7 +338,7 @@ Timer Временной - + Time: %1m %2s Zeit: %1m %2s Tiempo: %1m %2s @@ -350,7 +350,7 @@ Tempo: %1m %2s Tемп: %1m %2c - + Set Time Zeit einstellen Configurar tiempo @@ -362,7 +362,7 @@ Configurar Tempo Xронометр - + Select a Trigger Wähle einen Zünder Seleccionar un disparador @@ -374,7 +374,7 @@ Selecionar um Gatilho Выберите - + Select Wählen Seleccionar @@ -386,7 +386,7 @@ Selecionar Выбрать защелка - + Pressure Plate Płyta naciskowa Placa de presión @@ -398,7 +398,7 @@ Placa de pressão Давление - + Tripwire Linka naciągu Cable trampa @@ -410,7 +410,7 @@ Linha de tração Натяжной - + IR Sensor Czujnik podczerwieni Sensor IR @@ -422,7 +422,7 @@ Sensor IV ИК - + No triggers available for %1 Brak dostępnych zapalników dla %1 No hay detonadores disponibles para %1 @@ -434,7 +434,7 @@ Nenhum gatilho disponível para %1 Нет защелка доступны для %1 - + IR Sensor (Side Attack) Czujnik podczerwieni (wybuch na bok) Sensor IR (ataque lateral) @@ -446,7 +446,7 @@ Sensor infravermelho (ataque lateral) ИК (боковая атака) - + Magnetic Influence Sensor (Bottom Attack) Czujnik magnetyczny (wybuch w górę) Sensor IM (ataque inferior) @@ -458,7 +458,7 @@ Influência magnética (ataque inferior) Магнитный (дно атака) - + No explosives on trigger. Keine Sprengladungen auf diesem Auslöser. Ningún explosivo en el detonador. @@ -470,7 +470,7 @@ Nenhum explosivo no gatilho. Нет взрывчатки на курок. - + Dead Man's Switch Totmannschalter Mise à feu par relâchement de pression @@ -480,7 +480,7 @@ Dead Man's Switch Кнопка мертвеца - + Used to remotely trigger explosives when released. Zündet Sprengladungen wenn losgelassen. Déclenche la mise à feu d'un explosif lorsqu'il est libéré.