|
@@ -1,13 +1,16 @@
|
|
|
params["_args", "_handle"];
|
|
|
|
|
|
-_jammers = [] call rd501_jammersGetLocal;
|
|
|
+_jammers = [] call rd501_fnc_jammersGetLocal;
|
|
|
|
|
|
// Exit if jammer list is empty, remove PFH and rely on someone else calling it via jammer placement
|
|
|
if(!alive player || count _jammers == 0) exitWith {
|
|
|
- diag_log format["[RD501 Jammers] Exiting Client PFH with handle '%1', no jammers found", _handle];
|
|
|
+ diag_log format["[RD501 Jammers][Client PFH] Exiting Client PFH with handle '%1', no jammers found", _handle];
|
|
|
player setVariable ["rd501_jammers_pfh", -1];
|
|
|
- player setVariable ["tf_receivingDistanceMultiplicator", 1];
|
|
|
- player setVariable ["tf_sendingDistanceMultiplicator", 1];
|
|
|
+ player setVariable ["tf_receivingDistanceMultiplicator", nil];
|
|
|
+ player setVariable ["tf_sendingDistanceMultiplicator", nil];
|
|
|
+ private _sending = player getVariable ["tf_sendingDistanceMultiplicator", false];
|
|
|
+ private _receiving = player getVariable ["tf_receivingDistanceMultiplicator", false];
|
|
|
+ diag_log format["[RD501 Jammers][Client PFH] Sending: %1, Receiving: %2", _sending, _receiving];
|
|
|
[_handle] call CBA_fnc_removePerFrameHandler;
|
|
|
};
|
|
|
|
|
@@ -18,10 +21,10 @@ private _interference = 1;
|
|
|
if(!_active || _jammer == objNull || !alive _jammer) then {
|
|
|
if(_jammer == objNull || !alive _jammer) then
|
|
|
{
|
|
|
- diag_log format["[RD501 Jammers] Pruning undefined jammer '%1'", _jammer];
|
|
|
+ diag_log format["[RD501 Jammers][Client PFH] Pruning undefined jammer '%1'", _jammer];
|
|
|
_jammers set [_foreachIndex, []];
|
|
|
};
|
|
|
- diag_log format["[RD501 Jammers] Skipping inactive, dead or null jammer '%1'", _jammer];
|
|
|
+ diag_log format["[RD501 Jammers][Client PFH] Skipping inactive, dead or null jammer '%1'", _jammer];
|
|
|
}
|
|
|
else {
|
|
|
private _interferenceFactor = missionNamespace getVariable ["rd501_jammersInterferenceFactor", 0.625];
|
|
@@ -30,17 +33,19 @@ private _interference = 1;
|
|
|
private _d = _distance/_radius;
|
|
|
private _specificSignal = 1/(1 + ((_d/(1 -_d)) ^ -2.3));
|
|
|
private _specificInterference = _strength * (1 - _specificSignal) * _interferenceFactor;
|
|
|
- if(_interference == 1) then {
|
|
|
+ if(_interference != 1) then {
|
|
|
+ _interference = _interference max _specificInterference;
|
|
|
+ if(_interference < 1) then {
|
|
|
+ _interference = 1; //prevent 0 from being final value
|
|
|
+ };
|
|
|
+ if(_interference > _strength) then {
|
|
|
+ _interference = _strength; // prevent tfar from being exposed to 1.6e^24 when distance is null
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
_interference = _specificInterference;
|
|
|
- continue;
|
|
|
- };
|
|
|
- _interference = _interference max _specificInterference;
|
|
|
- if(_interference < 1) then {
|
|
|
- _interference = 1; //prevent 0 from being final value
|
|
|
};
|
|
|
- if(_interference > _strength) then {
|
|
|
- _interference = _strength; // prevent tfar from being exposed to 1.6e^24 when distance is null
|
|
|
- }
|
|
|
};
|
|
|
};
|
|
|
} forEach _jammers;
|
|
@@ -48,9 +53,7 @@ private _interference = 1;
|
|
|
_jammers = _jammers - [[]]; // remove empty jammers
|
|
|
|
|
|
// Set interference locally
|
|
|
-if(_interference != 1) then {
|
|
|
- diag_log format["[RD501 Jammers] Experiencing Interference '%1'", _interference];
|
|
|
-};
|
|
|
+
|
|
|
player setVariable ["tf_receivingDistanceMultiplicator", _interference];
|
|
|
player setVariable ["tf_sendingDistanceMultiplicator", 1/_interference];
|
|
|
|
|
@@ -64,7 +67,9 @@ if(_name in _names) then {
|
|
|
localNamespace setVariable["rd501_jammers_rateLimit", _rateLimit];
|
|
|
if(_rateLimit % 16 == 0 || _rateLimit == 1) then
|
|
|
{
|
|
|
+ localNamespace setVariable ["rd501_jammers_rateLimit", _rateLimit];
|
|
|
private _message = format["Interference: %1", _interference];
|
|
|
+ diag_log format["[RD501 Jammers][Client PFH] Displaying '%1' to player", _message];
|
|
|
[_message, true, 4, 4] call ace_common_fnc_displayText;
|
|
|
}
|
|
|
};
|