Skip to content
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

STAGE:SOLIDFUEL returns 360 not 0 once booster is empty in KSP 1.0.2 #946

Closed
aznoohwee opened this issue May 1, 2015 · 5 comments
Closed
Labels
bug Weird outcome is probably not what the mod programmer expected.

Comments

@aznoohwee
Copy link

KSP 1.0.2 update broke my booster staging logic. STAGE:SOLIDFUEL now returns 360 once solid fuel is depleted.

@erendrake
Copy link
Member

blarg :P thank you for the report

@erendrake erendrake added the bug Weird outcome is probably not what the mod programmer expected. label May 1, 2015
@aznoohwee
Copy link
Author

I think I figured out what is going on.

This is my problematic code:

// Calculates the amount of fuel left in stage.  If we have boosters, use that value first.
FUNCTION fuelInStage
{
  local qty TO 0.0.
  local booster_present TO false.

  if STAGE:SOLIDFUEL > 0 { set qty TO qty + STAGE:SOLIDFUEL. set booster_present TO true. }
  if not booster_present { set qty TO qty + STAGE:LIQUIDFUEL. }

  print qty.

  //if booster_present and qty < 0.1 or qty = 360 { set qty to 0.0. }
  if booster_present and qty < 0.1 { set qty to 0.0. }

  return qty.
}

In versions previous to KSP 1.0.2 when a solid booster was empty the quantity was not actually 0 (more like .05). KSP 1.0.2 fixes this and once solid fuel is depleted the quantity returned is 0. As a result my booster_present flag is not set and therefore only the current fuel in the stage is returned.

I think the other part of the confusion is that the KOS "STAGE" variable does not match up directly with the staging setup in the game. That is STAGE:LIQUIDFUEL returns a non-zero value, even if we are only powered by boosters in the current KSP stage.

The fix here is to use a global for booster_present and reset it after we stage().

@abenkovskii
Copy link
Contributor

@aznoohwee @erendrake

That is STAGE:LIQUIDFUEL returns a non-zero value, even if we are only powered by boosters in the current KSP stage.

Is it a desired behaviour?

@abenkovskii
Copy link
Contributor

Probably the same problem: #513.

@erendrake
Copy link
Member

#513 is annoying. And this is certainly related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Weird outcome is probably not what the mod programmer expected.
Projects
None yet
Development

No branches or pull requests

3 participants