Jump to content

New ElementConverter using stored mass instead of converted mass for temperature calculations


Nightinggale
  • Branch: Preview Branch Version: Windows Pending

ElementConverter.ConvertMass() is using the wrong variable when calculating the new temperature. Copy paste of the inner part of the "remove input mass" loop because I highly suspect the decompiler use different variable names than you do and it's easier to explain when we agree on variable names.

PrimaryElement component2 = gameObject2.GetComponent<PrimaryElement>();
component2.KeepZeroMassObject = true;
float num10 = Mathf.Min(num9, component2.Mass);
// removed disease code unrelated to the bug
float num13 = component2.Mass * component2.Element.specificHeatCapacity;
num8 += num13;
num7 += num13 * component2.Temperature;

num10 is the amount of mass to convert

num13 is the weight for the weighted average for the temperature

num13 use component2.Mass, which is the stored mass. It should use num10 (or whatever it's called in your source) as this is the mass of the converted element.

The result of this bug is if you fill the water sieve with 1200 kg of sand, that amount of sand will dominate compared to the 5 or 10 kg of input water it will compare it to.


Steps to Reproduce
Add a lot of hot sand to a water sieve. Watch boiling water come out even if the input water is 20 C.
  • Thanks 1



User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...