add emp functionality
This commit is contained in:
39
framework/emp/functions/fn_deploy.sqf
Normal file
39
framework/emp/functions/fn_deploy.sqf
Normal file
@@ -0,0 +1,39 @@
|
||||
// this script is used in a trigger and run on all machines.
|
||||
// it is used to simulate the effects of an EMP bomb on all objects within a certain radius of the trigger
|
||||
|
||||
// safeguards have been put in place so that "Local Argument" commands are only processed on the machine that owns the object
|
||||
// this is important because the results of these commands are not reliable if the object is not local
|
||||
|
||||
// the playSound3D command has been modified to only play the sound on this local machine for every non-man object. This way, the many machines running this function are not propagating duplicate sound instances to each other all at once.
|
||||
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
//get center and radius
|
||||
params [["_center",objNull],["_rad",200]];
|
||||
|
||||
private _objectsToAffect = [_center, _rad] call FUNC(getAffectedObjects);
|
||||
|
||||
{
|
||||
// sleep to add aesthetic
|
||||
sleep GVAR(timeBetweenEntities);
|
||||
|
||||
[{
|
||||
params ["_obj"];
|
||||
|
||||
// local flicker light effect
|
||||
[_obj] remoteExecCall [QFUNC(flickerLights), 0];
|
||||
|
||||
// playSound3D from server (running this code) to all clients
|
||||
[_obj] call FUNC(playZapServer);
|
||||
|
||||
// process these if our machine owns the object, since many of the commands require local arguments
|
||||
// the results of these commands are not reliable if the object is not local
|
||||
[_obj] remoteExecCall [QFUNC(applyLocalUnitEffects), _obj];
|
||||
|
||||
// these are group-related commands that should be run where group is local
|
||||
[group _obj] remoteExecCall [QFUNC(applyLocalGroupEffects), group _obj];
|
||||
|
||||
}, [_x]] call CBA_fnc_directCall;
|
||||
} forEach _objectsToAffect;
|
||||
Reference in New Issue
Block a user