diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf index 28c5cb4..c0a195e 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf @@ -27,36 +27,38 @@ while {true} do { uiSleep 1; //diag_log format["mainThread:: -- > time = %1",diag_tickTime]; - if (diag_tickTime - _timer1sec > 1) then + if (diag_tickTime > _timer1sec) then { [] call blck_fnc_vehicleMonitor; #ifdef GRGserver [] call blck_fnc_broadcastServerFPS; #endif - _timer1sec = diag_tickTime; + _timer1sec = diag_tickTime + 1; + //diag_log format["[blckeagls] _fnc_mainThread 1 Second Timer Handled | Timstamp %1",diag_tickTime]; }; - if (diag_tickTime - _timer5sec > 5) then + if (diag_tickTime > _timer5sec) then { - _timer5sec = diag_tickTime; + _timer5sec = diag_tickTime + 5; [] call blck_fnc_missionGroupMonitor; [] call blck_fnc_sm_monitorStaticMissionUnits; //[] call blck_fnc_sm_checkForPlayerNearMission; + //diag_log format["[blckeagls] _fnc_mainThread 5 Second Timer Handled | Timstamp %1",diag_tickTime]; }; - if (diag_tickTime - _timer20sec > 20) then + if (diag_tickTime > _timer20sec) then { [] call blck_fnc_cleanupAliveAI; [] call blck_fnc_cleanupObjects; [] call blck_fnc_cleanupDeadAI; - _timer20sec = diag_tickTime; - //diag_log format["_mainThread::-->> 20 second events run: diag_tickTime = %1",diag_tickTime]; + _timer20sec = diag_tickTime + 20; + //diag_log format["[blckeagls] _fnc_mainThread 20 Second Timer Handled | Timstamp %1",diag_tickTime]; }; - if ((diag_tickTime - _timer1min) > 60) then + if ((diag_tickTime > _timer1min)) then { //diag_log format["_fnc_mainThread: 60 second events run at %1",diag_tickTime]; - _timer1min = diag_tickTime; + _timer1min = diag_tickTime + 60; //diag_log format["_fnc_mainThread: blck_missionsRunning = %1 | blck_maxSpawnedMissions = %2", blck_missionsRunning,blck_maxSpawnedMissions]; [] call blck_fnc_spawnPendingMissions; - diag_log format["_fnc_mainThread: blck_numberUnderwaterDynamicMissions = %1 | blck_dynamicUMS_MissionsRuning = %2",blck_numberUnderwaterDynamicMissions,blck_dynamicUMS_MissionsRuning]; + //diag_log format["_fnc_mainThread: blck_numberUnderwaterDynamicMissions = %1 | blck_dynamicUMS_MissionsRuning = %2",blck_numberUnderwaterDynamicMissions,blck_dynamicUMS_MissionsRuning]; if (blck_dynamicUMS_MissionsRuning < blck_numberUnderwaterDynamicMissions) then { //diag_log "Adding dynamic UMS Mission"; @@ -65,22 +67,22 @@ while {true} do //diag_log format["_fnc_mainThread: control returned to _fnc_mainThread from _fnc_addDynamicUMS_Mission at %1",diag_tickTime]; if (blck_useHC) then { - diag_log format["_mainThread:: calling blck_fnc_passToHCs at diag_tickTime = %1",diag_tickTime]; + //diag_log format["_mainThread:: calling blck_fnc_passToHCs at diag_tickTime = %1",diag_tickTime]; [] call blck_fnc_HC_passToHCs; }; - + if (blck_useTimeAcceleration) then + { + [] call blck_fnc_timeAcceleration; + }; #ifdef blck_debugMode //diag_log format["_fnc_mainThread: active SQFscripts include: %1",diag_activeSQFScripts]; diag_log format["_fnc_mainThread: active scripts include: %1",diag_activeScripts]; #endif + //diag_log format["[blckeagls] _fnc_mainThread 60 Second Timer Handled | Timstamp %1",diag_tickTime]; }; - if (diag_tickTime - _timer5min > 300) then + if (diag_tickTime > _timer5min) then { - diag_log format["[blckeagls] Dynamic Missions Running %1 | UMS Running %2 | Vehicles %3 | Groups %4 | Server FPS %5 | Server Uptime %6 Min | Missions Run %7",blck_missionsRunning,blck_dynamicUMS_MissionsRuning,count blck_monitoredVehicles,count blck_monitoredMissionAIGroups,diag_FPS,floor(diag_tickTime/60),blck_missionsRun]; - if (blck_useTimeAcceleration) then - { - _timer5min = diag_tickTime; - [] call blck_fnc_timeAcceleration; - }; + diag_log format["[blckeagls] Timstamp %8 |Dynamic Missions Running %1 | UMS Running %2 | Vehicles %3 | Groups %4 | Server FPS %5 | Server Uptime %6 Min | Missions Run %7",blck_missionsRunning,blck_dynamicUMS_MissionsRuning,count blck_monitoredVehicles,count blck_monitoredMissionAIGroups,diag_FPS,floor(diag_tickTime/60),blck_missionsRun, diag_tickTime]; + _timer5min = diag_tickTime + 300; }; }; diff --git a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HCmonitor.sqf b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HCmonitor.sqf index 8ba55e8..9dc9531 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HCmonitor.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HCmonitor.sqf @@ -31,7 +31,7 @@ diag_log "_fnc_HC_monitor.sqf"; }; if (diag_tickTime > _timer3min) then { - _timer3min = diag_tickTime _ 300; + _timer3min = diag_tickTime + 300; diag_log format["blckHC:: headless client %1 | time stamp %2 | %3 fps | _blckGroups = %4 _otherGroups = %5 | vehicles %6",clientOwner,diag_tickTime,diag_fps, count blck_HC_monitoredGroups,{ ((groupOwner _x) isEqualTo clientOwner) && !(_x getVariable["blck_group",true])} count allGroups, count blck_HC_monitoredVehicles ]; }; uiSleep 1; diff --git a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_passToHCs.sqf b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_passToHCs.sqf index 8d1b398..4c56ada 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_passToHCs.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_passToHCs.sqf @@ -1,41 +1,5 @@ -//if (!isServer) exitWith {}; -/* -blck_fnc_countGroupsAssigned = { - params["_HC"]; - private["_result"]; - _result = {(groupOwner _x) == (owner _HC)} count allGroups; - //diag_log format["_fnc_countGroupsAssigned = %1",_result]; - _result -}; -blck_fnc_leastBurdened = { - params["_HC_List"]; - private["_result","_fewestGroupsAssigned","_leastBurdened","_groupsAssigned"]; - if (count _HC_List == 0) exitWith {_result = objNull; _result}; - _fewestGroupsAssigned = [_HC_List select 0] call blck_fnc_countGroupsAssigned; - _leastBurdened = _HC_List select 0; - { - _groupsAssigned = [_x] call blck_fnc_countGroupsAssigned; - if (_groupsAssigned < _fewestGroupsAssigned) then - { - _leastBurdened = _x; - _fewestGroupsAssigned = _groupsAssigned; - }; - }forEach _HC_List; - //diag_log format["_fnc_leastBurdened:: _fewestGroupsAssigned = %1 and _leastBurdened = %2",_fewestGroupsAssigned,_leastBurdened]; - _leastBurdened -}; - - -blck_fnc_getListConnectedHCs = { - private _hcs = []; - { - if !(_x in _hcs) then {_hcs pushBack _x}; - }forEach entities "HeadlessClient_F"; - _hcs -}; -*/ -diag_log format["_fnc_passToHCs:: function called at server time %1",diag_tickTime]; +//diag_log format["_fnc_passToHCs:: function called at server time %1",diag_tickTime]; private["_numTransfered","_clientId","_allGroups","_groupsOwned","_idHC","_id","_swap","_rc"]; blck_connectedHCs = call blck_fnc_HC_getListConnected; diag_log format["_fnc_passToHCs:: blck_connectedHCs = %1 | count _HCs = %2 | server FPS = %3",blck_connectedHCs,count blck_connectedHCs,diag_fps]; @@ -52,6 +16,7 @@ if ( (count blck_connectedHCs) > 0) then { private _v = vehicle (leader _x); blck_monitoredVehicles = blck_monitoredVehicles - [_v]; + blck_HC_monitoredVehicles pushBack _v; }; //diag_log format["group belongs to blckeagls mission system so time to transfer it"]; if ((typeName _x) isEqualTo "GROUP") then @@ -63,16 +28,16 @@ if ( (count blck_connectedHCs) > 0) then //diag_log format["group %1 is already assigned to an HC with _id of %2",_x,_id]; _swap = false; } else { - diag_log format["group %1 should be moved to HC %2 with _idHC %3",_x,_idHC]; + //diag_log format["group %1 should be moved to HC %2 with _idHC %3",_x,_idHC]; _x setVariable["owner",owner _idHC]; _rc = _x setGroupOwner (owner _idHC); [_x] remoteExec["blck_fnc_HC_XferGroup",_idHC]; if ( _rc ) then { _numTransfered = _numTransfered + 1; - diag_log format["group %1 transferred to %2",_x, groupOwner _x]; + //diag_log format["group %1 transferred to %2",_x, groupOwner _x]; } else { - diag_log format["something went wrong with the transfer of group %1",_x]; + //diag_log format["something went wrong with the transfer of group %1",_x]; }; }; }; @@ -80,7 +45,7 @@ if ( (count blck_connectedHCs) > 0) then //diag_log format["group %1 does not belong to blckeagls mission system",_x]; }; } forEach (allGroups); - diag_log format["_passToHCs:: %1 groups transferred to HC %2",_numTransfered,_idHC]; + //diag_log format["_passToHCs:: %1 groups transferred to HC %2",_numTransfered,_idHC]; _numTransfered = 0; // Note : the owner of a vehicle is the owner of the driver so vehicles are automatically transferred to the HC when the group to which the driver is assigned is transferred. diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnPendingMissions.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnPendingMissions.sqf index d5ccbfe..c60bfaa 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnPendingMissions.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnPendingMissions.sqf @@ -48,7 +48,7 @@ if (blck_debugLevel > 2) then diag_log format["_fnc_spawnPendingMissions:: --- >> _readyToSpawnQue diag_tickTime %6 _marker %1 _difficulty %2 _tMin %3 _tMax %4 _waitTime %5",_readyToSpawnQue select 1, _readyToSpawnQue select 2, _readyToSpawnQue select 3, _readyToSpawnQue select 4, _readyToSpawnQue select 5, diag_tickTime]; }; #endif -diag_log format["_fnc_spawnPendingMissions: count _readyToSpawnQue = %1", count _readyToSpawnQue]; +//diag_log format["_fnc_spawnPendingMissions: count _readyToSpawnQue = %1", count _readyToSpawnQue]; if (count _readyToSpawnQue > 0) then { _missionToSpawn = selectRandom _readyToSpawnQue; diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf index 4661b96..5c8bc29 100644 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf @@ -20,7 +20,7 @@ if (_unit getVariable["blck_cleanupAt",-1] > 0) exitWith {}; //diag_log format["_fnc_processAIKills:: function called with _this = %1",_this]; _unit setVariable ["blck_cleanupAt", (diag_tickTime) + blck_bodyCleanUpTimer, true]; -diag_log format["_fnc_processAIKills: _unit = %1 | vehicle unit = %2",_unit, vehicle _unit]; +//diag_log format["_fnc_processAIKills: _unit = %1 | vehicle unit = %2",_unit, vehicle _unit]; /* if (_unit != (vehicle _unit) then { diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf index d14f4a1..d63588b 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf @@ -23,7 +23,18 @@ _vehList = +blck_monitoredVehicles; #ifdef blck_debugMode if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; #endif -diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles]; +//diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles]; + +// Check for any vehicles no longer on an HC +{ + if ( (owner _x) == 2) then + { + // vehicle no longer on headless client + blck_HC_monitoredVehicles - blck_HC_monitoredVehicles - [_x]; + blck_monitoredVehicles pushBack _x; + }; +} forEach blck_HC_monitoredVehicles; + { /* Determine state of vehicle