Update GMS_fnc_mainThread.sqf

Added a q-5 second loop.
Moved calls to the vehicleMonitor to occur every 5 seconds in the main loop.
Fixed an issue wherein the elements for live AI and mission vehicles were not being deleted from their respective arrays after the corresponding 'vehicles' were deleted.
This commit is contained in:
Ghostrider-DbD- 2017-01-12 04:31:12 -05:00 committed by GitHub
parent 9d746144fc
commit 0195ac0190

View File

@ -10,40 +10,52 @@
private ["_index","_timer10Min","_timer1min","_timer5min","_modType"]; private ["_index","_timer10Min","_timer1min","_timer5min","_modType"];
_index = 0; _index = 0;
//_timeAccelUpdated = diag_tickTime; _timer5sec = diag_tickTime;
_timer1min = diag_tickTime; _timer1min = diag_tickTime;
_timer5min = diag_tickTime; _timer5min = diag_tickTime;
_timer10Min = diag_tickTime; _timer10Min = diag_tickTime;
_modType = [] call blck_fnc_getModType; _modType = [] call blck_fnc_getModType;
_ai = [];
_obj = [];
while {true} do while {true} do
{ {
uiSleep blck_mainThreadUpdateInterval; uiSleep blck_mainThreadUpdateInterval; // defined in custom_server\compiles\blck_variables.sqf
if ((diag_tickTime - _timer5sec) > 5) then
{
[] call blck_fnc_vehicleMonitor;
_timer5sec = diag_tickTime;
};
if ((diag_tickTime - _timer1min) > 60) then if ((diag_tickTime - _timer1min) > 60) then
{ {
_ai = blck_liveMissionAI;
{ {
if (diag_tickTime > (_x select 1) ) then { if (diag_tickTime > (_x select 1) ) then {
//diag_log format["_fnc_mainTread:: cleaning up AI group %1",_x]; //diag_log format["_fnc_mainTread:: cleaning up AI group %1",_x];
[_x select 0] call blck_fnc_cleanupAliveAI; [_x select 0] call blck_fnc_cleanupAliveAI;
}; };
}forEach blck_liveMissionAI; blck_liveMissionAI = blck_liveMissionAI - _x; // Remove that list of live AI from the list.
}forEach _ai;
_obj = blck_oldMissionObjects;
{ {
//diag_log format["mainThread::-->> missionObjects _x = %1",_x]; //diag_log format["mainThread::-->> missionObjects _x = %1",_x];
if (diag_tickTime > (_x select 1) ) then { if (diag_tickTime > (_x select 1) ) then {
//diag_log format["_fnc_mainTread:: cleaning up mission objects %1",_x]; //diag_log format["_fnc_mainTread:: cleaning up mission objects %1",_x];
[_x select 0] call blck_fnc_cleanupObjects; [_x select 0] call blck_fnc_cleanupObjects;
}; };
}forEach blck_oldMissionObjects; blck_oldMissionObjects = blck_oldMissionObjects - _x;
}forEach _obj;
[] call GMS_fnc_cleanupDeadAI; [] call GMS_fnc_cleanupDeadAI;
if (_modType isEqualTo "Epoch") then { if (_modType isEqualTo "Epoch") then {
//diag_log "calling blck_fnc_cleanEmptyGroups"; //diag_log "calling blck_fnc_cleanEmptyGroups";
[] spawn blck_fnc_cleanEmptyGroups; [] call blck_fnc_cleanEmptyGroups;
}; // Exile cleans up empty groups automatically so this should not be needed with that mod. }; // Exile cleans up empty groups automatically so this should not be needed with that mod.
{ {
//diag_log format["_fnc_mainThread:: -- >> _x = %1 and _x select 6 = %2",_x, _x select 6]; if (blck_debugLevel > 2) then {diag_log format["_fnc_mainThread:: -- >> _x = %1 and _x select 6 = %2",_x, _x select 6];};
if (_x select 6 > 0) then // The mission is not running, check the time left till it is spawned if (_x select 6 > 0) then // The mission is not running, check the time left till it is spawned
{ {
if (diag_tickTime > (_x select 6)) then // time to spawn the mission if (diag_tickTime > (_x select 6)) then // time to spawn the mission
@ -54,7 +66,7 @@ while {true} do
private["_markerClass","_missionName","_missionPath","_aiDifficultyLevel"]; private["_markerClass","_missionName","_missionPath","_aiDifficultyLevel"];
//diag_log format["_fnc_mainThread:: -->> _missionClass would = %1%2",_x select 2, _index]; //diag_log format["_fnc_mainThread:: -->> _missionClass would = %1%2",_x select 2, _index];
_markerClass = _x select 2; _markerClass = _x select 2;
//diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass]; if (blck_debugLevel > 2) then {diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass];};
_aiDifficultyLevel = _x select 4; _aiDifficultyLevel = _x select 4;
_missionName = selectRandom (_x select 0); _missionName = selectRandom (_x select 0);
_missionPath = _x select 1; _missionPath = _x select 1;
@ -64,14 +76,12 @@ while {true} do
}; };
}; };
}forEach blck_pendingMissions; }forEach blck_pendingMissions;
_timer1min = diag_tickTime;
_timer1min = diag_tickTime;
}; };
if ((diag_tickTime - _timer5min) > 300) then { if ((diag_tickTime - _timer5min) > 300) then {
if (blck_timeAcceleration) then { if (blck_timeAcceleration) then
{
//if (blck_debugON) then {diag_log "[blckeagls] calling time acceleration module";}; //if (blck_debugON) then {diag_log "[blckeagls] calling time acceleration module";};
[] call blck_fnc_timeAcceleration; [] call blck_fnc_timeAcceleration;
}; };
@ -86,8 +96,4 @@ while {true} do
_timer10Min = diag_tickTime; _timer10Min = diag_tickTime;
}; };
*/ */
}; };