Delta-v/Content.Shared/Chemistry/Components
Pieter-Jan Briers 589c55a6fc
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

(cherry picked from commit 33611b7094)
2024-02-18 23:27:29 +01:00
..
SolutionManager Fix chem sources in guidebook (#23987) 2024-01-26 22:35:05 +01:00
DrainableSolutionComponent.cs Revert 'Revert 'Solution Entities'' (#23168) 2024-01-23 23:00:42 +01:00
DumpableSolutionComponent.cs Revert 'Revert 'Solution Entities'' (#23168) 2024-01-23 23:00:42 +01:00
FitsInDispenserComponent.cs Revert 'Revert 'Solution Entities'' (#23168) 2024-01-23 23:00:42 +01:00
InjectorComponent.cs Predict Injector (syringes), cleanup (#25235) 2024-02-18 23:11:33 +01:00
MovespeedModifierMetabolismComponent.cs Sync master up to 1/10 (#74) 2023-10-03 14:15:46 -05:00
PillComponent.cs Remove server-side sprite references from chem master (#15888) 2023-04-29 19:27:14 +10:00
RefillableSolutionComponent.cs Revert 'Revert 'Solution Entities'' (#23168) 2024-01-23 23:00:42 +01:00
SharedHyposprayComponent.cs Refactor serialization copying to use source generators (#19412) 2023-08-22 18:14:33 -07:00
SmokeAffectedComponent.cs A return to foam (foam rework) (#20831) 2023-10-31 18:54:02 +01:00
SmokeComponent.cs Revert 'Revert 'Solution Entities'' (#23168) 2024-01-23 23:00:42 +01:00
Solution.cs Solution precision fixes (#25199) 2024-02-18 23:27:29 +01:00
SolutionComponent.cs Revert 'Revert 'Solution Entities'' (#23168) 2024-01-23 23:00:42 +01:00
SolutionContainerMixerComponent.cs Electrolysis and Centrifuge (#22517) 2023-12-16 20:30:32 +01:00
SolutionContainerVisualsComponent.cs Add inhand fill visuals (#24495) 2024-02-08 11:54:38 +01:00
SolutionScannerComponent.cs Refactor serialization copying to use source generators (#19412) 2023-08-22 18:14:33 -07:00
SolutionSpikerComponent.cs predict egg cracking + refactor (#25028) 2024-02-08 12:41:42 +01:00
SolutionTransferComponent.cs Refactor serialization copying to use source generators (#19412) 2023-08-22 18:14:33 -07:00