Add fnc_connectExplosive to add editor explosives to unit triggers

This commit is contained in:
VKing 2016-01-14 23:05:26 +01:00
parent 73e093ec07
commit 575f37c8fd
3 changed files with 58 additions and 4 deletions

View File

@ -341,8 +341,18 @@ class CfgVehicles {
// Editor placed mines
class MineBase;
class SatchelCharge_F: MineBase {
GVAR(magazine) = "SatchelCharge_Remote_Mag";
};
class DemoCharge_F: MineBase {
GVAR(magazine) = "DemoCharge_Remote_Mag";
};
class Claymore_F: MineBase {
GVAR(magazine) = "ClaymoreDirectionalMine_Remote_Mag";
};
class SLAMDirectionalMine: MineBase {
displayName = CSTRING(Module_SLAMSideAttack_DisplayName);
GVAR(magazine) = "SLAMDirectionalMine_Wire_Mag";
};
class ACE_SLAMBottomMine: SLAMDirectionalMine {
author = ECSTRING(common,aceteam);
@ -350,28 +360,41 @@ class CfgVehicles {
displayName = CSTRING(Module_SLAMBottomAttack_DisplayName);
// TODO: Find a way to place the mine laying down instead of standing up
};
class IEDUrbanBig_F;
class IEDUrbanBig_F: MineBase {
GVAR(magazine) = "IEDUrbanBig_Remote_Mag";
};
class ACE_IEDUrbanBig_Range: IEDUrbanBig_F {
author = ECSTRING(common,aceteam);
ammo = "ACE_IEDUrbanBig_Range_Ammo";
GVAR(magazine) = "IEDUrbanBig_Remote_Mag";
displayName = CSTRING(Module_IEDUrbanBig_Range_DisplayName);
};
class IEDLandBig_F;
class IEDLandBig_F: MineBase {
GVAR(magazine) = "IEDLandBig_Remote_Mag";
};
class ACE_IEDLandBig_Range: IEDLandBig_F {
author = ECSTRING(common,aceteam);
ammo = "ACE_IEDLandBig_Range_Ammo";
GVAR(magazine) = "IEDLandBig_Remote_Mag";
displayName = CSTRING(Module_IEDLandBig_Range_DisplayName);
};
class IEDUrbanSmall_F;
class IEDUrbanSmall_F: MineBase {
GVAR(magazine) = "IEDUrbanSmall_Remote_Mag";
};
class ACE_IEDUrbanSmall_Range: IEDUrbanSmall_F {
author = ECSTRING(common,aceteam);
ammo = "ACE_IEDUrbanSmall_Range_Ammo";
GVAR(magazine) = "IEDUrbanSmall_Remote_Mag";
displayName = CSTRING(Module_IEDUrbanSmall_Range_DisplayName);
};
class IEDLandSmall_F;
class IEDLandSmall_F: MineBase {
GVAR(magazine) = "IEDLandSmall_Remote_Mag";
};
class ACE_IEDLandSmall_Range: IEDLandSmall_F {
author = ECSTRING(common,aceteam);
ammo = "ACE_IEDLandSmall_Range_Ammo";
GVAR(magazine) = "IEDLandSmall_Remote_Mag";
displayName = CSTRING(Module_IEDLandSmall_Range_DisplayName);
};

View File

@ -15,6 +15,7 @@ class CfgWeapons {
model = QUOTE(PATHTOF(data\ace_m57.p3d));
ACE_Range = 250;
ACE_Detonator = 1;
GVAR(triggerType) = "Command";
class ItemInfo: ACE_ExplosiveItem {
mass = 3;
@ -25,6 +26,7 @@ class CfgWeapons {
displayName = CSTRING(M26_displayName);
picture = PATHTOF(Data\UI\MK26_Transmitter_ca.paa);
ACE_Range = 5000;
GVAR(triggerType) = "MK16_Transmitter";
};
class ACE_DefusalKit: ACE_ItemCore {
scope = 2;
@ -46,6 +48,7 @@ class CfgWeapons {
model = "\A3\weapons_F\ammo\mag_univ.p3d";
ACE_Range = 100;
ACE_Detonator = 1;
GVAR(triggerType) = "DeadManSwitch";
class ItemInfo: ACE_ExplosiveItem {
mass = 2;
@ -60,6 +63,7 @@ class CfgWeapons {
model = "\A3\weapons_F\ammo\mag_univ.p3d";
ACE_Range = 15000;
ACE_Detonator = 1;
GVAR(triggerType) = "Cellphone";
class ItemInfo: ACE_ExplosiveItem {
mass = 2;

View File

@ -0,0 +1,27 @@
/*
* Author: VKing
* Add preplaced explosives to a unit's detonator.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Explosive object <OBJECT>
* 2: Detonator type <STRING>
*
* Return Value:
* None
*
* Example:
* [player, claymore1, "ACE_Clacker"] call ace_explosives_fnc_connectExplosive
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_object", "_detonator"];
TRACE_3("Params",_unit,_object,_detonator);
private _detonatorConfig = getText (configFile >> "CfgWeapons" >> _detonator >> QGVAR(triggerType));
private _magazineClass = getText (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(magazine));
[_unit, _object, _magazineClass, [configFile >> "ACE_Triggers" >> _detonatorConfig]] call FUNC(addClacker);