summaryrefslogtreecommitdiffstats
path: root/Client/Module/UAV/uav_spotter.sqf
blob: b1b0b17d621722b760711957c0332562c32eff93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* 
	Author: Benny
	Name: uav_spotter.sqf
	Parameters:
	  0 - UAV
	Description:
	  This file handle the UAV 'spotting' ability. If the UAV knows about an hostile unit, it'll reveal it's average location on the map.
*/

Private ['_delay','_range','_sensitivity','_uav'];
_uav = _this select 0;
_delay = 'WFBE_UAVSPOTTINGDELAY' Call GetNamespace;
_range = 'WFBE_UAVSPOTTINGRANGE' Call GetNamespace;
_sensitivity = 'WFBE_UAVSPOTTINGDETECTION' Call GetNamespace;

while {true} do {
	sleep _delay;
	if (!alive _uav || isNull _uav) exitWith {};
	
	{
		if (_uav knowsAbout _x > _sensitivity && side _x != sideJoined && side _x != civilian) then {
			sleep (0.05 + random 0.05);
			WFBE_UAV_Reveal = [sideJoined,'CLTFNCUAV_REVEAL',[_uav,_x]];
			publicVariable 'WFBE_UAV_Reveal';
			if (isHostedServer) then {[sideJoined,'CLTFNCUAV_REVEAL',[_uav,_x]] Spawn HandlePVF};
		};
	} forEach (_uav nearEntities _range);
};