Project

General

Profile

Bug #2568

Requestresource returns 0 for request values below 0.0001

Added by Snjo almost 10 years ago. Updated over 7 years ago.

Status:
Closed
Severity:
Low
Assignee:
-
Category:
Gameplay
Target version:
-
Start date:
06/18/2014
% Done:

100%

Version:
Platform:
Any
Expansion:
Language:
English (US)
Mod Related:
No
Votes:
Arrow u r green
Arrow d r red

Description

When using Part.requestResource (any of the varieties), asking for a small amount will return 0, and thus causes bugs in custom modules expecting an accurate return value.

To test, ran this code:
if (Input.GetKeyDown(KeyCode.K)) {
for (float i = 0.000006f; i < 0.000016f; i += 0.000001f) {
Debug.Log("requesting " + i + ", got " + part.RequestResource("ElectricCharge", i));
}
}

which returned:
...
requesting 8E-06, got 0
requesting 9E-06, got 0
requesting 1E-05, got 1E-05
requesting 1.1E-05, got 1.1E-05
...

The function takes a float, or even a double as the input, so you would expect it to handle precisions much, much higher than this.

History

#1 Updated by TriggerAu almost 8 years ago

  • Status changed from New to Needs Clarification

#2 Updated by TriggerAu over 7 years ago

  • Status changed from Needs Clarification to Closed
  • % Done changed from 0 to 100

Closing this report out for now. If you find it is still occuring in the latest version of KSP please open a new report (and this one can be linked to it.) For best results, the wiki contains really useful info for when creating a report http://bugs.kerbalspaceprogram.com/projects/ksp/wiki.

You can also ask questions about the bug cleanup in the forum here: http://forum.kerbalspaceprogram.com/index.php?/topic/143980-time-to-clean-up-the-bug-tracker/ and tag @TriggerAu to get my attention

Also available in: Atom PDF