17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-06 08:08:36 +01:00

perf(physics): air flowing along a pipe wakes the physics of a coupled vehicle only when it changes its pressure by more than physics.pipewake (0.001 bar), not with any trickle of it

This commit is contained in:
2026-10-23 19:30:21 +02:00
parent 9a7ff372f7
commit 2f96dfe767
5 changed files with 39 additions and 8 deletions

View File

@@ -265,6 +265,14 @@ class TReservoir
/// <param name="dv">Volume change to add to dVol.</param>
void Flow(double dv);
/// <summary>
/// Pressure the reservoir will have once the flow accumulated for the step is applied (Vol + dVol) / Cap, in bar.
/// Of a vehicle whose physics sleeps, the flow keeps accumulating, as nothing applies it.
/// </summary>
double P_pending() const
{
return std::max(0.0, Vol + dVol) / Cap;
}
/// <summary>
/// Applies the accumulated flow (dVol) to the volume and resets dVol.
/// Volume is clamped to be non-negative.
/// </summary>