Jump to content

One Key Autostruct


buguniao

Recommended Posts

A small exe file to autostruct your craft. No need to click every single part again!

please put this in your saves file: KSP\saves\your file\Ships\SPH or VAB, then run the exe file.

dependence: Windows 10

License: All Right Reserved

download link: https://github.com/buguniao55555/Autostruct/releases

Edited by buguniao
Link to comment
Share on other sites

  • 3 weeks later...

@buguniao Thank you for your work!

Correct me if i'm wrong here, but do i have to quit KSP to run the .exe file in both SPH and VAB folders in order to "auto"-strut a craft just built? This surely can be done with a .cfg file? Not to mention me not liking executable files from "random" places.

Also a small other thing, you have misspelled the headline "One Key Autostruct"

Link to comment
Share on other sites

On 12/30/2018 at 1:21 PM, superm18 said:

@buguniao Thank you for your work!

Correct me if i'm wrong here, but do i have to quit KSP to run the .exe file in both SPH and VAB folders in order to "auto"-strut a craft just built? This surely can be done with a .cfg file? Not to mention me not liking executable files from "random" places.

Also a small other thing, you have misspelled the headline "One Key Autostruct"

well someone else made it work with a .dll 

 

Link to comment
Share on other sites

On 1/1/2019 at 12:43 AM, Nightside said:

well someone else made it work with a .dll 

It is also possible with Editor Extensions Redux

Anyway, it's always nice to see different approaches (and different programm languages^^) :) 

@buguniao Proably my python skills are too basic to understand your code completely but do you respect parts which doesn't allow autostruts? There are quiet a few (some solar panels for example) which will cause a NRE if you apply autostruts to them anyway.

Link to comment
Share on other sites

  • 2 weeks later...
On 1/5/2019 at 7:27 AM, 4x4cheesecake said:

It is also possible with Editor Extensions Redux

Anyway, it's always nice to see different approaches (and different programm languages^^) :) 

@buguniao Proably my python skills are too basic to understand your code completely but do you respect parts which doesn't allow autostruts? There are quiet a few (some solar panels for example) which will cause a NRE if you apply autostruts to them anyway.

well, I've never met those situations before. The python program just replaces the default one and convert it to strut to root or something. it's just a simple trick:P so I don't think it's hard to understand

Link to comment
Share on other sites

41 minutes ago, buguniao said:

I don't think it's hard to understand 

Sure, this applies to many other things as well if you are the one who learned it ;)
But if you just scratched the surface of python several years ago, you will probably stumple upon some parameters or other stuff like the 'cid' integer, which is used twice in the code: when it is set to 0, and when it is incremented by 1. So, is it just something you have used to debug the script or is there something going on in the background?

Anyway:

50 minutes ago, buguniao said:

well, I've never met those situations before.

Build a vessel which got some OX-STAT Photovoltaic Panels and/or a FL-A5 Adapter, run your script on it, spawn the vessel in the game and you will probably come across this NRE (happens everytime after decoupling these parts from the vessel but sometimes also already on the launchpad):

A joint can't connect the body to itself.
 
(Filename:  Line: 362)

NullReferenceException: Object reference not set to an instance of an object
  at PartJoint.SetupJoint (Vector3 jointPos, Vector3 jointOrt, Vector3 jointOrt2, Int32 size) [0x00000] in <filename unknown>:0 
  at PartJoint.create (.Part child, .Part parent, UnityEngine.Transform nodeSpace, Vector3 nodePos, Vector3 nodeOrt, Vector3 nodeOrt2, Int32 nodeSize, AttachModes mode, Boolean rigid) [0x00000] in <filename unknown>:0 
  at PartJoint.Create (.Part owner, .Part parent, .AttachNode nodeToParent, .AttachNode nodeFromParent, AttachModes mode) [0x00000] in <filename unknown>:0 
  at Part.SecureAutoStrut (.Part anchor) [0x00000] in <filename unknown>:0 
  at Part+<SecureAutoStruts>c__Iterator3.MoveNext () [0x00000] in <filename unknown>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0 

These parts don't allow autostruts on them...there are probably more but these are the two I'm aware of.
Since the boolean for 'AllowAutoStruts' is not set in a part config or the craft file, I'm not quiet sure if there is actually a way to access the value without having access to the instance of the object.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.

×
×
  • Create New...