35 lines
1.1 KiB
Plaintext
35 lines
1.1 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
// This function is used to deploy an EMP device and trigger the EMP effects on all machines
|
|
// The EMP effect is triggered by the global event "QGVAR(event_empDeployed)"
|
|
// This function should be called on the server
|
|
|
|
if (!isServer) exitWith {};
|
|
|
|
//get center and radius
|
|
params [["_origin", objNull, [[], objNull]],["_rad",1500, [300]]];
|
|
|
|
if (_origin isEqualType []) then {
|
|
if (count _origin != 3) exitWith {
|
|
["Invalid origin position provided (%1)", _origin] call BIS_fnc_error;
|
|
};
|
|
};
|
|
|
|
if (_origin isEqualType objNull) then {
|
|
if (isNull _origin) exitWith {
|
|
["No origin object or position provided (%1)", _origin] call BIS_fnc_error;
|
|
};
|
|
_origin = getPosASL _origin;
|
|
};
|
|
|
|
private _objectsToAffect = [_origin, _rad] call FUNC(getObjectsToAffect);
|
|
|
|
// for groups, deduplicate and get AI groups only
|
|
private _groupsToAffect = _objectsToAffect apply {group _x};
|
|
_groupsToAffect = _groupsToAffect arrayIntersect _groupsToAffect;
|
|
_groupsToAffect = _groupsToAffect select {!isPlayer (leader _x)};
|
|
|
|
|
|
[QGVAR(event_empDeployed), [_origin, _objectsToAffect, _groupsToAffect]] call CBA_fnc_globalEvent;
|
|
|
|
true; |