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

47 lines
1.3 KiB
Plaintext
Raw Normal View History

2015-09-01 23:23:32 +00:00
/*
DMS_fnc_AILocalityManager
2015-09-01 23:23:32 +00:00
Created by Defent and eraser1
Offloads AI groups to a nearby client or HC in order to improve server performance.
2015-09-01 23:23:32 +00:00
*/
if (!DMS_ai_offload_to_client && {isNull DMS_HC_Object}) exitWith {};
2015-09-01 23:23:32 +00:00
{
if (((count (units _x))>1) && {!((DMS_ai_offload_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])}) || {(_x getVariable ["DMS_LockLocality",false])})}) then
2015-09-01 23:23:32 +00:00
{
private ["_leader", "_group", "_owner"];
_leader = leader _x;
_group = _x;
if ((!isNull _leader) && {(alive _leader) && {!isPlayer _leader}}) then
{
2015-09-02 17:16:22 +00:00
if (isNull DMS_HC_Object) then
2015-09-01 23:23:32 +00:00
{
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 ["AILocalityManager :: DMS_HC_Object is null! Finding owner for group: %1",_group]) call DMS_fnc_DebugLog;
2015-09-02 17:16:22 +00:00
_owner = objNull;
2015-09-01 23:23:32 +00:00
{
2015-09-02 17:16:22 +00:00
if ((groupOwner _group) isEqualTo (owner _x)) exitWith
{
_owner = _x;
};
2015-09-04 16:35:19 +00:00
} forEach allPlayers;
2015-09-01 23:23:32 +00:00
2015-09-02 17:16:22 +00:00
if ((isNull _owner) || {(_owner distance2D _leader)>3500}) then
{
[_group,_leader] call DMS_fnc_SetAILocality;
2015-09-02 17:16:22 +00:00
};
}
else
2015-09-01 23:23:32 +00:00
{
if !((groupOwner _group) isEqualTo (owner DMS_HC_Object)) then
2015-09-02 17:16:22 +00:00
{
_transferSuccess = _group setGroupOwner (owner DMS_HC_Object);
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 ["AILocalityManager :: Setting ownership of group %1 to HC (%2). Success: %3",_group,DMS_HC_Object,_transferSuccess]) call DMS_fnc_DebugLog;
2015-09-02 17:16:22 +00:00
};
2015-09-01 23:23:32 +00:00
};
};
};
2015-09-04 16:35:19 +00:00
} forEach allGroups;