KSP-KOS / KOS

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

KOS vessel modules appear to be added to things that don't really need them #3118

Open JonnyOThan opened 3 months ago

JonnyOThan commented 3 months ago

flags, asteroids, probably debris...

Also uses FixedUpdate, there might be a better option?

Dunbaratu commented 3 months ago

Well, I mean technically a flag is a vessel, in the game's object hierarchy. I don't know (other than just hardcoding which class types to omit) what flag or criteria we could use to detect "this vessel isn't really a vessel. At least not that kind of vessel."

JonnyOThan commented 3 months ago

other than just hardcoding which class types to omit)

that’s probably where I’d start. There can be hundreds of asteroids, flags and debris in the universe and this can be a significant performance hit.

In fact..is the VesselModule only needed for loaded vessels? I’d assume it has some role to play in message handling but I didn’t see anything in a quick skim of the code.

SofieBrink commented 3 months ago

The vessel class in KSP has a CurrentControlLevel property, You could probably simply exclude any vessel where this is ControlLevel.NONE to avoid hardcoding based on vessel types.