Project

General

Profile

Bug #13385

Updated by sal_vager over 7 years ago

The issue appears to be because you check if there's space for *any* resource and set a flag to allow *all* resources to be mined. This is the offending code inside ModuleAsteroidDrill:

<pre>
Removed as decompiling code breaks the EULA for (int index = 0; index < count; ++index)
{
ModuleAsteroidResource asteroidResource = modulesImplementing[index];
if (this.ResBroker.StorageAvailable(this.part, asteroidResource.resourceName, deltaTime, asteroidResource._flowMode, (double) this.FillAmount) > deltaTime * (double) asteroidResource.abundance * (double) this.Efficiency * efficiencyMultiplier)
{
flag = true;
break;
}
}
this.recipe.Clear();
if (flag)
{
this.recipe.Inputs.Add(new ResourceRatio()
{
ResourceName = "ElectricCharge",
Ratio = (double) this.PowerConsumption,
FlowMode = ResourceFlowMode.NULL
});
for (int index = 0; index < count; ++index)
{
ModuleAsteroidResource asteroidResource = modulesImplementing[index];
if ((double) asteroidResource.abundance > 1E-09)
{
PartResourceDefinition definition = PartResourceLibrary.Instance.GetDefinition(asteroidResource.resourceName);
double num = Math.Min(deltaTime * (double) asteroidResource.abundance * (double) this.Efficiency * efficiencyMultiplier, (this._info.currentMassVal - this._info.massThresholdVal) / (double) definition.density);
this._drilledMass += (double) definition.density * num;
this.recipe.Outputs.Add(new ResourceRatio()
{
ResourceName = asteroidResource.resourceName,
Ratio = num / deltaTime,
DumpExcess = true,
FlowMode = ResourceFlowMode.NULL
});
}
}
}
</pre>

It should be this instead:

<pre>
Removed as decompiling code breaks the EULA this.recipe.Clear();
for (int index = 0; index < count; ++index)
{
ModuleAsteroidResource asteroidResource = modulesImplementing[index];
if (this.ResBroker.StorageAvailable(this.part, asteroidResource.resourceName, deltaTime, asteroidResource._flowMode, (double) this.FillAmount) > deltaTime * (double) asteroidResource.abundance * (double) this.Efficiency * efficiencyMultiplier)
{
PartResourceDefinition definition = PartResourceLibrary.Instance.GetDefinition(asteroidResource.resourceName);
double num = Math.Min(deltaTime * (double) asteroidResource.abundance * (double) this.Efficiency * efficiencyMultiplier, (this._info.currentMassVal - this._info.massThresholdVal) / (double) definition.density);
this._drilledMass += (double) definition.density * num;
this.recipe.Inputs.Add(new ResourceRatio()
{
ResourceName = "ElectricCharge",
Ratio = (double) this.PowerConsumption,
FlowMode = ResourceFlowMode.NULL
});
this.recipe.Outputs.Add(new ResourceRatio()
{
ResourceName = asteroidResource.resourceName,
Ratio = num / deltaTime,
DumpExcess = true,
FlowMode = ResourceFlowMode.NULL
});
}
}

</pre>

This will prevent the overall mass decreasing, by preventing resources that cannot be contained from being mined. It will also increase energy consumption if multiple resources are being mined with storage for them.

There should also be a variable to dictate which resource the harvester is for, as in the current state the drill will mine every resource simultaneously.

Back