Skip to content

Commit

Permalink
Artillerytables - Fix Low shots & bad params (#10325)
Browse files Browse the repository at this point in the history
* Fix direct fire not showing in tables

* Fix parameters

* Update simulate.rs
  • Loading branch information
johnb432 authored Sep 20, 2024
1 parent 5541adc commit 3778747
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/artillerytables/functions/fnc_adjustFire.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ params ["_gunPos", "_targetPos", "_adjustEast", "_adjustNorth", "_adjustUp", "_m

private _resultPos = [_adjustEast + _targetPos select 0, _adjustNorth + _targetPos select 1, _adjustUp + _targetPos select 2];

private _returns = ["_gunPos", "_resultPos", "_muzzleVelocity", "_highAngle", "_airFriction", "_temperature", "_airDensity", "_windDir", "_windSpeed"] call FUNC(calculateSolution);
private _returns = [_gunPos, _resultPos, _muzzleVelocity, _highAngle, _airFriction, _temperature, _airDensity, _windDir, _windSpeed] call FUNC(calculateSolution);

_returns
7 changes: 6 additions & 1 deletion extension/src/artillery/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ pub fn find_solution(
return (-1.0, -1.0, -1.0);
}
let radicand = radicand.sqrt();
let angle_root =
let mut angle_root =
(muzzle_velocity.mul_add(*muzzle_velocity, radicand) / (GRAVITY * range_to_hit)).atan();
if angle_root > max_elev || angle_root < min_elev {
angle_root = (muzzle_velocity.mul_add(*muzzle_velocity, -radicand)
/ (GRAVITY * range_to_hit))
.atan();
}
if angle_root > max_elev || angle_root < min_elev {
return (-1.0, -1.0, -1.0);
}
Expand Down

0 comments on commit 3778747

Please sign in to comment.