Jump to content

Storing extra data on a vessel?


Recommended Posts

Hi,

I'm looking to store some extra information on vessels. I want to store some extra parameters on each vessel for something I'm working on. This really needs to be on the vessel. But I cannot find a proper way to do it. Right now I'm keeping a hashmap of the vessel.id with the information, but this won't work properly when quicksaving/loading. It also gives a minor issue when undocking/decoupling. For docking there is no issue, as I can just use the "primary" vessel information in case of docking and discard the other info. That's no problem.

Any idea where I should start looking? Can I add a custom hidden part to a vessel at runtime which keeps my info? Any tips for this?

Link to comment
Share on other sites

Here we recently had a thread about a related topic. I guess the easiest way would be to add an module to one of the vessels parts (primary ones?). But that might break compatibility. Part.customPartData property. Fuel lines and struts use it to save some info, they update it on "onBackup". But its a pure string, so multiple modules trying to write stuff into it will likely break stuff as well.
Link to comment
Share on other sites

Ok, thanks, adding a PartModule like TacLifeSupport does to a vessel might be the best step forward. My addon is quite invasive already, so that's no big issue.

I'm tricking the of whole KSP to support multiple solar systems, requiring me to keep track of the system a vessel is in, and if it's not in the current system I need to "fake" the orbit of this vessel away and store the old orbit so I can restore it when you switch to the vessel. I actually have the random solar system generation parts working already, and the solar system switching. However, right now the vessels are not moved out of the way when you switch systems. Which will cause mayhem as I'm changing SoI and planet/moon orbits. It won't be perfect (a lined up SoI switch won't happen due to the faked orbit) but it will make inter stellar travel possible.

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...