Skip to content

Commit 0e283d7

Browse files
committed
Added - Suicide Bomber Zeus Enhanced module compatibility
Why ================= Because the original only works with Achilles modules. Issue ID: N/A
1 parent 07e69d2 commit 0e283d7

File tree

4 files changed

+215
-0
lines changed

4 files changed

+215
-0
lines changed
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
[] spawn {
2+
3+
if (
4+
hasInterface
5+
AND (isClass (configFile >> "CfgPatches" >> "zen_dialog"))
6+
) then {
7+
waituntil {!isnil "bis_fnc_init"};
8+
waitUntil {(count allCurators) > 0};
9+
waitUntil {sleep 2; count (allCurators select {!isNull getassignedcuratorunit _x}) > 0};
10+
11+
_cat = "[FOX] Suicide Bomber";
12+
// ZEN is loaded, register the custom module.
13+
[_cat, "Suicide Bomber", {
14+
15+
[(_this select 1)] call bnb_ex_suicide_bomber_fnc_suicideBomberZen;
16+
17+
}] call zen_custom_modules_fnc_register;
18+
19+
[_cat, "Carbomb", {
20+
21+
if( (isNull (_this select 1) ) || !((_this select 1) isKindOf "Car") )exitWith {
22+
'Invalid object' call fox_suicide_bomber_fnc_curatorMessage;
23+
};
24+
25+
if( (_this select 1) getVariable["fox_suicide_bomber_carbombActive",false] )exitWith {
26+
'Carbomb already assigned' call fox_suicide_bomber_fnc_curatorMessage;
27+
};
28+
'Carbomb assigned' call fox_suicide_bomber_fnc_curatorMessage;
29+
[(_this select 1)] remoteExec["fox_suicide_bomber_fnc_setupCarbomb",2];
30+
31+
}] call zen_custom_modules_fnc_register;
32+
33+
34+
[_cat, "Carbomb KI", {
35+
params [["_position", [0,0,0], [[]], 3], ["_unit", objNull, [objNull]]];
36+
37+
if (isNull _unit) exitWith {
38+
'No Unit Selected' call fox_suicide_bomber_fnc_curatorMessage;
39+
};
40+
41+
_vehicles = nearestObjects [_unit, ["Car"], 30];
42+
_names = [];
43+
44+
{
45+
if (alive _x) then {
46+
_text = getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayname");
47+
_names pushBack (format["%1 (%2m)", _text, round (_unit distance _x)]);
48+
};
49+
} forEach _vehicles;
50+
[format["Pre-Carbomb KI: %1 %2 %3 %4", _this, _position, _unit, _vehicles], "suicide_bomber\XEH_postInit.sqf"] call bnb_es_core_fnc_log;
51+
52+
if (count _vehicles == 0) exitWith {
53+
'No Cars found nearby' call fox_suicide_bomber_fnc_curatorMessage;
54+
};
55+
56+
[
57+
"Carbomb KI",
58+
[
59+
["LIST", "Vehicle", [_vehicles, _names, 0]]
60+
],
61+
{
62+
private _vehicle = (_this select 0) select 0;
63+
private _unit = (_this select 1) select 0;
64+
[format["Carbomb KI: %1 %2 %3", _this, _vehicle, _unit], "suicide_bomber\XEH_postInit.sqf"] call bnb_es_core_fnc_log;
65+
[_vehicle,_unit] call fox_suicide_bomber_fnc_carbombRemoteAI;
66+
}, {}, [_unit]
67+
] call zen_dialog_fnc_create;
68+
69+
}] call zen_custom_modules_fnc_register;
70+
71+
[_cat, "Remote IED", {
72+
[format["Remote IED: %1", _this], "suicide_bomber\XEH_postInit.sqf"] call bnb_es_core_fnc_log;
73+
[(_this select 1)] call bnb_ex_suicide_bomber_fnc_aiRemoteIEDZen;
74+
75+
}] call zen_custom_modules_fnc_register;
76+
};
77+
};

addons/suicide_bomber/config.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,22 @@ class CfgFunctions {
3535
class aceDisarmIED {};
3636
class aceExamine {};
3737
};
38+
class ied {
39+
file = "\x\bnb_ex\suicide_bomber\functions\ied";
40+
class aiRemoteIEDZen {};
41+
};
42+
class suicide_bomber {
43+
file = "\x\bnb_ex\suicide_bomber\functions\suicide_bomber";
44+
class suicideBomberZen {};
45+
};
3846
};
3947
};
4048

49+
class Extended_PostInit_EventHandlers {
50+
class bnb_ex_core_postInit {
51+
init = "call compile preprocessFileLineNumbers '\x\bnb_ex\suicide_bomber\XEH_postInit.sqf'";
52+
};
53+
};
4154

4255
class CfgVehicles {
4356
class LandVehicle;
@@ -49,6 +62,7 @@ class CfgVehicles {
4962
condition = "player == vehicle player";
5063
exceptions[] = {"isNotInside", "isNotSitting", "isNotOnLadder"};
5164
statement = "";
65+
5266
class fox_suicice_bomber_carbombSearch {
5367
displayName = "Search for explosives";
5468
condition = "alive _target";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
_unit = param[0, objNull];
2+
3+
4+
if (isNull _unit) exitWith {
5+
"Invalid unit" call fox_suicide_bomber_fnc_curatorMessage;
6+
};
7+
8+
9+
_roads = _unit nearRoads 15;
10+
11+
if (count _roads isEqualTo 0) exitWith {
12+
"No valid road neaby" call fox_suicide_bomber_fnc_curatorMessage;
13+
};
14+
15+
16+
_ieds = [
17+
"ACE_IEDLandSmall_Range_Ammo",
18+
"ACE_IEDUrbanSmall_Range_Ammo",
19+
"ACE_IEDLandBig_Range_Ammo",
20+
"ACE_IEDUrbanBig_Range_Ammo"
21+
];
22+
_iedsTextArray = [];
23+
24+
{
25+
_cfgAmmo = getText (configfile >> "CfgAmmo" >> _x >> "defaultMagazine");
26+
_displayName = getText (configfile >> "CfgMagazines" >> _cfgAmmo >>"displayName");
27+
_iedsTextArray pushBack _displayName;
28+
} forEach _ieds;
29+
30+
31+
[format["Remote IED 1: %1 %2 %3", _this, _unit, _roads], "suicide_bomber\functions\ied\fn_aiRemoteIEDZen.sqf"] call bnb_es_core_fnc_log;
32+
[
33+
"Improvised Explosive Device",
34+
[
35+
["COMBO", "IED", [_ieds, _iedsTextArray]]
36+
],
37+
{
38+
(_this select 1) params ["_unit", "_roads"];
39+
// Get the selected data
40+
_ammo = (_this select 0) select 0;
41+
42+
_road = selectRandom _roads;
43+
44+
_pos = [_road, 0, 7] call BIS_fnc_findSafePos;
45+
//createVehicle ["Sign_Arrow_Large_Cyan_F", _pos, [], 0, "CAN_COLLIDE"];
46+
47+
_unit doMove _pos;
48+
49+
[format["Remote IED 2: %1 %2 %3 %4", _this, _ammo, _pos, _road], "suicide_bomber\functions\ied\fn_aiRemoteIEDZen.sqf"] call bnb_es_core_fnc_log;
50+
[{
51+
(_this select 0) distance (_this select 1) < 3
52+
}, {
53+
_unit = _this select 0;
54+
_pos = _this select 1;
55+
_ammo = _this select 2;
56+
[format["Remote IED: %1 %2 %3", _unit, _pos, _ammo], "suicide_bomber\functions\ied\fn_aiRemoteIEDZen.sqf"] call bnb_es_core_fnc_log;
57+
58+
[_unit,_ammo, _pos] spawn {
59+
params["_unit","_ammo", "_pos"];
60+
[format["Post-Remote IED: %1 %2 %3", _unit, _pos, _ammo], "suicide_bomber\functions\ied\fn_aiRemoteIEDZen.sqf"] call bnb_es_core_fnc_log;
61+
sleep 4;
62+
[_unit,"Acts_TreatingWounded06"] remoteExec ["playMove",0];
63+
sleep 4;
64+
[_unit,"fox_suicide_bomber_shovel"] remoteExec ["say3d",0];
65+
sleep 9;
66+
if (alive _unit) then {
67+
_bomb = createVehicle [_ammo, position _unit, [], 0, "CAN_COLLIDE"];
68+
[_unit, _bomb, "PressurePlate"] call ace_explosives_fnc_connectExplosive;
69+
sleep 3;
70+
[_unit,""] remoteExec ["switchMove",0];
71+
_pos = getPos _unit;
72+
_pos = [_unit, 0, 30] call BIS_fnc_findSafePos;
73+
_unit doMove _pos;
74+
};
75+
};
76+
77+
}, [_unit,_pos,_ammo], 60, {
78+
diag_log _this;
79+
// if (alive (_this select 0)) then {
80+
// "Unit took too long to place the IED" call fox_suicide_bomber_fnc_curatorMessage;
81+
[(_this select 0),""] remoteExec ["switchMove",0];
82+
// };
83+
}] call CBA_fnc_waitUntilAndExecute;
84+
}, {}, [_unit, _roads]
85+
] call zen_dialog_fnc_create;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
_bomber = param[0,objNull];
2+
3+
if ([_bomber] call fox_suicide_bomber_fnc_checkBomber) exitWith {};
4+
5+
_sounds = getArray(configFile >> "fox_suicice_bomber_settings" >> "sounds");
6+
7+
if (!isNil("fox_suicice_bomber_customSounds")) then {
8+
diag_log format[">>>[FOX] Suicice Bomber: Adding custom sounds: %1",str fox_suicice_bomber_customSounds];
9+
_sounds append fox_suicice_bomber_customSounds;
10+
};
11+
12+
_r = floor random count _sounds;
13+
[
14+
"Suicide Bomber",
15+
[
16+
["COMBO", "Sound", [_sounds, _sounds, _r]],
17+
["SIDES", "Side to Target", west],
18+
["SLIDER", "Search radius", [0, 500, 25, 0]],
19+
["CHECKBOX", "Fake Bomber", false],
20+
["CHECKBOX", "Only Deadman switch", false]
21+
],
22+
{
23+
(_this select 0) params ["_sound","_side","_radius","_isFakeBomber","_isOnlyDeadmanSwitch"];
24+
_bomber = (_this select 1) select 0;
25+
26+
_params = [_side,["LandVehicle","Man","Tank"], _radius];
27+
diag_log format["FN ARES: %1",str _this];
28+
if (_isFakeBomber) then {
29+
[_bomber] call fox_suicide_bomber_fnc_enableFakeBomber;
30+
};
31+
32+
if (_isOnlyDeadmanSwitch) then {
33+
[_bomber] call fox_suicide_bomber_fnc_setDeadmanSwitchOnly;
34+
};
35+
36+
[_bomber, _sound] call fox_suicide_bomber_fnc_setCustomSound;
37+
[_bomber,_params] call fox_suicide_bomber_fnc_setupBomber;
38+
}, {}, [_bomber]
39+
] call zen_dialog_fnc_create;

0 commit comments

Comments
 (0)