KSP-KOS / KOS

Fully programmable autopilot mod for KSP. Originally By Nivekk
Other
697 stars 230 forks source link

Discrepancy between TARGET and HASTARGET #3048

Open bigmcr opened 2 years ago

bigmcr commented 2 years ago

I have been playing a game with Extraplanetary Launchpads, and I've run across a bug involving setting one of the EL parts as the target. When you select a Recycling Bin part from Extraplanetary Launchpads, HASTARGET returns true, but TARGET isn't valid. See the below screenshot. Target Issue Graphic

Steps to reproduce:

  1. Install Extraplanetary Launchpads, if not installed already.
  2. Create a ship with a kOS processor, a decoupler and a Recycling Bin on the other side of the decoupler.
  3. Launch the ship and stage the decoupler.
  4. Set the recycling bin to be your target.
  5. Observe that HASTARGET returns true while TARGET is not valid.

I don't know if this is related to Extraplanetary Launchpads in some way or not, but this is the only part I have noticed this on.

nuggreat commented 2 years ago

I can confirm that this is a bug and that of the limited set of parts I tested with it only happened to the EL parts. Specifically it appears to be limited to parts with the module "EL target". Additionally in my testing the bug would only happen when the target was designed though a double click and even then the issue would only manifest when the part is loaded and unpacked though packing due to timewarp does not count for this only packing due to distance. Of particular note if kOS is responsible for setting the target though a typed SET TARGET TO ... command then the issue does not occur. Though when testing on a multi-part craft it is only when the EL part it's self is targeted similar to the targeting of a dockingport does the issue manifest. Which makes me wonder if this might be in some way related to issue #2749 as I think kOS is only set to to deal with docking ports and vessels as target not other parts or what used to target the COM of an asteroid.