Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private _jammerClassname = "Sania"; // Compatibilidad antigua
- [] spawn {
- private _jammerClassnames = ["Sania", "Sania_with_tripod_BLU", "Sania_with_tripod_RED"];
- private _detectedJammers = [];
- while {true} do {
- private _jammers = [];
- {
- _jammers = _jammers + allMissionObjects _x;
- } forEach _jammerClassnames;
- {
- if (!(_x in _detectedJammers)) then {
- _detectedJammers pushBack _x;
- };
- } forEach _jammers;
- {
- private _isActive = _x getVariable ["DB_jammer_isActive", false];
- private _wasActive = _x getVariable ["DB_jammer_lastActiveState", false];
- if (_isActive != _wasActive) then {
- _x setVariable ["DB_jammer_lastActiveState", _isActive];
- };
- if (_isActive) then {
- _x setVariable ["isGPSJammer", true, true];
- _x setVariable ["jamRadius", 16000, true];
- _x setVariable ["jamSuccess", 1.0, true];
- private _jammerPos = getPosATL _x;
- private _radius = _x getVariable ["jamRadius", 12000];
- private _chance = _x getVariable ["jamSuccess", 0.6];
- private _projList = nearestObjects [_jammerPos, ["MissileBase", "BombCore", "SubmunitionBase"], _radius];
- {
- private _proj = _x;
- private _projType = typeOf _proj;
- if (!isNil "GPSJam_ValidBombs" && {_projType in GPSJam_ValidBombs}) then {
- if (isNil {_proj getVariable "gpsJammed"}) then {
- private _rand = random 1;
- if (_rand < _chance) then {
- _proj setVariable ["gpsJammed", true, true];
- _proj setVariable ["ITGT_TARGET", nil, true];
- _proj setVariable ["FIR_ITGT_TARGET_POS", nil, true];
- _proj setVariable ["FIR_GUIDANCE_ENABLED", false, true];
- // 🔊 BUSCAR ALTAVOZ Y SONAR SIRENA
- private _nearbyLoudspeakers = nearestObjects [_jammerPos, ["Land_Loudspeakers_F"], 2000];
- if (count _nearbyLoudspeakers > 0) then {
- private _speaker = _nearbyLoudspeakers select 0;
- [_speaker] remoteExec ["FR_fnc_playJammerSiren", 0];
- };
- // Desviación de la bomba
- [_proj, _jammerPos, _radius] spawn {
- params ["_bomb", "_jammerPos", "_radius"];
- while {!isNull _bomb} do {
- private _pos = getPosATL _bomb;
- private _dist = _pos distance _jammerPos;
- private _alt = _pos select 2;
- if (_dist <= _radius && _alt <= 3000) then {
- private _intensity = 1 - (_alt / 3000);
- private _velX = (random 2 - 1) * _intensity;
- private _velY = (random 2 - 1) * _intensity;
- private _velZ = -40 * _intensity;
- private _forceX = ((random 100) - 50) * _intensity * 3;
- private _forceY = ((random 100) - 50) * _intensity * 3;
- private _forceZ = -300 * _intensity;
- _bomb setVelocity [_velX, _velY, _velZ];
- _bomb setVectorDirAndUp [[_velX, _velY, -1], [0, 1, 0]];
- _bomb addForce [[_forceX, _forceY, _forceZ], [0, 0, 0]];
- _bomb setPosATL (_pos vectorAdd [_velX, _velY, -0.5 * _intensity]);
- _bomb setVariable ["ITGT_TARGET", nil, true];
- _bomb setVariable ["FIR_ITGT_TARGET_POS", nil, true];
- _bomb setVariable ["FIR_GUIDANCE_ENABLED", false, true];
- };
- sleep 0.1;
- };
- };
- };
- };
- };
- } forEach _projList;
- } else {
- _x setVariable ["isGPSJammer", false, true];
- };
- } forEach _jammers;
- sleep 1.2;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement