Files
tbd-station-14/Content.IntegrationTests/Tests/Damageable
Pieter-Jan Briers 33611b7094 Solution precision fixes (#25199)
* Add test for two chemistry issues

1. rounding issue with reaction processing when making chloral hydrate
2. reliable assert trip due to the ValidateSolution() heat capacity issue.

* Fix FixedPoint2 arithmetic

Fix internal floating point arithmetic in places where it could be avoided.

Fix incorrect rounding mode used in other places (it should always floor, like regular int arithmetic).

I had to add an explicit epsilon value for float -> FixedPoint2 because something like 1.05 is actually like 1.04999 and that'd cause it to be rounded down to 1.04.

This fixes reaction reagent processing in cases where the reagent inputs can't cleanly divide. Previously, when making 30u chloral hydrate by adding the chlorine in 10u increments you'd end up with 0.04 chlorine left over. This was caused by division in the reaction code rounding up in some cases. Changing division here to always round down fixes it.

* Attempt to fix heat capacity precision assert issues.

Fixes #22126

First, we just increase the tolerance of the assert. It was way too low.

Second, actually put a cap on float drift from one-off _heatCapacity changes.

* Fix float -> FixedPoint2 epsilon for negative number, fix tests.

* Fix DamageableTest

* Oh yeah I need to call CleanReturnAsync
2024-02-16 16:54:27 -07:00
..