2016-03-23 11:05:19 +00:00
|
|
|
if (!isServer) exitWith {};
|
2016-04-12 10:14:07 +00:00
|
|
|
|
2016-04-02 19:06:53 +00:00
|
|
|
_logDetail = format ["[OCCUPATION Static]:: Starting Monitor"];
|
|
|
|
[_logDetail] call SC_fnc_log;
|
2016-03-23 11:05:19 +00:00
|
|
|
|
2016-04-12 10:14:07 +00:00
|
|
|
private["_wp","_wp2","_wp3"];
|
|
|
|
|
2016-04-02 19:06:53 +00:00
|
|
|
_middle = worldSize/2;
|
|
|
|
_spawnCenter = [_middle,_middle,0]; // Centre point for the map
|
|
|
|
_maxDistance = _middle; // Max radius for the map
|
2016-03-23 11:05:19 +00:00
|
|
|
|
|
|
|
_maxAIcount = SC_maxAIcount;
|
|
|
|
_minFPS = SC_minFPS;
|
|
|
|
_scaleAI = SC_scaleAI;
|
|
|
|
|
|
|
|
_currentPlayerCount = count playableUnits;
|
|
|
|
if(_currentPlayerCount > _scaleAI) then
|
|
|
|
{
|
|
|
|
_maxAIcount = _maxAIcount - (_currentPlayerCount - _scaleAI) ;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-04-27 00:05:03 +00:00
|
|
|
// Don't spawn additional AI if the server fps is below _minFPS
|
2016-04-02 19:06:53 +00:00
|
|
|
if(diag_fps < _minFPS) exitWith
|
|
|
|
{
|
|
|
|
_logDetail = format ["[OCCUPATION Static]:: Held off spawning more AI as the server FPS is only %1",diag_fps];
|
|
|
|
[_logDetail] call SC_fnc_log;
|
|
|
|
};
|
2016-03-23 11:05:19 +00:00
|
|
|
|
2016-05-12 12:44:47 +00:00
|
|
|
_aiActive = { !isPlayer _x } count allunits;
|
|
|
|
|
2016-04-02 19:06:53 +00:00
|
|
|
if(_aiActive > _maxAIcount) exitWith
|
|
|
|
{
|
|
|
|
_logDetail = format ["[OCCUPATION Static]:: %1 active AI, so not spawning AI this time",_aiActive];
|
|
|
|
[_logDetail] call SC_fnc_log;
|
|
|
|
};
|
2016-03-23 11:05:19 +00:00
|
|
|
|
2016-04-20 14:25:17 +00:00
|
|
|
// Create the static AI
|
|
|
|
if(!isNil "SC_staticBandits") then { [SC_staticBandits,"bandit"] call SC_fnc_spawnStatics; };
|
|
|
|
if(!isNil "SC_staticSurvivors") then { [SC_staticSurvivors,"survivor"] call SC_fnc_spawnStatics; };
|
2016-04-14 10:29:30 +00:00
|
|
|
|
2016-04-02 19:06:53 +00:00
|
|
|
_logDetail = "[OCCUPATION Static]: Ended";
|
|
|
|
[_logDetail] call SC_fnc_log;
|