From cd05615532e42bca9c2d61cfbbb301328483f080 Mon Sep 17 00:00:00 2001 From: Ghostrider-GRG- Date: Sun, 4 Mar 2018 09:32:31 -0500 Subject: [PATCH] Updated _fnc_findSafePos/Added some settings --- .../Functions/GMS_fnc_findSafePosn.sqf | 13 +- .../Groups/GMS_fnc_missionGroupMonitor.sqf | 3 + .../Missions/GMS_fnc_missionSpawner.sqf | 2 +- .../GMS_fnc_spawnBaseObjects - Copy.sqf | 49 +++++ .../Missions/GMS_fnc_spawnBaseObjects.sqf | 16 +- .../Missions/GMS_fnc_spawnMissionAI.sqf | 41 +++-- .../Missions/GMS_fnc_spawnRandomLandscape.sqf | 4 + .../Vehicles/GMS_fnc_vehicleMonitor.sqf | 10 +- .../GMS_fnc_vehicleMonitor_updated.sqf | 172 ------------------ 9 files changed, 103 insertions(+), 207 deletions(-) create mode 100644 @GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects - Copy.sqf delete mode 100644 @GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf index 3662329..191b07e 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf @@ -15,10 +15,10 @@ */ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; -private["_findNew","_coords","_dist","_xpos","_ypos","_newPos","_townPos","_pole"]; +private["_findNew","_tries","_coords","_dist","_xpos","_ypos","_newPos","_townPos","_pole"]; _findNew = true; - +_tries = 0; while {_findNew} do { _findNew = false; //[_centerForSearch,_minDistFromCenter,_maxDistanceFromCenter,_minDistanceFromNearestObj,_waterMode,_maxTerainGradient,_shoreMode] call BIS_fnc_findSafePos @@ -87,7 +87,7 @@ while {_findNew} do { // check that missions spawn at least 1 kkm from towns { _townPos = [((locationPosition _x) select 0), ((locationPosition _x) select 1), 0]; - if (_townPos distance2D _coords < 200) exitWith { + if (_townPos distance2D _coords < blck_minDistanceFromTowns) exitWith { _findNew = true; }; } forEach blck_townLocations; @@ -99,15 +99,15 @@ while {_findNew} do { if (_mod isEqualTo "Exile") then {_pole = "Exile_Construction_Flag_Static"}; //diag_log format["_fnc_findSafePosn:: -- >> _mod = %1 and _pole = %2",_mod,_pole]; { - if ((_x distance2D _coords) < 600) then + if ((_x distance2D _coords) < blck_minDistanceToBases) then { _findNew = true; }; - }forEach nearestObjects[player, [_pole], 800]; + }forEach nearestObjects[blck_mapCenter, [_pole], blck_minDistanceToBases]; // check to be sure we do not spawn a mission on top of a player. { - if (isPlayer _x && (_x distance2D _coords) < 600) then + if (isPlayer _x && (_x distance2D _coords) < blck_minDistanceToPlayer) then { _findNew = true; }; @@ -120,6 +120,7 @@ while {_findNew} do { deleteVehicle _tavTest; if (_tavHeight > 100) then {_FindNew = true;}; }; + _tries = _tries + 1; }; if ((count _coords) > 2) then diff --git a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_missionGroupMonitor.sqf b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_missionGroupMonitor.sqf index b7e8b14..66cdcb8 100644 --- a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_missionGroupMonitor.sqf +++ b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_missionGroupMonitor.sqf @@ -156,13 +156,16 @@ _fn_monitorGroupWaypoints = { }; _fn_simulationMonitor = { + private["_playerType","_modType","_players"]; _modType = call blck_fnc_getModType; + //diag_log format["_fn_simulationMonitor"" _modType = %1",_modType]; if (_modType isEqualTo "Exile") then { _playerType = ["Exile_Unit_Player"]; }else{ _playerType = ["Epoch_Male_F","Epoch_Female_F"]; }; + //diag_log format["_fn_simulationMonitor:: _playerType = %1",_playerType]; { // player nearEntities [["Car", "Motorcycle", "Tank"], 50]; _players = (leader _x) nearEntities [_playerType, 1800]; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf index 49efadd..30ef5a2 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -163,7 +163,7 @@ if (_useMines) then }; uiSleep _delayTime; _temp = []; -diag_log format["_missionSpawner"" _missionLandscape = %1",_missionLandscape]; +//diag_log format["_missionSpawner"" _missionLandscape = %1",_missionLandscape]; if (_missionLandscapeMode isEqualTo "random") then { _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects - Copy.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects - Copy.sqf new file mode 100644 index 0000000..23c5277 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects - Copy.sqf @@ -0,0 +1,49 @@ +/* + Spawn objects from an array using offsects from a central location. + The code provided by M3Editor EDEN has been addapted to add checks for vehicles, should they be present. + Returns an array of spawned objects. + version of 10/13/17 + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_center","_objects"]; +if (count _center == 2) then {_center pushBack 0}; +//diag_log format["_spawnBaseObjects:: -> _objects = %1",_objects]; +private ["_newObjs"]; + +_newObjs = []; + +{ + //diag_log format["_fnc_spawnBaseObjects::-->> _x = %1",_x]; + private _obj = (_x select 0) createVehicle [0,0,0]; + //diag_log format["_fnc_spawnBaseObjects: _obj = %1",_obj]; + _newObjs pushback _obj; + //diag_log format["_fnc_spawnBaseObjects: _center = %1 and _x select 1 = %2",_center,_x select 1]; + private _spawnPos = (_center vectorAdd (_x select 1)); + if (surfaceIsWater _spawnPos) then + { + _obj setPosASL _spawnPos; + //diag_log "_fnc_spawnBaseObjects: detected surface == water"; + } else { + _obj setPosATL _spawnPos; + //diag_log "_fnc_spawnBaseObjects: detected surface = Land"; + }; + _obj setDir (_x select 2); + _obj enableDynamicSimulation true; + _obj allowDamage true; + // Lock any vehicles placed as part of the mission landscape. Note that vehicles that can be taken by players can be added via the mission template. + if ( (typeOf _obj) isKindOf "LandVehicle" || (typeOf _obj) isKindOf "Air" || (typeOf _obj) isKindOf "Sea") then + { + [_obj] call blck_fnc_configureMissionVehicle; + }; +} forEach _objects; +//diag_log format["_fnc_spawnBaseObjects: _newObjs = 51",_newObjs]; +_newObjs + diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf index 23c5277..72cb429 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf @@ -16,12 +16,22 @@ params["_center","_objects"]; if (count _center == 2) then {_center pushBack 0}; //diag_log format["_spawnBaseObjects:: -> _objects = %1",_objects]; -private ["_newObjs"]; +private ["_newObjs","_simDam"]; _newObjs = []; +// Assume that the list of objects to spawn has each object defined using one of two methods where parameters for simulation and damage are optional with default settings. +// 1. ["class_name",[pos x, y, z], dir, [eneable simulation, enable damage]] { //diag_log format["_fnc_spawnBaseObjects::-->> _x = %1",_x]; + if (count _x == 3) then + { + _simDam = [false,false]; + } + else + { + _simDam = _x select 3; + }; private _obj = (_x select 0) createVehicle [0,0,0]; //diag_log format["_fnc_spawnBaseObjects: _obj = %1",_obj]; _newObjs pushback _obj; @@ -36,8 +46,8 @@ _newObjs = []; //diag_log "_fnc_spawnBaseObjects: detected surface = Land"; }; _obj setDir (_x select 2); - _obj enableDynamicSimulation true; - _obj allowDamage true; + _obj enableDynamicSimulation (_simDam select 0); + _obj allowDamage (_simDam select 1); // Lock any vehicles placed as part of the mission landscape. Note that vehicles that can be taken by players can be added via the mission template. if ( (typeOf _obj) isKindOf "LandVehicle" || (typeOf _obj) isKindOf "Air" || (typeOf _obj) isKindOf "Sea") then { diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf index 372126c..256d858 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf @@ -28,25 +28,26 @@ if (blck_debugLevel >=2) then }forEach _this; }; #endif - // [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,_scubaGroupParameters,blck_UMS_weapons,blck_UMS_vests,isScubaGroup] - params["_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear],"_missionGroups",["_weapons",[]],["_vests",blck_vests],["_isScubaGroup",false]]; - private["_unitsToSpawn","_unitsPerGroup","_ResidualUnits","_newGroup","_blck_AllMissionAI","_abort"]; - _unitsToSpawn = [[_minNoAI,_maxNoAI]] call blck_fnc_getNumberFromRange; //round(_minNoAI + round(random(_maxNoAI - _minNoAI))); - _unitsPerGroup = floor(_unitsToSpawn/_noAIGroups); - _ResidualUnits = _unitsToSpawn - (_unitsPerGroup * _noAIGroups); - _blck_AllMissionAI = []; - _abort = false; - if (count _weapons == 0) then - { - _weapons = [_aiDifficultyLevel] call blck_fnc_selectAILoadout; - }; - #ifdef blck_debugMode - if (blck_debugLevel >= 2) then - { - diag_log format["_fnc_spawnMissionAI (30):: _unitsToSpawn %1 ; _unitsPerGroup %2 _ResidualUnits %3",_unitsToSpawn,_unitsPerGroup,_ResidualUnits]; - }; - #endif -if (count _missionGroups > 0) then +// [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,_scubaGroupParameters,blck_UMS_weapons,blck_UMS_vests,isScubaGroup] +params["_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear],"_missionGroups",["_weapons",[]],["_vests",blck_vests],["_isScubaGroup",false]]; +private["_unitsToSpawn","_unitsPerGroup","_ResidualUnits","_newGroup","_blck_AllMissionAI","_abort"]; + // Can add optional debug code here if needed. +_unitsToSpawn = [[_minNoAI,_maxNoAI]] call blck_fnc_getNumberFromRange; //round(_minNoAI + round(random(_maxNoAI - _minNoAI))); +_unitsPerGroup = floor(_unitsToSpawn/_noAIGroups); +_ResidualUnits = _unitsToSpawn - (_unitsPerGroup * _noAIGroups); +_blck_AllMissionAI = []; +_abort = false; +if (count _weapons == 0) then +{ + _weapons = [_aiDifficultyLevel] call blck_fnc_selectAILoadout; +}; +#ifdef blck_debugMode +if (blck_debugLevel >= 2) then +{ + diag_log format["_fnc_spawnMissionAI (30):: _unitsToSpawn %1 ; _unitsPerGroup %2 _ResidualUnits %3",_unitsToSpawn,_unitsPerGroup,_ResidualUnits]; +}; +#endif +if ( (count _missionGroups > 0) && _noAIGroups > 0) then { { //[[-98.9121,-35.9824,-1.20243],5,7,"Green",5,12],[[1,-1,-1],"red",4, 5,10] _x params["_position","_minAI","_maxAI","_skillLevel","_minPatrolRadius","_maxPatrolRadius"]; @@ -81,7 +82,7 @@ if (count _missionGroups > 0) then }; }forEach _missionGroups; }; -if (_missionGroups isEqualTo []) then +if (_missionGroups isEqualTo [] && _noAIGroups > 0) then { switch (_noAIGroups) do { diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf index b317b71..ba0f5c1 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf @@ -22,6 +22,10 @@ _objects = []; // https://community.bistudio.com/wiki/BIS_fnc_findSafePos _pos = [_coords,_min,_max,_nearest,0,5,0] call BIS_fnc_findSafePos; _wreck = createVehicle[_x, _pos, [], 25, "NONE"]; + _wreck allowDamage false; + _wreck enableSimulation false; + _wreck enableSimulationGlobal false; + _wreck enableDynamicSimulation false; _wreck setVariable ["LAST_CHECK", (diag_tickTime + 100000)]; private["_dir","_dirOffset"]; 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 0d16d20..c2828db 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf @@ -43,7 +43,7 @@ _fn_destroyVehicleAndCrew = { params["_veh"]; //private["_crew"]; //_crew = crew _veh; - diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; + //diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; {[_x] call blck_fnc_deleteAI;} forEach (crew _veh); [_veh] call blck_fn_deleteAIvehicle; }; @@ -78,7 +78,7 @@ _fn_reloadAmmo = { blck_fn_deleteAIvehicle = { params["_veh"]; - diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; + //diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; { _veh removeAllEventHandlers _x; }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; @@ -116,7 +116,7 @@ if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: function c _evaluate = false; _veh setVariable["blck_DeleteAt",0]; blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; - diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; + //diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; }; if (_allCrewDead && _evaluate) then @@ -140,7 +140,7 @@ if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: function c _veh setDamage 0.7; _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; } else { - diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; + //diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; [_veh] call _fn_releaseVehicle; }; _evaluate = false; @@ -149,7 +149,7 @@ if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: function c if (_missionCompleted && !(_allCrewDead)) then { - diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; + //diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; private _cleanupTimer = _veh getVariable["blck_DeleteAt",0]; // The time delete to deleting any alive AI units if (_cleanupTimer == 0) then {_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer]}; _evaluate = false; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf deleted file mode 100644 index d9035b6..0000000 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf +++ /dev/null @@ -1,172 +0,0 @@ -/* - By Ghostrider [GRG] - Copyright 2016 - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - -diag_log format["_fnc_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; - -if (true) exitWith {}; - -#ifdef blck_debugMode - //diag_log format["_fnc_vehicleMonitor:: blck_debugMode defined"]; -#endif - -_fn_releaseVehicle = { - params["_veh"]; - //blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; - _veh setVehicleLock "UNLOCKED" ; - //_v setVariable["releasedToPlayers",true]; - //[_v] call blck_fnc_emptyObject; - { - _veh removealleventhandlers _x; - } forEach ["GetIn","GetOut","fired","hit","hitpart","reloaded","dammaged","HandleDamage"]; - { - _veh removeAllMPEventHandlers _x; - } forEach ["MPHit","MPKilled"]; - _veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer,true]; - if ((damage _veh) > 0.5) then {_veh setDamage 0.5}; - //diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1 and blck_deleteAT = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; - #ifdef blck_debugMode - if (blck_debugLevel > 0) then - { - diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; - }; - #endif -}; - -_fn_destroyVehicleAndCrew = { - params["_veh"]; - //private["_crew"]; - //_crew = crew _veh; - diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; - {[_x] call blck_fnc_deleteAI;} forEach (crew _veh); - [_veh] call blck_fn_deleteAIvehicle; -}; - -_fn_reloadAmmo = { - params["_veh"]; - private ["_crew","_mag","_allMags","_cnt"]; - // https://community.bistudio.com/wiki/fullCrew - // 0 1 2 3 4 - // returns Array - format [[unit,role,cargoIndex,turretPath,personTurret], ...] - //diag_log format["_fnc_vehicleMonitor:: (65) _veh = %1",_veh]; - if ({alive _x and !(isPlayer _x)} count (crew _veh) > 0) then - { - _crew = fullCrew _veh; - //diag_log format["_fnc_vehicleMonitor:: (67) _crew = %1",_crew]; - { - //diag_log format ["_fnc_vehicleMonitor:: (69) _x = %1",_x]; - _mag = _veh currentMagazineTurret (_x select 3); - if (count _mag > 0) then - { - //diag_log format["_fnc_vehicleMonitor:: (71) _mag is typeName %1", typeName _mag]; - //diag_log format ["_fnc_vehicleMonitor:: (71) length _mag = %2 and _mag = %1",_mag,count _mag]; - _allMags = magazinesAmmo _veh; - //diag_log format["_fnc_vehicleMonitor:: (71) _allMags = %1",_allMags]; - _cnt = ( {_mag isEqualTo (_x select 0)}count _allMags); - //diag_log format["_fnc_vehicleMonitor:: (75) _cnt = %1",_cnt]; - if (_cnt < 2) then {_veh addMagazineCargo [_mag,2]}; - }; - } forEach _crew; - }; -}; - -blck_fn_deleteAIvehicle = { - params["_veh"]; - diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; - { - _veh removeAllEventHandlers _x; - }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; - blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; - deleteVehicle _veh; -}; - -private _vehList = +blck_monitoredVehicles; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; -#endif - //blck_fnc_releaseVehicleToPlayers -{ - /* - Determine state of vehicle - _isEmplaced - _ownerIsPlayer - _allCrewDead - _deleteNow - */ - - private _veh = _x; // (purely for clarity at this point, _x could be used just as well) - private _isEmplaced = _veh getVariable["DBD_vehType","none"] isEqualTo "emplaced"; - private _ownerIsPlayer = if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then {true} else {false}; - private _allCrewDead = {alive _x} count (crew _veh); - private _deletenow = if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then {true} else {false}; - private _missionCompleted = _veh getVariable["missionCompleted",0]; - private _evaluate = true; - - if (_ownerIsPlayer) then - { - // disable further monitoring and mark to never be deleted. - _evaluate = false; - _veh setVariable["blck_DeleteAt",0]; - blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; - diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; - }; - - if (_allCrewDead && _evaluate) then - { - if (_isEmplaced) then - { - if (blck_killEmptyStaticWeapons) then - { - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; - #endif - _veh setDamage 1; - _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; - }else { - [_veh] call _fn_releaseVehicle; - }; - _evaluate = false; - } else { - if (blck_killEmptyAIVehicles) then - { - _veh setDamage 0.7; - _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; - } else { - diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; - [_veh] call _fn_releaseVehicle; - }; - _evaluate = false; - }; - }; - - if (_missionCompleted && !(_allCrewDead)) then - { - diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; - private _cleanupTimer = _veh getVariable["blck_DeleteAt",0]; // The time delete to deleting any alive AI units - if (_cleanupTimer == 0) then {_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer]}; - _evaluate = false; - }; - - if (_evaluate) then - { - [_veh] call _fn_reloadAmmo; - }; - - if (_deleteNow) then - { - [_veh] call _fn_destroyVehicleAndCrew; - _evaluate = false; - }; -}forEach _vehList; - - -