setWeaponZero method

Angular setWeaponZero(
  1. Shot shot,
  2. Distance zeroDistance
)

Zeros the weapon by storing the required barrel elevation in Weapon.zeroElevation and resetting shot.relativeAngle to zero.

Any subsequent Shot that uses the same Weapon instance will automatically inherit the zero elevation, matching the JS-library behaviour where weapon.zeroElevation is mutable.

Implementation

Angular setWeaponZero(Shot shot, Distance zeroDistance) {
  final elev = barrelElevationForTarget(shot, zeroDistance);
  shot.weapon.zeroElevation = elev;
  shot.relativeAngle = Angular.radian(0);
  return elev;
}