Jump to content

Resource depletion on unfocused vessels


Kimaera026

Recommended Posts

I'm talking about resources like electric charge, and especially any other using custom-made ModuleGenerator MODULE on unfocused vessels. Is there any way to retain the depletion and/or generation of these resources, basically keeping track of these modules, keeping them ON while you take control of other vessels far away?

the idea is to have lifesupport resources deplete while controlling other ships. No much sense in these modules stopping whenever the vessel is unfocused. Makes the whole point of having life support and general electric charge consumption useless, or only useful and realistic when controlling that same vessel.

Link to comment
Share on other sites

This is quite possible. When you make a custom module you could make a partless addon which runs all the time. This addon could manage aspects of ships which are unfocused. A second method is to have the module keep track of time since the ship was last controlled and then retroactive apply the changes upon reloading the vessel. In this last case the module, upon the ship being loaded, would determine 26 days have past since last time it was loaded and based on the number of kerbals it could determine there was only enough oxygen for 15 days and proceed to kill the kerbals.

Link to comment
Share on other sites

Its hardly possible. At least once stuff gets a little more complicated than "-1O²/s". Lets just consider electric energy as an example... a bunch of time your are behind a planet, so your solar panels do not generate energy. It becomes even more complicated when you have a small & slow moon thats behind its planet. So you either end up with an inaccurate prediction, require a lot of computing time or have crazy math involved.

Link to comment
Share on other sites

no. I dont want to deal with solar panels. Either with just a simple energy consumption (battery-powered capsule) and life support, or fuel cell+life support.

at the moment im keeping track of my unfocused vessels and adjusting their consumption manually with kerbal edit everytime i switch back to them. But being manual and all can be quite time consuming.

Link to comment
Share on other sites

You can loop through all vessels, and look at their protopartsnapshots. They will have resource snapshots. The resource snapshots are confignodes (in the same format as are stored in persistence files--indeed, that's what happens, all vessels are unloaded and serialized on savegame). You can edit the values in the confignodes.

MCE is mission controller extended. The autorecycle code is in MissionControllerEvents.cs in OnDestroy() IIRC.

Link to comment
Share on other sites

thanks for the reply PrivateFlip,

partless addon? sounds intriguing

how do I apply these methods?

To make a partless addon you would write your own plugin. The class of this plugin would be of the form:

 public class MultipleSavesDAclass : MonoBehaviour 

to have it behave like like a plugin which is always active like for instance Kerbal Alarm Clock and unlike for instance a resource generator which is tied to a part.

Such a plugin could use the code NathanKell describes to constantly edit unfocused vessels.

i think this is a bit too advanced for me XD

Can you program? (When we respond to your question we of course don't know what lies within your reach)

If you are a little familiar with programming it's not that complex; about a week ago I ran into the problem of editing unfocused vessels for a mod I was making and NathanKell pointed me to his source code as well, which allowed me to solve this problem with ease and which is also why I'm was able to respond to your question.

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