Thorium-Sim / thorium-nova

Next-generation Spaceship Controls
https://thoriumsim.com
Apache License 2.0
342 stars 14 forks source link

Torpedos: Make torpedos find new targets #624

Open alexanderson1993 opened 4 months ago

alexanderson1993 commented 4 months ago

Torpedos are designed to have a specific guidance range, supplied by their guidance module. This dictates how close a torpedo needs to be to maintain a target lock. If the target moves outside of that range, the target should be lost.

This behavior hasn't been implemented yet. Currently, the torpedo maintains the target lock regardless of distance.

So, we need to do two things:

  1. Make it so the torpedo loses its target lock when its distance to its target is greater than the guidance range.
  2. Make the torpedo pick a new target, based on its guidance mode.

It will pick a target within its guidance range based on which guidance mode its using

This can all be done in the TorpedoMovementSystem or in a new system just for this purpose. Though it doesn't hurt to do it in the TorpedoMovementSystem.