KSP-KOS / KOS

Fully programmable autopilot mod for KSP. Originally By Nivekk
Other
689 stars 228 forks source link

PAW Field inputs limits not detected until PAW is opened once (KAL-controller) #2676

Open ozin370 opened 4 years ago

ozin370 commented 4 years ago

With the KAL-1000 controller, if you try to set the field "play position" with kOS, the value is limited between 0 and 1. Only after opening the PAW for the KAL-controller (once, does not need to be kept open) will the actual limits be used.

To test:


set kal to ship:modulesnamed("ModuleRoboticController")[0].
kal:setfield("play position", 100).
kal:getfield("play position"). //this will be capped to 1 if the PAW for the kal controller hasn't been opened yet.``` 
Dunbaratu commented 4 years ago

I strongly suspect that I am helpless to fix this. KSP often has places where the game just presumes the ONLY way that is possible to alter fields is through their UI, and stuff isn't working right when you bypass their UI to do it. They don't actually fix this (I have entered an issue into their tracker about the same problem with robotic parts' fields not being populated unless the PAW is open.)

This is because much of the code that uses these fields is inside Unity's UI update pass, rather than being in a module that doesn't care whether the value changed due to UI or some other piece of code. Those UI hooks don't fire off when the window that needs them isn't open.

ozin370 commented 4 years ago

Ah yes, I was afraid it would be tied to the UI logic. Do you think it would be possible to have commands for opening and closing PAW for parts as a sort of workaround for this problem? Might not be a pretty solution, but would at least give a possible option

JonnyOThan commented 4 years ago

You could make a new special type of part module (like docking ports, science modules, etc) that exposed special suffixes for this stuff. It looks like a lot of it is exposed through public methods.