MOARdV / AvionicsSystems

MOARdV's Avionics Systems for Kerbal Space Program - a new generation of IVA enhancement.
Other
52 stars 26 forks source link

Add support for uncrewed vessels (e.g. ProbeControlRoom) #331

Open sovetskysoyuz opened 3 years ago

sovetskysoyuz commented 3 years ago

Several important parts of MASFlightComputer and MASVesselComputer only run during the FixedUpdate if vesselCrewed is true. This blocks compatibility with the Probe Control Room IVA, which is inherently used on uncrewed vessels.

Beyond the big FixedUpdate blocks, there are a few other functions (onVesselChange, onVesselWasModified, onVesselDestroy, onVesselCreate, onVesselCrewWasModified) that also only run on crewed vessels.

Other parts of MAS may assume that a vessel is crewed and throw exceptions for an uncrewed vessel - I already found that FindCurrentKerbal() in MASFlightComputer doesn't like it if there are no kerbals to find, and anything else that calls IVACameraActiveKerbal without checking if the vessel is uncrewed would have the same issue.

Recompiling the current MAS source-code with the crew-count checks removed, and some protection on IVACameraActiveKerbal calls to avoid NREs, produces a plugin that seems to work fine with the current version of Probe Control Room on KSP 1.11.1. I haven't tried to make these changes conditional on whether PCR is installed, since I always play with it and don't mind having these changes be permanent for my own installation, but such a condition would remove any performance impact for MAS users who don't use Probe Control Room.

Edit: a few other patches that I've made on my local copy - FYI since some of these took a while for me to tease out:

StoneBlue commented 3 years ago

I have a Probe Control Room IVA I am making, and also wanted to do a MAS version, so I'm up against the same wall as sovetskysoyuz. So I would also like to see MAS be able to be used in PCR w/crewed craft. I know its extra work for you MOARdV, so no expectations. I just wanted to voice that I would also make use of any updates to address the MAS-PCR issue.

Also, IIRC, @JonnyOThan has had a working version of a PCR .dll, which allows use of PCR on crewed as well as uncrewed crafts/IVAs with RPM, for quite awhile. Idk if he might have insight into a method that could be easily adapted for MAS to also work with PCR and both crewed/uncrewed craft?

In any case, As Always, Thanx for even considering to look into the "issue".

JonnyOThan commented 3 years ago

It’s been a while since I looked at that code, and who knows if it’ll ever see a public release - so I wouldn’t put too much effort into making sure MAS was compatible.

But if it’s easy and you’re interested, all you really need to do is base all your logic off of whether the Internal camera is active, and remove any checks that require kerbals.

baldamundo commented 2 years ago

Is the Probe Control Room compatible version of the dll available for download anywhere?

sovetskysoyuz commented 1 year ago

After a long delay, my changes discussed above are included in #368

JonnyOThan commented 1 year ago

I'ts worth noting that PCR now actually puts kerbals in the seats, so :shrug:

Sheepdog2142 commented 1 month ago

Why will the fix not get added. Probe control room is a really popular mod. To not support it on the main branch is crazy.