GMS_RC/@GMS/addons/GMS/Compiles/Vehicles/fn_revealNearbyPlayers.sqf
Ghostrider [GRG] 7273521854 Build 275/Ver 7.21
Moved over to $prefix$ and labeled unused files
2023-10-31 21:57:49 -04:00

55 lines
1.6 KiB
Plaintext

/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\x\addons\GMS\Compiles\Init\GMS_defines.hpp"
params["_vehicle","_searchRadius","_detectionOdds"];
private["_player","_detectionOdds","_nearbyPlayers","_knowsAbout","_cansee","_knowledgeGained"];
_nearbyPlayers = [getPosATL _vehicle, _vehicle getVariable["GMS_vehicleSearchRange",500]] call GMSCore_fnc_nearestPlayers;
switch GMS_revealMode do {
case "detailed": {
private["_crew"];
_crew = crew _vehicle;
if !(_crew isequalto []) then {
{
if (random(1) < _detectionOdds) then {
_player = _x;
{
_cansee = [objNull, "VIEW"] checkVisibility [eyePos _x, getPosATL _player];
if (_cansee > 0) then {
_knowledgeGained = _cansee;
}
else {
_knowledgeGained = _x knowsAbout _player;
if (_knowledgeGained == 0) then {_knowledgeGained = 0.1};
};
_x reveal[_player,_knowledgeGained];
}forEach _crew;
};
}forEach _nearbyPlayers;
};
};
case "basic": {
{
_player = _x;
if (random(1) < _detectionOdds) then {
_knowsAbout = (_vehicle) knowsAbout _player;
if (_knowsAbout > 0) then {
_knowledgeGained = _knowsAbout;
}
else {
_knowledgeGained = (_searchRadius - (_x distance _vehicle))/_searchRadius;
};
_x reveal[_player, _knowledgeGained];
};
}forEach _nearbyPlayers;
};
};