add counter for instance number; coding tweaks

This commit is contained in:
Chris Cardozo 2020-10-03 08:09:20 -04:00
parent ceec5c2af4
commit 2de977392b

View File

@ -8,6 +8,8 @@
#define noActive 2
#define waitTime 5
blck_activeMonitorThreads = blck_activeMonitorThreads + 1;
for "_i" from 1 to (count blck_activeMissionsList) do
{
@ -126,9 +128,10 @@ for "_i" from 1 to (count blck_activeMissionsList) do
_monitorAction = 1;
};
};
switch (_monitorAction) do
{
// Handle Timeout
case -1:
{
@ -250,7 +253,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
uisleep 3;
if (count _garrisonedBuilding_ATLsystem > 0) then // Note that there is no error checking here for nulGroups
if !(_garrisonedBuilding_ATLsystem isEqualTo []) then // Note that there is no error checking here for nulGroups
{
private _temp = [_coords, _garrisonedBuilding_ATLsystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_ATLsystem;
if (_temp isEqualTo grpNull) then {throw 1} else
@ -263,7 +266,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
uiSleep 3;
if (count _garrisonedBuildings_BuildingPosnSystem > 0) then
if !(_garrisonedBuildings_BuildingPosnSystem isEqualTo []) then
{
private _temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_RelPosSystem;
if (_temp isEqualTo grpNull) then {throw 1} else
@ -277,12 +280,13 @@ for "_i" from 1 to (count blck_activeMissionsList) do
uiSleep 15;
private _userelativepos = true;
private _noEmplacedWeapons = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
if (blck_useStatic && ((_noEmplacedWeapons > 0) || count _missionEmplacedWeapons > 0)) then
private _emplacedWeaponsThisMission = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
//[format["_monitorInitializedMissions(284): _noEmplacedWeapons = %1 | _emplacedWeaponsThisMission = %2 | _missionEmplacedWeapons = %3",_noEmplacedWeapons,_emplacedWeaponsThisMission,_missionEmplacedWeapons]] call blck_fnc_log;
if (blck_useStatic && ((_emplacedWeaponsThisMission > 0) || !(_missionEmplacedWeapons isEqualTo []))) then
// TODO: add error checks for grpNull to the emplaced weapon spawner
{
private _temp = [_coords,_missionEmplacedWeapons,_userelativepos,_noEmplacedWeapons,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
private _temp = [_coords,_missionEmplacedWeapons,_userelativepos,_emplacedWeaponsThisMission,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
if (_temp isEqualTo grpNull) then {throw 1} else
{
_objects append (_temp select 0);
@ -291,29 +295,29 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
uisleep 10;
private _noVehiclePatrols = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
if (blck_useVehiclePatrols && ((_noVehiclePatrols > 0) || !(_missionPatrolVehicles isEqualTo []))) then
private _noPatrols = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
//diag_log format["_monitorInitializeMissions(299): __noVehiclePatrols %1 | _noPatrols %2 | _missionPatrolVehicles %3",_noVehiclePatrols,_noPatrols,_missionPatrolVehicles];
if (blck_useVehiclePatrols && ((_noPatrols > 0) || !(_missionPatrolVehicles isEqualTo []))) then
{
_temp = [_coords,_noVehiclePatrols,_difficulty,_missionPatrolVehicles,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;
_temp = [_coords,_noPatrols,_difficulty,_missionPatrolVehicles,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;
// TODO: add grpNull checks to missionVehicleSpawner
if (_temp isEqualTo grpNull) throw 1;
_missionAIVehicles append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
uiSleep delayTime;
if (blck_useVehiclePatrols && ((_noVehiclePatrols > 0) || !(_submarinePatrolParameters isEqualTo []))) then
if (blck_useVehiclePatrols && ((_noPatrols > 0) || !(_submarinePatrolParameters isEqualTo []))) then
{
//params["_coords","_noVehiclePatrols","_skillAI","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_isScubaGroup",false],["_crewCount",4]];
_temp = [_coords,_noVehiclePatrols,_difficulty,_submarinePatrolParameters,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;
_temp = [_coords,_noPatrols,_difficulty,_submarinePatrolParameters,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;
// TODO: add grpNull checks to missionVehicleSpawner
if (_temp isEqualTo grpNull) throw 1;
_missionAIVehicles append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
uiSleep delayTime;
if (blck_debugLevel >= 3) then {diag_log format["monitorInitializedMissions: _spawnCrateTiming = %1 _loadCratesTiming = %2 | _markerMissionName = %3",_spawnCratesTiming,_loadCratesTiming, _markerMissionName]};
if (blck_debugLevel >= 3) then {diag_log format["monitorInitializedMissions: _missionLootBoxes = %1",_missionLootBoxes]};
if (_spawnCratesTiming in ["atMissionSpawnGround","atMissionSpawnAir"]) then
{
if (_missionLootBoxes isEqualTo []) then
@ -349,20 +353,9 @@ for "_i" from 1 to (count blck_activeMissionsList) do
_x setVariable["crateSpawnPos", (getPos _x)];
} forEach _crates;
private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
/*
private _vars = ["_objects","_hiddenObjects","_crates"];
{
diag_log format["_monitorInitializedMissions(322): %1 = %2",_vars select _forEachIndex,_x];
} forEach [_objects,_hiddenObjects,_crates];
*/ // 0 1 2 3 4 5
_missionData = [_coords,_mines,_objects,_hiddenObjects,_crates,_blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
/*
{
diag_log format["_monitorInitializedMission (327): _missionData %1 = %2",_vars select _foreachIndex,_missionData select _x];
} forEach [2,3,4,5];
*/
_el set[missionData, _missionData];
// Everything spawned withouth serious errors so lets keep the mission active for future monitoring
@ -405,17 +398,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do
private _playerIsNear = [_crates,20,true] call blck_fnc_playerInRangeArray;
private _minNoAliveForCompletion = (count _blck_AllMissionAI) - (round(blck_killPercentage * (count _blck_AllMissionAI)));
private _aiKilled = if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then {true} else {false}; // mission complete
/*
private _vars = ["_objects","_hiddenObjects","_crates"];
{
diag_log format["_monitorInitializedMissions (363): %1 = %2",_vars select _forEachIndex,_x];
} forEach [_objects,_hiddenObjects,_crates];
{
diag_log format["_monitorInitializedMission (369): _missionData %1 = %2",_vars select _foreachIndex,_missionData select _x];
} forEach [2,3,4,5];
*/
//_el set[missionData, _missionData];
if (_endIfPlayerNear) then
{
if (_playerIsNear) throw 1; // mission complete
@ -485,15 +468,6 @@ for "_i" from 1 to (count blck_activeMissionsList) do
_missionData = [_coords,_mines,_objects,_hiddenObjects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
/*
{
diag_log format["_monitorInitializedMissions (363): %1 = %2",_vars select _forEachIndex,_x];
} forEach [_objects,_hiddenObjects,_crates];
{
diag_log format["_monitorInitializedMission (369): _missionData %1 = %2",_vars select _foreachIndex,_missionData select _x];
} forEach [2,3,4,5];
*/
_el set[missionData, _missionData];
// If there were no throws then lets check on the mission in a bit.
@ -587,4 +561,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do
blck_activeMissionsList pushBack _el;
};
};
};
blck_activeMonitorThreads = blck_activeMonitorThreads - 1;