peteletroll

A request to developers: make Part.autoStrutJoints public

Recommended Posts

As author of a moving-parts mod for KSP, I have to fight with autostruts. Autostruts are fine, and do their job nicely, but when you try to make parts of a ship move they can be a problem. Having the possibility to access and update them would be great, but this looks impossible now, or at least very complicated (maybe some Object.FindObjectsOfType() horrible hack). @SQUAD, could you please make this property public?

EDIT: Hm, I should have put this in Add-on developement instead...

Edited by peteletroll
  • Like 1

Share this post


Link to post
Share on other sites
14 minutes ago, peteletroll said:

As author of a moving-parts mod for KSP, I have to fight with autostruts. Autostruts are fine, and do their job nicely, but when you try to make parts of a ship move they can be a problem. Having the possibility to access and update them would be great, but this looks impossible now, or at least very complicated (maybe some Object.FindObjectsOfType() horrible hack). @SQUAD, could you please make this property public?

Turn them off ( autoStrutMode ) and remove them ( ReleaseAutoStruts() ) ?

  • Like 1

Share this post


Link to post
Share on other sites
51 minutes ago, sarbian said:

Turn them off ( autoStrutMode ) and remove them ( ReleaseAutoStruts() ) ?

I'd rather keep them (they exist for a reason) and update them while things are moving. But I'll investigate ReleaseAutoStruts(). Thanks for the suggestion, @sarbian!

Share this post


Link to post
Share on other sites

By the way @sarbian, ReleaseAutoStruts() is public, and I can use it to remove all autostruts in the vessel. But SecureAutoStruts(), that supposedly puts them back, is private! I'd rather to iterate through all autostruts and remove just the ones that block the intended motion.

Share this post


Link to post
Share on other sites

CycleAutoStrut() is public and is the one you need. Other mods already handle all this and we made sure mods would work when we worked on those.

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, sarbian said:

CycleAutoStrut() is public and is the one you need. Other mods already handle all this and we made sure mods would work when we worked on those.

Good! Thank you very much! Is there a way to know if autostruts are already disabled? I'm worried about interferences with other mods that may use it. I can call CycleAutoStruts() at the beginning of the motion (when they're supposed to be enabled) and again at the end (when they're supposed to be disabled), but someone else can call it in between, and the result would be a mess.

Share this post


Link to post
Share on other sites

autoStrutMode should reflect the state since you need to call the public call to change them and those call use that value.

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, sarbian said:

autoStrutMode should reflect the state since you need to call the public call to change them and those call use that value.

So probably the best thing to do is to call ReleaseAutoStruts() at the beginning of a motion and CycleAutoStruts() at the end, right? Thanks again, and sorry for abusing your patience :-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now