Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stock ModuleControlSurface "authority limiter" getfield/setfield broke in KSP updates. #2666

Closed
Dunbaratu opened this issue Feb 10, 2020 · 3 comments · Fixed by #2667
Closed
Assignees
Labels
bug Weird outcome is probably not what the mod programmer expected.

Comments

@Dunbaratu
Copy link
Member

Problem discovered with version/part:

First discovered in KSP 1.8.1 - used to work a year ago. I don't know exactly which update broke it.
This probably occurs on other control surface parts, but the test case was for the stock part "AV-R8 Winglet".

Shallow look at the problem:

// The following two commands give an error
// claiming the field is not available, even
// though you can see it, and manually
// manipulate it, in the PAW:
print ship:partstagged("fin")[0]:getmodule("ModuleControlSurface"):getfield("authority limiter").
print ship:partstagged("fin")[0]:getmodule("ModuleControlSurface"):setfield("authority limiter", 20).

// For reference, the following commands on a similar field
// work just fine, even though it looks like the same exact
// type of field (Single, a slider):
print ship:partstagged("fin")[0]:getmodule("ModuleControlSurface"):getfield("deploy angle").
print ship:partstagged("fin")[0]:getmodule("ModuleControlSurface"):setfield("deploy angle", 20).
@Dunbaratu Dunbaratu self-assigned this Feb 10, 2020
@Dunbaratu Dunbaratu added the bug Weird outcome is probably not what the mod programmer expected. label Feb 10, 2020
@Dunbaratu
Copy link
Member Author

More in-depth look at the problem:

There's two entirely different fields on the PartModule, BOTH of which have the display name "Authority Limiter", which is the problem. One is authorityLimiter and the other is authorityLimiterUI. The user only sees one at a time, as only one of them has guiActive set to true. But the kOS code assumes there won't be two different fields with the same display name on the same PartModule, so it never sees the second one, stopping after finding one. The one it finds is the guiActive == False one. The one it fails to see is the second guiActive == True one. So it issues an error message claiming the field is currently not available.

SQUAD seems to have added a new thing recently - cases where there's two fields with the same gui display name in the PartModule, but the user doesn't see both of them because only one is active.

I don't know how many other fields have this weird feature, but this probably isn't the only one.

@charlesstaats
Copy link
Contributor

This is affecting me too. (In my case it's the airbrake part that isn't working correctly.)

@Mindeufair
Copy link

This bug broke a code I wrote in 1.7.3 :(
I'm novice in Github, so I was asking myself if the fix in the attached merge request is working and if there is a way to create my own version of the 2 .dll affected by this change waiting the next version of the mod.
Thanks for your time to this amazing mod :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Weird outcome is probably not what the mod programmer expected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants