On Demand Fuel Cells (ODFC) by Orum

On Demand Fuel Cells (ODFC) by Orum

3.1k Downloads

[BUG 0.0.1.4a] fuel cell doesn't switch to the "Fuel Deprived" state if you run out of any of the currently used resources and continues to produce EC

zer0Kerbal opened this issue ยท 1 comments

commented

[BUG 0.0.1.4a] fuel cell doesn't switch to the "Fuel Deprived" state if you run out of any of the currently used resources and continues to produce EC

commented

ElectricChargeID needed to be replaced with fuel.resourceID

This is the buggy code:

ODFC.cs

foreach (Fuel fuel in ODFC_config.modes[fuelMode].fuels) {
// Determine activity based on available fuel
		amount = 0;
		part.GetConnectedResourceTotals(ElectricChargeID, out amount, out maxAmount);

		foreach (PartResource r in resources) 
			amount += r.amount;

		cfTime = Math.Min(cfTime, amount / (fuel.rate * rateLimit));
	}

This is the corrected code:

foreach (Fuel fuel in ODFC_config.modes[fuelMode].fuels) {
// Determine activity based on available fuel
		amount = 0;
		part.GetConnectedResourceTotals(fuel.resourceID, out amount, out maxAmount);

		foreach (PartResource r in resources) 
			amount += r.amount;

		cfTime = Math.Min(cfTime, amount / (fuel.rate * rateLimit));
	}

@4x4cheesecake @linuxgurugamer
image