From 7894c4a2beb08886cfd95fba5e40a8977f2060fa Mon Sep 17 00:00:00 2001 From: A Man Date: Mon, 2 May 2022 11:54:17 +0200 Subject: [PATCH] Update dayz_losCheck Made by @Victor-the-Cleaner --- SQF/dayz_code/init/compiles.sqf | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index c3d748f29..b22e7494e 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -329,23 +329,16 @@ if (!isDedicated) then { }; dayz_losCheck = { - private ["_cantSee","_target","_agent"]; - _target = _this select 0; // PUT THE PLAYER IN FIRST ARGUMENT!!!! - _agent = _this select 1; - _cantSee = true; + local _target = _this select 0; + local _agent = _this select 1; + local _cantSee = true; if ((!isNull _target) && {!isNull _agent}) then { - private ["_tPos","_zPos"]; - _tPos = eyePos _target; - _zPos = eyePos _agent; - if ((count _tPos > 0) && {count _zPos > 0}) then { - _cantSee = terrainIntersectASL [(eyePos _target), (eyePos _agent)]; - //diag_log ("terrainIntersectASL: " + str(_cantSee)); + local _los = [eyePos _target, eyePos _agent]; // [player, zombie] + _cantSee = lineIntersects _los; - if (!_cantSee) then { - _cantSee = lineIntersects [(eyePos _target), (eyePos _agent)]; - //diag_log ("lineIntersects: " + str(_cantSee)); - }; + if (!_cantSee) then { + _cantSee = terrainIntersectASL _los; }; }; _cantSee