Xyphos

[1.7] FullAutoStrut - Automatically sets AutoStrut modes for you in the editor as you build your vessel

Recommended Posts

This is a Quality-Of-Life mod, Automatically sets AutoStrut modes for you in the editor as you build your vessel.
The root part will be set to the Heaviest part, left alone as a bug prevention; "Heaviest Part" may cause problems.
All parts connected to the root part will have AutoStrut set to the root part,
All other parts will be set to Grandparent part and form an autostrut mesh.

Bug Fix: Added Support for Infernal Robotics. if the part being placed is attached to an IR part anywhere in it's attachment hierarchy, AutoStrut will not be set so the part(s) can move freely.
UPDATED to 1.7 Added support for both Stock Robotics and Infernal Robotics as stated above.

Download from SpaceDock

Source Code on GitHub

Edited by Xyphos
Updated to 1.7

Share this post


Link to post
Share on other sites

Wow! Thank you!!! I've been waiting for this forever! (well, at least since autostruts were a thing :) )

Also, First!

Share this post


Link to post
Share on other sites

Can it be disabled?

If you change the Auto strut manually, will it reset those changes or will it change the stick around?

Edited by linuxgurugamer

Share this post


Link to post
Share on other sites

Judging from the source, it sets parameters when the parts are added, so what you override them should stick?

Share this post


Link to post
Share on other sites
36 minutes ago, monstah said:

Judging from the source, it sets parameters when the parts are added, so what you override them should stick?

correct. you can override once the part is placed, but if you remove it and place it again, it's likely to persist because there's a check to see if the autostrut mode was already set.
honestly, I don't fully understand why you would want to override, tho? a grandparent mesh is structurally secure.

48 minutes ago, linuxgurugamer said:

Can it be disabled?

remove the dll?
I haven't made a UI toggle, and I might not at all, unless more people request it; it wan't intended to be disabled.

Edited by Xyphos

Share this post


Link to post
Share on other sites

Because sometimes autostrutting can cause problems, especially with very large parts.

also, if the heaviest part is a fuel tank, then whatever is autostrutted to it will change when the tank gets empty.  It can cause URDS (Unintended Rapid Disassembly Syndrome).  You may want to have an option where it ignores the fuel mass when deciding what is the heaviest part.

Share this post


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

Because sometimes autostrutting can cause problems, especially with very large parts.

also, if the heaviest part is a fuel tank, then whatever is autostrutted to it will change when the tank gets empty.  It can cause URDS (Unintended Rapid Disassembly Syndrome).  You may want to have an option where it ignores the fuel mass when deciding what is the heaviest part.

with this mod, only the root part would be set to heaviest. the parts connected to the root part will be set to root part, all other parts are set to grandparent to form a "wire mesh" and hold it together.

Edited by Xyphos

Share this post


Link to post
Share on other sites
6 hours ago, Xyphos said:

The root part will be set to the Heaviest part,

And if the heaviest part is a fuel tank, you are going to have problems when it empties out.

Share this post


Link to post
Share on other sites
Just now, linuxgurugamer said:

And if the heaviest part is a fuel tank, you are going to have problems when it empties out.

so what do you suggest? ignore the root part's autostrut?

Share this post


Link to post
Share on other sites

Ignore fuel tanks when looking for the heaviest part

Share this post


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

Ignore fuel tanks when looking for the heaviest part

yeah, that's too complex for something so simple. how about we just ignore the root part, since that's the only one set to heavy

Share this post


Link to post
Share on other sites

Why is it complex?  Loop through all the parts, finding the heaviest one which isn't a tank.  

Share this post


Link to post
Share on other sites
2 minutes ago, linuxgurugamer said:

Why is it complex?  Loop through all the parts, finding the heaviest one which isn't a tank.  

there's no native or easy way to determine what is a "tank" and what isn't, considering the number of resource containers that exist, including batteries, cockpits, etc... that's a lot of work, both on my end, and the end-user's computer. in other words, it's extra unnecessary code. omitting the the root part would actually make every smaller and simpler.

Share this post


Link to post
Share on other sites

Ok, try this:  A tank is something that weighs very little empty, compared to when it's full.

You should be able to set up a static list in memory of all parts which aren't tanks, and just reference that.

Share this post


Link to post
Share on other sites

Not really, I'm just making some suggestions.

So, this is what you could do:

At game load, scan all parts and store the part name in a dictionary if it isn't a tank.

When building a craft, simply look up the part in the dictionary, if it's there, you can use it as a root.

Share this post


Link to post
Share on other sites
Just now, linuxgurugamer said:

Ok, try this:  A tank is something that weighs very little empty, compared to when it's full.

You should be able to set up a static list in memory of all parts which aren't tanks, and just reference that.

The thing is, auto strut doesn't give you the option to pick which part you strut to. All you get is heaviest, grandparent, or root (https://kerbalspaceprogram.com/api/class_part.html#a68ff7310759e0db6663e159d13c91881). I agree with @Xyphos, it's too complicated to try and make sure it's not strutting to a tank.

Share this post


Link to post
Share on other sites

If that's the way it is, then I'm forced to agree with you

Share this post


Link to post
Share on other sites

I had been afraid "heaviest part" could change when tanks go dry, but I've never experimented with it. Thanks for confirming my suspicions.

Share this post


Link to post
Share on other sites

While the actual heaviest part can change in flight, the strut itself won't change until the craft itself changes. Or, possibly, when the game is loaded. It won't snap all "heaviest part" autostruts to a new part until then.

At least, it used to work that way. I tested it during the public beta in which they were introduced.

Don't autostruts impinge on performance, though? I've never tested that, but always thought they were about as processor-intensive as regular struts. I'd be leery to use this mod if that was the case. Even more so than I am now, after having my fair share of "too many struts" problems in the past.

Share this post


Link to post
Share on other sites
2 hours ago, 5thHorseman said:

Don't autostruts impinge on performance, though?

I'm not sure. I haven't noticed any changes in performance, but then again I usually don't exceed 250 parts and I have a moderate gaming rig.

PS. I updated it to version 1.0.0.1 - I removed the code for the root part to avoid the "Heavy Part" conflict and cleaned up the code to be more readable. please download again using the link in the OP. unless there's a major bug fix or changes to KSP's API, I believe this will be the stable release.

Edited by Xyphos

Share this post


Link to post
Share on other sites

It doesn't appear to be available via CKAN, at least not yet anyway. Is that something you're planning on adding later, perhaps?

Edited by OldLost

Share this post


Link to post
Share on other sites
4 minutes ago, OldLost said:

It doesn't appear to be available via CKAN, at least not yet anyway. Is that something you're planning on adding later, perhaps?

all of my mods on spacedock have CKAN support requested, but the maintainers of CKAN are slacking or just out-right refuse. apparently I'm not a member of the club.

Edited by Xyphos

Share this post


Link to post
Share on other sites
4 minutes ago, Xyphos said:

all of my mods on spacedock have CKAN support requested, but the maintainers of CKAN are slacking or just out-right refuse. apparently I'm not a member of the club.

Your pull request has been in the queue 13 hours (https://github.com/KSP-CKAN/NetKAN/pull/5750). My last one waited 3 weeks before I asked about it on the CKAN thread (and was helped by linuxgurugamer). It's not a club, it's a tedious, unrewarding manual review queue that currently has 33 pending requests.

Share this post


Link to post
Share on other sites
6 minutes ago, HebaruSan said:

currently has 33 pending requests.

and only 2 of those requests are mine, out of all the mods I've published, only a handful made it on CKAN. a lot of them were refused, apparently for licence reasons, but PUBLIC DOMAIN is a valid permissible licence; I don't see the problem here.

Edited by Xyphos

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.