Jump to content

How to make generators stop working when you run out of a resource?


Gojira

Recommended Posts

The question is above, but is elaborated a tiny bit below.

How do I make generators stop working (e.g. the stock RTG) when they run out of a certain resource (e.g. RefinedBlutonium)? What would the .cfg look like?

Thanks,

Gojira

Link to comment
Share on other sites

I think (not tried it) it would be something like

MODULE
{
name = ModuleGenerator
isAlwaysActive = true

INPUT_RESOURCE
{
name = RefinedBluetonium
rate = 0.1
}

OUTPUT_RESOURCE
{
name = ElectricCharge
rate = 1
}
}

As long as you have defined Refinedbluetonium with a RESOURCE_DEFINITION in a cfg file and the generator has access to some of it.

Link to comment
Share on other sites

  • 1 month later...
Guest crlfe

Is the requiresAllInputs suggestion correct/still true?

The behavior I'm seeing is that active ModuleGenerators will always consume available inputs. Setting requiresAllInputs to true just stops any output being produced if an input is missing (otherwise the output rate will be reduced to e.g. 50% if only one of two inputs are available).

Post #4 probably got the original question, so apologies for the necro. I'm hitting #5 with a greenhouse that should *stop* consuming CO2 during the night so that it can be converted during daylight.

Link to comment
Share on other sites

ModuleGenerator is fairly underwhelming at this point, I don't believe requiresAllInputs would ever have made it stop, it would make it so if any input is missing the output would cease. There is no stock partmodule that will do this, but a plugin to make a better system shouldn't be difficult

Link to comment
Share on other sites

If you get right down to it an RTG Wont just stop working for a very very long time. It's output would just get weaker. It is a radioactive source so it would be based off its half life. So rather then just cutting it to zero, it would be an exponenetial drop off. Just can't remember the formula right now.

If you are going to mod the RTG so it's not unlimited you should model it off that. Rather then just cutting power. So if the half life is 30 years. After 30 years the power output would be (theoretically) half of what it was

Link to comment
Share on other sites

Guest crlfe
ModuleGenerator is fairly underwhelming at this point, I don't believe requiresAllInputs would ever have made it stop, it would make it so if any input is missing the output would cease. There is no stock partmodule that will do this, but a plugin to make a better system shouldn't be difficult

Found a few possibilities for implementing that. If I find a clean one (or convince myself there isn't one), I'll toss code up in a new thread for everyone to share (and/or pick over for bugs :)

Link to comment
Share on other sites

Guest crlfe

To close this out before it gets any more stale:

The cleanest way to handle reactions with multiple inputs is to check the quantity of everything before you RequestResource. The sanest way to check available resources and storage seems to be with:

List<PartResources> resources = new List<PartResources>();

part.GetConnectedResources( PartResourceLibrary.Instance.resourceDefinitions["ResourceName"], resources);

For a good example of how this works, grab the Kethane source and look at KethaneGenerator.OnFixedUpdate.

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