DMS_Exile/@ExileServer/addons/a3_dms/scripts/fn_IsPlayerNearby.sqf

47 lines
793 B
Plaintext
Raw Normal View History

2015-09-05 06:03:20 +00:00
/*
DMS_fnc_IsPlayerNearby
Created by eraser1
Usage:
[
_positionOrObject,
_distance
] call DMS_fnc_IsPlayerNearby;
Returns whether or not a player is within "_distance" meters of "_positionOrObject".
*/
private ["_pos", "_dis", "_isNear"];
_OK = params
[
["_pos", "", [objNull,[]], [2,3]],
["_dis", 0, [0]]
];
if (!_OK) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_IsPlayerNearby with invalid parameters: %1",_this];
};
_isNear = false;
try
{
{
{
if (isPlayer _x) then
{
throw _x;
};
} forEach (crew _x);
} forEach (_pos nearEntities [["Exile_Unit_Player","LandVehicle", "Air", "Ship"], _dis]);
}
catch
{
_isNear = true;
Readme changes, new debug fnc, fixes, tweaks Created disclaimer for DMS. Now mentioning that HC for DMS isn't that good. Some structure stuff in readme (let's see if it works lol) * **NEW CONFIG VALUE: DMS_Use_Map_Config** * You can now overwrite "main config values" with map-specific config values located in the new "map_configs" folder. This should allow you to use one DMS PBO if you have multiple servers with different maps. Included examples for Altis, Bornholm, Esseker, and Tavi (Taviana). * Because of the above implementation, DMS by default will not include the salt flats blacklist for findSafePos. In addition, it is preconfigured to the hilly terrains in Esseker and Taviana, as well as reducing all of the blacklist distances due to the smaller map size in Esseker. * Created new function "DMS_fnc_DebugLog". All DMS files (that produced debug logs) have been changed, including mission files. However, updating them is not important (and completely pointless if you don't even use DMS_DEBUG). * Fixed a few locations where it said "sized" instead of "seized". Thanks to [icomrade](https://github.com/icomrade) for pointing them out. * DMS now utilizes the "ARMA_LOG" DLL (if it exists) by infiSTAR to produce debug logs (if enabled). All debug logs now also include server uptime (in seconds) and server FPS. * The FSM no longer produces debug logs. * AI Locality manager will now run every minute. * Debug logs for "DMS_fnc_MissionsMonitor" will only output the mission name and the position, instead of all of the parameters. * "DMS_fnc_IsNearWater" will now check the provided position itself for water. * "DMS_fnc_IsValidPosition" will now do a surfaceNormal check within a 5 meter radius of the provided position as well. * "_customGearSet" should now actually work for "DMS_fnc_SpawnAISoldier", and the function title comment has been updated for the slightly tweaked syntax.
2015-10-10 01:35:07 +00:00
(format ["IsPlayerNearby :: %1 is within %2 meters of %3!",_exception,_dis,_pos]) call DMS_fnc_DebugLog;
2015-09-05 06:03:20 +00:00
};
_isNear;