dkavolis / Ferram-Aerospace-Research

Aerodynamics model for Kerbal Space Program
Other
81 stars 32 forks source link

Suggestion for fixing massOverride #126

Closed StonesmileGit closed 3 years ago

StonesmileGit commented 3 years ago

Found a way to make massOverride work, but since KSP doesn't like a value being null (the default with the previous float? massOverride), I used float.MinValue instead.

There is likely a much better way to do this.

dkavolis commented 3 years ago

Thanks, I didn't expect KSP to have a problem with nullable values

StonesmileGit commented 3 years ago

MassOverride seems a bit unnecessary now as both the getter and setter are so simple. Would the code be more clear if it was removed?

dkavolis commented 3 years ago

MassOverride seems a bit unnecessary now as both the getter and setter are so simple. Would the code be more clear if it was removed?

The setter needs to modify field visibility so it has to stay but the modifications are still missing.

StonesmileGit commented 3 years ago

The setter no longer modifies the fields; it only sets the value to value or null

dkavolis commented 3 years ago

The setter needs to have

Fields[nameof(curWingMass)].guiActiveEditor = value is not null;
Fields[nameof(massMultiplier)].guiActiveEditor = value is not null;

to maintain correctness

StonesmileGit commented 3 years ago

Oh, so the Field modifications should be in both the setter and in Initialization?

dkavolis commented 3 years ago

Yeah, and it may be easier to call setter in Initialization to update field visibility.

dkavolis commented 3 years ago

Thanks

StonesmileGit commented 3 years ago

Glad I could help!

StonesmileGit commented 3 years ago

@dkavolis Do note that I did not push recompiled .dll's