Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

Commit cde308f

Browse files
committed
Add initial port of the cse ied modules
1 parent d9ca9b5 commit cde308f

16 files changed

+343
-0
lines changed

addons/ieds/$PBOPREFIX$

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
z\acex\addons\ieds

addons/ieds/ACE_Settings.hpp

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class ACE_Settings {
2+
class GVAR(Enabled) {
3+
value = 1;
4+
typeName = "BOOL";
5+
displayName = ECSTRING(common,Enabled);
6+
description = CSTRING(EnabledDesc);
7+
};
8+
};

addons/ieds/CfgEventHandlers.hpp

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Extended_PreInit_EventHandlers {
2+
class ADDON {
3+
init = QUOTE(call COMPILE_FILE(XEH_preInit));
4+
};
5+
};
6+
7+
class Extended_PostInit_EventHandlers {
8+
class ADDON {
9+
init = QUOTE(call COMPILE_FILE(XEH_postInit));
10+
};
11+
};
12+
13+
class Extended_InitPost_EventHandlers {
14+
class AllVehicles {
15+
class ADDON {
16+
serverInit = QUOTE(_this call FUNC(handleInitPost));
17+
};
18+
};
19+
};

addons/ieds/CfgVehicles.hpp

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
class CfgVehicles {
2+
class ACE_Module;
3+
class GVAR(createIed): ACE_Module {
4+
author = "STR_ACE_common_ACETeam";
5+
category = "ACE_missionModules";
6+
displayName = CSTRING(Module);
7+
function = QFUNC(moduleInit);
8+
scope = 2;
9+
isGlobal = 1; // Global
10+
isTriggerActivated = 0;
11+
isDisposable = 0;
12+
// icon = ""; // TODO add module icon
13+
class Arguments {
14+
class typeOfIED {
15+
displayName = "Type";
16+
description = "The Type of the IED";
17+
typeName = "NUMBER";
18+
class values {
19+
class land {name="Normal"; value=0; default=1; };
20+
class urban {name="Urban"; value=1; };
21+
};
22+
};
23+
24+
class sizeOfIED {
25+
displayName = "Size";
26+
description = "The size of the IED";
27+
typeName = "NUMBER";
28+
class values {
29+
class small {name="Small"; value=1; default=1; };
30+
class large {name="Large"; value=0; };
31+
};
32+
};
33+
34+
class heightOfIED {
35+
displayName = "Height";
36+
description = "The height that the IED is burried";
37+
typeName = "NUMBER";
38+
class values {
39+
class Above {name="Above Ground"; value=0; default=1; };
40+
class slightly {name="Slightly burried"; value=-0.015; };
41+
class medium {name="Medium burried"; value=-0.025; };
42+
class almost {name="Almost burried"; value=-0.05; };
43+
class fully {name="Fully burried"; value=-0.1; };
44+
};
45+
};
46+
47+
class iedActivationType {
48+
displayName = "Activation Type";
49+
description = "How is the IED activated";
50+
typeName = "NUMBER";
51+
class values {
52+
class None {name="None"; value=-1; };
53+
class PressurePlate {name="Pressure Plate"; value=0; default=1;};
54+
class Radio {name="Radio"; value=1; };
55+
};
56+
};
57+
58+
class activatedForTargets {
59+
displayName = "Activated for";
60+
description = "What types is the IED activated for";
61+
typeName = "NUMBER";
62+
class values {
63+
class None {name="None"; value=-1; };
64+
class All {name="Any type"; value=0; default=1;};
65+
class Vehicles {name="Any Vehicle"; value=1; };
66+
class Land {name="Ground Vehicles"; value=2; };
67+
class Air {name="Airial Vehicles"; value=3; };
68+
class Man {name="Man"; value=4; };
69+
};
70+
};
71+
72+
class activatedForSides {
73+
displayName = "What sides activate this IED";
74+
description = "What types is the IED activated for";
75+
typeName = "NUMBER";
76+
class values {
77+
class None {name="None"; value=-1; };
78+
class All {name="Any side"; value=0; default=1; };
79+
class West {name="BLUFOR"; value=1; };
80+
class East {name="OpFOR"; value=2; };
81+
class Ind {name="Independant"; value=3; };
82+
class Civ {name="Civilian"; value=4; };
83+
};
84+
};
85+
};
86+
87+
class ModuleDescription {
88+
description = CSTRING(ModuleDesc);
89+
};
90+
};
91+
};

addons/ieds/PREP.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PREP(createIEDObject);
2+
PREP(moduleInit);
3+
PREP(onIEDActivated);

addons/ieds/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
acex_ieds
2+
============
3+
4+
Adds IED mission module framework
5+
6+
7+
## Maintainers
8+
9+
The people responsible for merging changes to this component or answering potential questions.
10+
11+
- [Glowbal](http://github.com/glowbal)
5.49 KB
Binary file not shown.

addons/ieds/XEH_postInit.sqf

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "script_component.hpp"

addons/ieds/XEH_preInit.sqf

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "script_component.hpp"
2+
3+
ADDON = false;
4+
5+
#include "PREP.hpp"
6+
7+
GVAR(IED_COLLECTION) = [];
8+
9+
ADDON = true;

addons/ieds/config.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "script_component.hpp"
2+
3+
class CfgPatches {
4+
class ADDON {
5+
units[] = {};
6+
weapons[] = {};
7+
requiredVersion = REQUIRED_VERSION;
8+
requiredAddons[] = {"acex_main", "ace_explosives"};
9+
author[]= {"Glowbal"};
10+
authorUrl = "https://github.com/glowbal";
11+
VERSION_CONFIG;
12+
};
13+
};
14+
15+
#include "ACE_Settings.hpp"
16+
#include "CfgEventHandlers.hpp"
17+
#include "CfgVehicles.hpp"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
#include "script_component.hpp"
3+
4+
#define LAND_IEDS ["ACE_IEDLandBig_Range", "ACE_IEDLandSmall_Range"]
5+
#define URBAN_IEDS ["ACE_IEDUrbanBig_Range", "ACE_IEDUrbanSmall_Range"]
6+
7+
params ["_logic"];
8+
9+
private ["_logic","_typeOfIED", "_sizeOfIED", "_heightOfIED", "_iedClass", "_iedCreated"];
10+
11+
if (isNull _logic) exitwith {};
12+
13+
private _typeOfIED = _logic getvariable ["typeOfIED", 0];
14+
private _sizeOfIED = _logic getvariable ["sizeOfIED", 0];
15+
private _heightOfIED = _logic getvariable ["heightOfIED", 0];
16+
17+
private _iedClass = switch (_typeOfIED) do {
18+
case 0: { LAND_IEDS select _sizeOfIED};
19+
case 1: { URBAN_IEDS select _sizeOfIED };
20+
};
21+
private _iedCreated = _iedClass createVehicle (getPos _logic);
22+
23+
if (_logic getvariable ["iedActivationType",0] == 0) then {
24+
createMine [_iedClass, getPos _logic, [], 0];
25+
};
26+
27+
_logic setvariable [QGVAR(linkedIED), _iedCreated, true]; // TODO do we need a global flag here?
28+
_iedCreated setvariable [QGVAR(linkedIED), _logic, true]; // TODO do we need a global flag here?
29+
30+
_iedCreated setPos [getPos _Logic select 0, getPos _Logic select 1, (getPos _Logic select 2) + _heightOfIED];
31+
32+
_iedCreated addEventHandler ["Killed", {
33+
params ["_ied", "_killer"];
34+
35+
private _logic = _ied getvariable [QGVAR(linkedIED), objNull];
36+
private _activationType = _logic getvariable ["iedActivationType", 0];
37+
[_logic] call FUNC(onIEDActivated);
38+
39+
if (_activationType == -1) then {
40+
private _iedClass = typeOf _ied;
41+
private _iedPos = getPos _ied;
42+
private _ammoClass = getText(configFile >> "CfgVehicles" >> _iedClass >> "ammo");
43+
private _dummyIed = _ammoClass createVehicle _iedPos;
44+
_dummyIed setPos _iedPos;
45+
_dummyIed setDamage 1;
46+
};
47+
deleteVehicle _ied;
48+
}];
49+
50+
_iedCreated;
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Author: Glowbal
3+
*
4+
* Arguments:
5+
* 0: <BOOL>
6+
*
7+
* Return Value:
8+
* None
9+
*
10+
* Public: No
11+
*/
12+
#include "script_component.hpp"
13+
14+
params ["_logic", "_units", "_activated"];
15+
16+
if (!local _logic) exitwith {};
17+
18+
private _collectObjects = {
19+
params ["_logic"];
20+
21+
private _collection = synchronizedObjects _logic;
22+
{
23+
if !(_x in _totalCollection) then {
24+
if (typeOf _x == QGVAR(createIed)) then {
25+
if !(_x getvariable [QGVAR(masterIED), false]) then {
26+
_x setvariable [QGVAR(subIED), true];
27+
_x setvariable [QGVAR(controlledByIED), _logic];
28+
_totalCollection pushback _x;
29+
[_x] call _collectObjects;
30+
};
31+
} else {
32+
if (typeOf _x == "cseModule_triggerManLinkIEDS") then {
33+
_list = _x getvariable ["EnableList",""];
34+
_list = "[" + _list + "]";
35+
_parsedList = [] call compile _list;
36+
_triggerManList = (_logic getvariable [QGVAR(triggerManUnits), []]) + _parsedList;
37+
_logic setvariable [QGVAR(triggerManUnits), _triggerManList];
38+
};
39+
};
40+
};
41+
}foreach _collection;
42+
};
43+
44+
if !(_logic getvariable [QGVAR(subIED),false]) then {
45+
_logic setvariable [QGVAR(masterIED), true];
46+
private _totalCollection = [_logic];
47+
[_logic] call _collectObjects;
48+
_logic setvariable [QGVAR(collection), _totalCollection];
49+
};
50+
51+
[_logic] call FUNC(createIEDObject);
52+
53+
private _activatedTargets = switch (_logic getvariable ["activatedForTargets", -1]) do {
54+
case 0: {["CaManBase", "Air", "Car", "Motorcycle", "Tank"]};
55+
case 1: {["Air", "Car", "Motorcycle", "Tank"]};
56+
case 2: {["Car", "Motorcycle", "Tank"]};
57+
case 3: {["Air"]};
58+
case 4: {["CaManBase"]};
59+
default {[]};
60+
};
61+
_logic setvariable ["activatedForTargets", _activatedTargets];
62+
63+
private _activatedSides = switch (_logic getvariable ["activatedForSides", -1]) do {
64+
case 0: {[west, east, independent, civilian, sideEnemy, sideFriendly]};
65+
case 1: {[west, sideEnemy]};
66+
case 2: {[east, sideEnemy]};
67+
case 3: {[independent, sideEnemy]};
68+
case 4: {[civilian, sideEnemy]};
69+
default {[]};
70+
};
71+
72+
_logic setvariable ["activatedForSides", _activatedSides, true];
73+
_logic setvariable ["iedActivationType", _logic getvariable ["iedActivationType", 0], true];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
#include "script_component.hpp"
3+
4+
params ["_logic"];
5+
6+
private _originalLogic = _logic;
7+
8+
private _getMasterIED = {
9+
if (_logic getvariable [QGVAR(subIED),false]) then {
10+
_logic = _logic getvariable [QGVAR(controlledByIED), _logic];
11+
if (_logic getvariable [QGVAR(subIED),false]) then {
12+
call _getMasterIED;
13+
};
14+
};
15+
};
16+
call _getMasterIED;
17+
18+
private _chain = _logic getvariable [QGVAR(collection), []];
19+
{
20+
private _iedLogic = _x;
21+
if (_iedLogic != _originalLogic) then {
22+
_iedLogic setvariable ["iedActivationType", -1]; // disable all other activation methods, we are blowing the entire chain already anway
23+
};
24+
25+
private _trigger = _iedLogic getvariable [QGVAR(linkedIED), objNull];
26+
if (!(isNull _trigger)) then {
27+
[_iedLogic, _trigger, _logic] spawn { // using a spawn because it doesn't matter to much if an ied isn't detonated at a reliable time
28+
params ["_iedLogic", "_trigger", "_master"];
29+
if (!isNull _trigger) then {
30+
if ((_iedLogic != _master) && {random(1)>0.1}) then {
31+
uisleep (random(2));
32+
};
33+
_trigger setDamage 1;
34+
};
35+
};
36+
};
37+
} forEach _chain;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "\z\acex\addons\ieds\script_component.hpp"

addons/ieds/script_component.hpp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#define COMPONENT ieds
2+
#include "\z\acex\addons\main\script_mod.hpp"
3+
4+
#ifdef DEBUG_ENABLED_IEDS
5+
#define DEBUG_MODE_FULL
6+
#endif
7+
8+
#ifdef DEBUG_SETTINGS_IEDS
9+
#define DEBUG_SETTINGS DEBUG_SETTINGS_IEDS
10+
#endif
11+
12+
#include "\z\acex\addons\main\script_macros.hpp"
13+
14+
#define DELAY_DEFAULT 15

addons/ieds/stringtable.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project name="ACEX">
3+
<Package name="Ieds">
4+
<Key ID="STR_ACEX_ieds_Module">
5+
<English>Create IED</English>
6+
</Key>
7+
</Package>
8+
</Project>

0 commit comments

Comments
 (0)