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.
78 lines
3.9 KiB
Plaintext
78 lines
3.9 KiB
Plaintext
/*
|
|
DMS_fnc_FindSafePos
|
|
Created by eraser1
|
|
|
|
|
|
ALL PARAMETERS ARE OPTIONAL (as long as configs are properly defined).
|
|
Excluding parameters will create some RPT spam, but it's not too much of an issue.
|
|
|
|
Usage:
|
|
[
|
|
_nearestObjectMinDistance, // NUMBER (distance): Minimum distance from the nearest object.
|
|
_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.
|
|
_throttleParams // BOOLEAN: Whether or not some of the distance values should be throttled on repeated attempts.
|
|
] call DMS_fnc_findSafePos;
|
|
*/
|
|
|
|
|
|
private ["_nearestObjectMinDistance", "_waterNearLimit", "_maxSurfaceNormal", "_spawnZoneNearLimit", "_traderZoneNearLimit", "_missionNearLimit", "_playerNearLimit", "_throttleParams", "_safePosParams", "_validspot", "_attempts", "_pos"];
|
|
|
|
params
|
|
[
|
|
["_nearestObjectMinDistance", 25, [0] ],
|
|
["_waterNearLimit", DMS_WaterNearBlacklist, [0] ],
|
|
["_maxSurfaceNormal", DMS_MaxSurfaceNormal, [0] ],
|
|
["_spawnZoneNearLimit", DMS_SpawnZoneNearBlacklist, [0] ],
|
|
["_traderZoneNearLimit", DMS_TraderZoneNearBlacklist,[0] ],
|
|
["_missionNearLimit", DMS_MissionNearBlacklist, [0] ],
|
|
["_playerNearLimit", DMS_PlayerNearBlacklist, [0] ],
|
|
["_throttleParams", DMS_ThrottleBlacklists, [true]]
|
|
];
|
|
|
|
|
|
// Some custom maps don't have the proper safePos config entries.
|
|
// If you are using one and you have an issue with mission spawns, please create an issue on GitHub or post a comment in the DMS thread.
|
|
switch (toLower worldName) do
|
|
{
|
|
case "altis": { _safePosParams = [[16000,16000],0,16000]; }; // [16000,16000] w/ radius of 16000 works well for Altis
|
|
case "bornholm": { _safePosParams = [[11265,11265],0,12000]; }; // Thanks to thirdhero for testing this info
|
|
case "esseker": { _safePosParams = [[6275,6350,0],0,5000]; }; // Thanks to Flowrider for this info
|
|
case "tavi": { _safePosParams = [[12800,12800],0,12800]; }; // Thanks to JamieKG for this info
|
|
default { _safePosParams = [[],0,-1]; }; // Use default BIS_fnc_findSafePos methods for finding map center (worldSize)
|
|
};
|
|
|
|
_safePosParams append [_nearestObjectMinDistance,0,9999,0,DMS_findSafePosBlacklist];
|
|
|
|
|
|
_validspot = false;
|
|
_attempts = 0;
|
|
|
|
while{!_validspot} do
|
|
{
|
|
_pos = _safePosParams call BIS_fnc_findSafePos;
|
|
_attempts = _attempts+1;
|
|
|
|
// It will only throttle the missionNear blacklist and playerNear limits because those are the most likely to throw an exception.
|
|
// The throttling works by decreasing the parameters by 10% every 15 attempts, until it reaches 100 meters (by default).
|
|
if (_throttleParams && {(_attempts>=DMS_AttemptsUntilThrottle) && {(_attempts%DMS_AttemptsUntilThrottle)==0}}) then
|
|
{
|
|
_missionNearLimit = (DMS_ThrottleCoefficient * _missionNearLimit) max DMS_MinThrottledDistance;
|
|
_playerNearLimit = (DMS_ThrottleCoefficient * _playerNearLimit) max DMS_MinThrottledDistance;
|
|
|
|
(format ["FindSafePos :: Throttling _missionNearLimit to %1 and _playerNearLimit to %2 after %3 failed attempts to find a safe position! FPS: %4",_missionNearLimit,_playerNearLimit,_attempts,diag_fps]) call DMS_fnc_DebugLog;
|
|
};
|
|
|
|
_validspot = [_pos, _waterNearLimit, _maxSurfaceNormal, _spawnZoneNearLimit, _traderZoneNearLimit, _missionNearLimit, _playerNearLimit] call DMS_fnc_IsValidPosition;
|
|
};
|
|
|
|
|
|
(format["FindSafePos :: Found mission position %1 with %2 params in %3 attempts. _this: %4",_pos,_safePosParams,_attempts,_this]) call DMS_fnc_DebugLog;
|
|
|
|
|
|
_pos set [2, 0];
|
|
_pos; |