From b0ba29440d19a9375314a4bdedb5bec57b50f9cc Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Thu, 2 Feb 2017 14:58:47 -0500 Subject: [PATCH] Update vanilla vehicle_getOut Vanilla commit: https://github.com/DayZMod/DayZ/commit/492ba6d33aec4acd88e0e81e40cece6f6a261cca --- SQF/dayz_code/compile/vehicle_getOut.sqf | 31 +++++++++++++----------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/SQF/dayz_code/compile/vehicle_getOut.sqf b/SQF/dayz_code/compile/vehicle_getOut.sqf index 64d085b1e..3eb7a9c4c 100644 --- a/SQF/dayz_code/compile/vehicle_getOut.sqf +++ b/SQF/dayz_code/compile/vehicle_getOut.sqf @@ -1,32 +1,34 @@ //[vehicle, position, unit] //Quick fix for now. -private ["_vehicle","_position","_unit","_buildables"]; +private ["_vehicle","_position","_unit","_nearBuildables","_fencesArray,","_exitPosition","_intersectsWith","_playerPos"]; _vehicle = _this select 0; _position = _this select 1; _unit = _this select 2; -/* + +//Get players current location +/*_playerPos = _unit modelToWorld [0,0,0]; + _fencesArray = ["WoodenFence_1","WoodenFence_2","WoodenFence_3","WoodenFence_4","WoodenFence_5","WoodenFence_6","WoodenFence_7","WoodenGate_1","WoodenGate_2","WoodenGate_3","WoodenGate_4"]; //Hopefully returns the xyz of the vehicle seat pos. -_exitPosition = _vehicle modelToWorld (_vehicle selectionPosition ("pos " + _position)); -*/ +_exitPosition = _vehicle modelToWorld (_vehicle selectionPosition ("pos " + _position));*/ + if (_unit == player) then { //if (dayz_soundMuted) then {call player_toggleSoundMute;}; // Auto disable mute on vehicle exit (not a good idea without a sleep since rotor can be very loud when spinning down) - /* //_buildables = count (_exitPosition nearObjects ["DZ_buildables", 3]); //Check player location to exit location - _intersectsWith = lineIntersectsWith [[_position select 0, _position select 1, 0], [_exitPosition select 0, _exitPosition select 1, 0],_unit,_vehicle,true]; + /*_intersectsWith = lineIntersectsWith [[_playerPos select 0, _playerPos select 1, 0],[_exitPosition select 0, _exitPosition select 1, 0],_unit,_vehicle,true]; + //_buildables = count ((getposATL _vehicle) nearObjects ["DZ_buildables", 3]); - _buildables = false; + _nearBuildables = false; //Scan all intersected items for base items return with true false { - ` _buildables = if (_x in _fencesArray) exitWith {true}; + _nearBuildables = if ((typeof _x) in _fencesArray) exitWith {true}; } count _intersectsWith; //if intersects find builditem make player reenter vehicel - if (_buildables > 0) then { - + if (_nearBuildables) then { switch _position do { case ("driver"): { _unit action ["getInDriver", _vehicle]; }; case ("cargo"): { _unit action ["getInCargo", _vehicle]; }; @@ -41,10 +43,10 @@ if (_unit == player) then { publicVariableServer "PVDZ_Server_LogIt"; localize "str_actions_exitBlocked" call dayz_rollingMessages; - }; - */ - _vehicle call player_antiWall; + };*/ + _vehicle call player_antiWall; + //Lets make sure we can process some dmg from ejecting from the vehicle even traveling at lower speeds. if (((speed _vehicle) > 15) or ((speed _vehicle) < -10)) then { dayz_getout = _vehicle; @@ -52,4 +54,5 @@ if (_unit == player) then { }; }; -//diag_log format["%1(%4) - %2 - %3",_vehicle,_position,_unit,(speed _vehicle)]; \ No newline at end of file +//Debug Info +//diag_log format["%1(%4) - %2 - %3, (playerPos: %5, ExitPos: %6, IntersectsWith: %7)",_vehicle,_position,_unit,(speed _vehicle),_playerPos,_exitPosition,_intersectsWith]; \ No newline at end of file