Closed k4kfh closed 7 years ago
Traced it down to line 540 in bundles.json. This is inside brake.reduction()
code for the Generic Boxcar
object. It's stopping here for some reason and not finishing the reduction.
if (resultingCylinderPSI == train.all[trainPosition].prototype.brake.cylinderPSI) {
return undefined; //stop the function
}
Correction: the problem is that .reduction()
doesn't take into consideration the existing brake cylinder pressure. It just assumes it to be 0. On line 537 you can see this.
resultingCylinderPSI = psi * 2.5;
I changed the line above to:
resultingCylinderPSI = train.all[trainPosition].prototype.brake.cylinderPSI + (psi * 2.5);
And a few tests seem to indicate that fixes the problem. I will commit the changes shortly.
When you make a reduction after already making one, it doesn't calculate them correctly. For example, let's say:
The cylinder should have air from both those reductions in it. But instead, the brake system treats the second as though it's been charged back up to 90psi in between. So the second reduction basically has no effect..