Update dayz_losCheck

Made by @Victor-the-Cleaner
This commit is contained in:
A Man
2022-05-02 11:54:17 +02:00
parent 70a7629433
commit 7894c4a2be

View File

@@ -329,23 +329,16 @@ if (!isDedicated) then {
}; };
dayz_losCheck = { dayz_losCheck = {
private ["_cantSee","_target","_agent"]; local _target = _this select 0;
_target = _this select 0; // PUT THE PLAYER IN FIRST ARGUMENT!!!! local _agent = _this select 1;
_agent = _this select 1; local _cantSee = true;
_cantSee = true;
if ((!isNull _target) && {!isNull _agent}) then { if ((!isNull _target) && {!isNull _agent}) then {
private ["_tPos","_zPos"]; local _los = [eyePos _target, eyePos _agent]; // [player, zombie]
_tPos = eyePos _target; _cantSee = lineIntersects _los;
_zPos = eyePos _agent;
if ((count _tPos > 0) && {count _zPos > 0}) then {
_cantSee = terrainIntersectASL [(eyePos _target), (eyePos _agent)];
//diag_log ("terrainIntersectASL: " + str(_cantSee));
if (!_cantSee) then { if (!_cantSee) then {
_cantSee = lineIntersects [(eyePos _target), (eyePos _agent)]; _cantSee = terrainIntersectASL _los;
//diag_log ("lineIntersects: " + str(_cantSee));
};
}; };
}; };
_cantSee _cantSee