From 49a5c00d2633093292c17f2642f598f6482f8c23 Mon Sep 17 00:00:00 2001 From: A Man Date: Fri, 27 May 2022 09:49:45 +0200 Subject: [PATCH] Update fn_isSheltered to use vehicle player --- SQF/dayz_code/compile/fn_isInsideBuilding.sqf | 2 +- SQF/dayz_code/compile/fn_isSheltered.sqf | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/SQF/dayz_code/compile/fn_isInsideBuilding.sqf b/SQF/dayz_code/compile/fn_isInsideBuilding.sqf index 76c4d7fdc..fc8da394a 100644 --- a/SQF/dayz_code/compile/fn_isInsideBuilding.sqf +++ b/SQF/dayz_code/compile/fn_isInsideBuilding.sqf @@ -173,5 +173,5 @@ if (!isNull _insideBox) then { // bounding box detected }; }; dayz_insideBuilding = [objNull, _insideBox] select _inside; -_dir call fnc_isSheltered; +[_unit, _dir] call fnc_isSheltered; // [vehicle player, direction of boundingBox if appropriate] _inside diff --git a/SQF/dayz_code/compile/fn_isSheltered.sqf b/SQF/dayz_code/compile/fn_isSheltered.sqf index a6552240f..a22d4a219 100644 --- a/SQF/dayz_code/compile/fn_isSheltered.sqf +++ b/SQF/dayz_code/compile/fn_isSheltered.sqf @@ -14,7 +14,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// local _deepScan = { - local _objects = lineIntersectsWith [_pos1, _pos2, player, objNull, true]; // sorted (nearest last) + local _objects = lineIntersectsWith [_pos1, _pos2, _unit, objNull, true]; // sorted (nearest last) local _nearest = (count _objects) - 1; // nearest object local _idx = _this; // weight index @@ -75,7 +75,8 @@ local _deepScan = { // /////////////////////////////////////////////////////////////////////////////////////////////////// -local _dir = _this; // align hemisphere to building if inside +local _unit = _this select 0; // vehicle player +local _dir = _this select 1; // align hemisphere to building if inside local _rad = 50; // scan radius local _seg = 8; // initial segments local _spin = 0; // z spin offset per arc-cycle @@ -84,7 +85,7 @@ local _e2 = 5.0; // long edge length local _scanWgt = [1,1.5,2]; // scan weighting index local _hitWgt = [0,0,0]; // record hit weighting local _total = 0; // total hits, adjusted for weighting -local _pos1 = aimPos player; // ASL from +local _pos1 = aimPos _unit; // ASL from local _pos2 = +_pos1; // ASL to _pos2 set [2, (_pos2 select 2) + _rad]; // overhead pos