diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf index 9f0bcc1..f000427 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf @@ -5,68 +5,61 @@ By Ghostrider-DBD- Copyright 2016 - Last updated 10-24-16 + Last updated 1-17-17 */ -private ["_unit","_units","_count","_group","_driver","_gunner","_cargo"]; -params["_veh"]; - -_count = 0; - -waitUntil { count crew _veh > 0}; -//diag_log format["vehicle Manned %1",_veh]; -uiSleep 60; -while { (getDammage _veh < 1) && ({alive _x} count crew _veh > 0)} do -{ //diag_log format["vehicleMonitor: vehicle crew consists of %1", crew _veh]; - //diag_log format["vehicleMonitor: number of crew alive is %1", {alive _x} count crew _veh]; +private _vehList = blck_missionVehicles; +{ + private ["_veh"]; + _veh = _x; + if ({alive _x} count crew _veh < 1) then + { + if (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") then + { + [_veh] spawn {uiSleep 1;(_this select 0) setDamage 1;}; + blck_missionVehicles = blck_missionVehicles - [_veh]; + if (blck_debugOn) then{ + diag_log format["_fnc_vehicleMonitor:: deleting emplaced weapon %1",_veh]; + }; + }else { + if (blck_killEmptyAIVehicles) then + { + blck_missionVehicles = blck_missionVehicles - [_veh]; + [_veh] spawn { + params["_v"]; + //diag_log format["vehicleMonitor.sqf:: case of patrol vehicle: _veh %1 is about to be killed with getAllHitPointsDamage = %2",_v, (getAllHitPointsDamage _v)]; + uiSleep 20; + { + _v setHitPointDamage [_x, 1]; + //diag_log format["vehicleMonitor: hitpart %1 for vehicle %1 set to 1",_x,_v]; + } forEach ["HitLFWheel","HitLF2Wheel","HitRFWheel","HitRF2Wheel","HitEngine","HitLBWheel","HitLMWheel","HitRBWheel","HitRMWheel","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun"]; + if (blck_debugLevel isEqualTo 3) then + { + diag_log format["_fnc_vehicleMonitor:: damage applied to a patrol vehicle -- >> current damage for vehicle %1 is = %2",_v, (getAllHitPointsDamage _v)]; + }; + [_v] spawn { // spawn this so we don't hold up the rest the evaluations and cleanup needed. + private _v = _this select 0; + uiSleep 60; + if (blck_debugOn) then { + diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle:deleting vehicle _veh",_v]; + }; + deleteVehicle _v; + }; + }; + } else { + //diag_log format["vehicleMonitor.sqf: make vehicle available to players; stripping eventHandlers from_veh %1",_veh]; + blck_missionVehicles = blck_missionVehicles - [_veh]; + _veh removealleventhandlers "GetIn"; + _veh removealleventhandlers "GetOut"; + _veh setVehicleLock "UNLOCKED" ; + if (blck_debugOn) then + { + diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; + }; + }; + }; + } else { _veh setVehicleAmmo 1; _veh setFuel 1; - sleep 10; - /* - //if ({alive _x} count crew _veh < 1) then { _veh setDamage 1.1;}; - if (!alive gunner _veh) then { - { - if (_x != driver _veh) exitWith {_x moveingunner _veh;}; - } forEach crew _veh; - }; - if (!alive gunner _veh) then {driver _veh moveingunner _veh;}; - if (!alive driver _veh) then { - { - if (_x != gunner _veh) exitWith { _x moveindriver _veh;}; - } forEach crew _veh; - }; - */ - //diag_log format["vehicleMonitor.sqf: driver is %1; gunner is %2", driver _veh, gunner _veh]; -}; -//diag_log format["vehicleMonitor:: Vehicle %1 is empty",_veh]; -//blck_PVS_aiVehicleEmpty = _veh; -//publicVariableServer "blck_PVS_aiVehicleEmpty"; - -//diag_log format["vehiclemonitor.sqf all crew for vehicle %1 are dead",_veh]; - -if (_veh getVariable["DBD_vehType","null"] isEqualTo "emplaced") then // always destroy mounted weapons -{ - //diag_log format["vehicleMonitor.sqf: _veh %1 is (in blck_staticWeapons) = true",_veh]; - _veh setDamage 1; -} else { - //diag_log format["vehicleMonitor.sqf: _veh %1 is (in blck_staticWeapons) = false",_veh]; - if (blck_killEmptyAIVehicles) then - { - private ["_v","_startTime"]; - //diag_log format["vehicleMonitor.sqf: _veh %1 is about to be killed",_veh]; - uiSleep 60; - _veh setDamage 1; - _startTime = diag_ticktime; - waitUntil{sleep 5;(diag_tickTime - _startTime) > 120;}; // delete destroyed vehicles after 2 min - deleteVehicle _veh; - } - else - { - //diag_log format["vehicleMonitor.sqf: make vehicle available to players; stripping eventHandlers from_veh %1",_veh]; - _veh removealleventhandlers "GetIn"; - _veh removealleventhandlers "GetOut"; - _veh setVehicleLock "UNLOCKED" ; }; -}; - - +}forEach _vehList;