mirror of
https://github.com/Defent/DMS_Exile.git
synced 2024-08-30 16:52:12 +00:00
0544cfe9e7
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.
106 lines
3.2 KiB
Plaintext
106 lines
3.2 KiB
Plaintext
/*
|
|
DMS_fnc_IsValidPosition
|
|
Created by eraser1
|
|
|
|
Usage:
|
|
[
|
|
_pos, // ARRAY (position): The position to check.
|
|
_waterNearLimit, // NUMBER (distance): Minimum distance from water.
|
|
_maxSurfaceNormal, // NUMBER (between 0-1): Maximum "surfaceNormal"; Basically determines how steep a position is. Check the comment for config value "DMS_MaxSurfaceNormal" in config.sqf for more info
|
|
_spawnZoneNearLimit, // NUMBER (distance): Minimum distance from a spawn point.
|
|
_traderZoneNearLimit, // NUMBER (distance): Minimum distance from a trader zone.
|
|
_missionNearLimit, // NUMBER (distance): Minimum distance from another mission.
|
|
_playerNearLimit, // NUMBER (distance): Minimum distance from a player.
|
|
] call DMS_fnc_IsValidPosition;
|
|
|
|
|
|
|
|
*/
|
|
|
|
private ["_pos", "_waterNearLimit", "_maxSurfaceNormal", "_spawnZoneNearLimit", "_traderZoneNearLimit", "_missionNearLimit", "_playerNearLimit", "_dir"];
|
|
|
|
_OK = params
|
|
[
|
|
["_pos", [0,0,0], [[]], [2,3]],
|
|
["_waterNearLimit", DMS_WaterNearBlacklist, [0] ],
|
|
["_maxSurfaceNormal", DMS_MaxSurfaceNormal, [0] ],
|
|
["_spawnZoneNearLimit", DMS_SpawnZoneNearBlacklist, [0] ],
|
|
["_traderZoneNearLimit", DMS_TraderZoneNearBlacklist,[0] ],
|
|
["_missionNearLimit", DMS_MissionNearBlacklist, [0] ],
|
|
["_playerNearLimit", DMS_PlayerNearBlacklist, [0] ]
|
|
];
|
|
|
|
|
|
_isValidPos = false;
|
|
|
|
if (!_OK) then
|
|
{
|
|
diag_log format ["DMS ERROR :: Calling DMS_fnc_isValidPosition with invalid parameters: %1",_this];
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
// Check for nearby water
|
|
if ((_waterNearLimit>0) && {[_pos,_waterNearLimit] call DMS_fnc_isNearWater}) then
|
|
{
|
|
throw ("water");
|
|
};
|
|
|
|
// Terrain steepness check
|
|
if (((surfaceNormal _pos) select 2)<_maxSurfaceNormal) then
|
|
{
|
|
throw ("a steep location");
|
|
|
|
// Check the surrounding area (within 5 meters)
|
|
for "_dir" from 0 to 359 step 45 do
|
|
{
|
|
if (((surfaceNormal ([_position,5,_dir] call DMS_fnc_SelectOffsetPos)) select 2)<_maxSurfaceNormal) then
|
|
{
|
|
throw ("a nearby steep location");
|
|
};
|
|
};
|
|
};
|
|
|
|
{
|
|
// Check for nearby spawn points
|
|
if ((_spawnZoneNearLimit>0) && {((markertype _x) == "ExileSpawnZone") && {((getMarkerPos _x) distance2D _pos)<=_spawnZoneNearLimit}}) then
|
|
{
|
|
throw ("a spawn zone");
|
|
};
|
|
|
|
// Check for nearby trader zones
|
|
if ((_traderZoneNearLimit>0) && {((markertype _x) == "ExileTraderZone") && {((getMarkerPos _x) distance2D _pos)<=_traderZoneNearLimit}}) then
|
|
{
|
|
throw ("a trader zone");
|
|
};
|
|
|
|
// Check for nearby missions
|
|
if (_missionNearLimit>0) then
|
|
{
|
|
_missionPos = missionNamespace getVariable [format ["%1_pos",_x], []];
|
|
if (!(_missionPos isEqualTo []) && {(_missionPos distance2D _pos)<=_missionNearLimit}) then
|
|
{
|
|
throw ("another mission");
|
|
};
|
|
};
|
|
} forEach allMapMarkers;
|
|
|
|
// Check for nearby players
|
|
// This is done last because it is likely to be the most resource intensive.
|
|
if ((_playerNearLimit>0) && {[_pos,_playerNearLimit] call DMS_fnc_IsPlayerNearby}) then
|
|
{
|
|
throw ("players");
|
|
};
|
|
|
|
// No exceptions found
|
|
_isValidPos = true;
|
|
}
|
|
catch
|
|
{
|
|
(format ["IsValidPosition :: Exception in attempt %1 | Position %2 is too close to %3!",_attempts,_pos,_exception]) call DMS_fnc_DebugLog;
|
|
};
|
|
};
|
|
|
|
|
|
_isValidPos; |