diff --git a/SQF/dayz_code/actions/tow_AttachStraps.sqf b/SQF/dayz_code/actions/tow_AttachStraps.sqf index fdd8b0d05..5d541ff50 100644 --- a/SQF/dayz_code/actions/tow_AttachStraps.sqf +++ b/SQF/dayz_code/actions/tow_AttachStraps.sqf @@ -1,4 +1,4 @@ -private ["_vehicle","_started","_finished","_animState","_isMedic","_abort","_configVeh","_nameText","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle","_towTruck"]; +private ["_vehicle","_started","_finished","_animState","_isMedic","_abort","_configVeh","_nameText","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle","_towTruck","_vehicleFits","_worldPos","_veh","_box","_p1","_p2","_maxX","_maxY","_location1","_location2","_location3","_location4","_towTruckSize","_allowedSize"]; if(TradeInprogress) exitWith { cutText ["Already in progress." , "PLAIN DOWN"] }; TradeInprogress = true; @@ -16,8 +16,7 @@ _allowedSize = _towTruckSize-(_towTruckSize/3); _findNearestVehicles = nearestObjects [_towTruck, ["Car","Motorcycle"], 10]; _findNearestVehicle = []; { - if (alive _x and _towTruck != _x and (sizeOf typeOf _x) <= _allowedSize) then { - // within brounding box + if (alive _x and _towTruck != _x) then { if([_x,_towTruck] call fnc_isInsideBuilding2) then { _findNearestVehicle set [(count _findNearestVehicle),_x]; }; @@ -77,15 +76,20 @@ if(_IsNearVehicle >= 1) then { if (_finished) then { - if([_vehicle,_towTruck] call fnc_isInsideBuilding2) then { - if(typeOf _towTruck == "VIL_asistvan_DZE" ) then { - _vehicle attachTo [_towTruck]; - _towTruck setVariable ["DZEinTow", true, true]; - _towTruck setVariable ["DZEvehicleInTow", _vehicle, true]; - cutText [format["%1 has been attached to Tow Truck.",_nameText], "PLAIN DOWN"]; - }; + if((sizeOf typeOf _vehicle) <= _allowedSize) then { + if([_vehicle,_towTruck] call fnc_isInsideBuilding2 and ((vectorUp _vehicle) select 2) > 0.5) then { + if(typeOf _towTruck == "VIL_asistvan_DZE" ) then { + _vehicle attachTo [_towTruck,[1.3,-2,2.3]]; + _towTruck setVariable ["DZEinTow", true, true]; + _towTruck setVariable ["DZEvehicleInTow", _vehicle, true]; + cutText [format["%1 has been attached to Tow Truck.",_nameText], "PLAIN DOWN"]; + }; + } else { + cutText [format["Failed to attach %1 to Tow Truck.",_nameText], "PLAIN DOWN"]; + }; + } else { - cutText [format["Failed to attach %1 to Tow Truck.",_nameText], "PLAIN DOWN"]; + cutText [format["%1 too large and cannot be towed.",_nameText], "PLAIN DOWN"]; }; }; diff --git a/SQF/dayz_code/actions/tow_DetachStraps.sqf b/SQF/dayz_code/actions/tow_DetachStraps.sqf index ab3d24c85..5f6a2ebed 100644 --- a/SQF/dayz_code/actions/tow_DetachStraps.sqf +++ b/SQF/dayz_code/actions/tow_DetachStraps.sqf @@ -68,6 +68,8 @@ if(_inTow) then { _towTruck setVariable ["DZEinTow", false, true]; _towTruck setVariable ["DZEvehicleInTow", objNull, true]; cutText [format["%1 has been detached from Tow Truck.",_nameText], "PLAIN DOWN"]; + + _vehicle setvelocity [0,0,1]; }; } else { _towTruck setVariable ["DZEinTow", false, true];