Skip to content

Commit

Permalink
Refuel - Drop nozzle at unit's feet if no valid pos found (#6957)
Browse files Browse the repository at this point in the history
* Refuel - Drop nozzle at unit's feet if no valid pos found

Fix #6944

* Update fnc_dropNozzle.sqf

* Update addons/refuel/functions/fnc_dropNozzle.sqf

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>
  • Loading branch information
PabstMirror authored Apr 25, 2019
1 parent e54e308 commit a3830af
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions addons/refuel/functions/fnc_dropNozzle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ _nozzle setVelocity [0, 0, 0];

private _groundPosition = getPosASL _nozzle;
private _posA = (getPosASL _nozzle) vectorAdd [0,0,0.05];
private _posB = (getPosASL _nozzle) vectorAdd [0,0,-1000];
private _posB = (getPosASL _nozzle) vectorAdd [0,0,- GVAR(hoseLength)];
private _intersections = lineIntersectsSurfaces [_posA, _posB, _unit, _nozzle, true, 1, "GEOM"];
TRACE_1("",_intersections);
if (_intersections isEqualTo []) then {
_groundPosition set [2, (getTerrainHeightASL _groundPosition) + 0.005];
WARNING_1("no ground intersections for nozzle drop @ %1",_groundPosition);
if (!isNull _unit) then {
_groundPosition = getPosASL _unit; // place at unit's feet
} else {
_groundPosition set [2, (getTerrainHeightASL _groundPosition) + 0.005];
};
} else {
_groundPosition = ((_intersections select 0) select 0) vectorAdd [0,0,0.005];
};
Expand Down

0 comments on commit a3830af

Please sign in to comment.