-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix stage:liquidfuel #1082
Fix stage:liquidfuel #1082
Conversation
Fixes KSP-KOS#513 StageValue.cs * Re-write the resource getter code to return liquid fuel and oxidizer (and any other STACK_PRIORITY_SEARCH resource) based on the active engines. * This will return the total amount available to all currently active engines. It will not return zero when an asparagus stage is depleted. It will also count any fuel available to an engine that was manually activated rather than staged. * All other resources are returned according to what the root part is able to access (in my testing this aligns with the value shown in the resource panel). Fix stage:liquidfuel Fixes KSP-KOS#513 StageValue.cs * Re-write the resource getter code to return liquid fuel and oxidizer (and any other STACK_PRIORITY_SEARCH resource) based on the active engines. * This will return the total amount available to all currently active engines. It will not return zero when an asparagus stage is depleted. It will also count any fuel available to an engine that was manually activated rather than staged. * All other resources are returned according to what the root part is able to access (in my testing this aligns with the value shown in the resource panel).
foreach (var resource in list) | ||
{ | ||
available += resource.amount; | ||
capacity += resource.maxAmount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hvacengi were you hoping to use this for something? it doesnt look like it is being used after the sum. If not you could write
double available = list.Sum(resource => resource.amount);
return Math.Round(available, 2);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... I only did that while I was working on it because I thought it might be useful in the future. There's no reason to be doing the extra math, and I'm almost always in favor of more LINQ. Want me to make the change?
@EhevuTov Have you tested this with KSP 1.0.5 kOS 0.18.2? If this is still an not working for you, please submit a new issue, and include a copy of the craft file that you use to observe the issue. The most current implementation simply finds all active engines, and then totals up the fuel tanks that the engines report as being available. The current logic should be precisely coupled to the engines' ability to fire. |
Everything is working fine, thank you. |
I want to dump a radially attached fuel tank when it is empty. I have set this up as a stage. kOS does not report the stage as empty when the fuel tank is empty, counting instead all the fuel that is available to the engine. This is not desirable. |
While it may not be desirable in your use case, it is unfortunately a limitation that I think you will need to live with @macksimk. There are 2 issues at play:
I think you would be better off adding a tag to the drop tank, and then use Ideally it may be good for kOS to provide multiple stage selection options, possibly as separate structures supporting actual stage numbering. But for the time being it looks like an issue for maintenance, and we offer an efficient work around. |
Btw, you do realise that if you drop engines and tankage, dV changes? How
Basically now STAGE means two very different things in kOS and this is
|
I should have asked this in my previous reply, but could you please move the discussion to a new issue,as this has moved beyond the scope of a comment on an existing merged pull request? |
Fixes #513
StageValue.cs
(and any other STACK_PRIORITY_SEARCH resource) based on the active
engines.
engines. It will not return zero when an asparagus stage is depleted.
It will also count any fuel available to an engine that was manually
activated rather than staged.
able to access (in my testing this aligns with the value shown in the
resource panel).