Add gas recyclers (#9934)

* Add RemoveVolume()

RemoveVolume(vol) captures the common pattern of:

    air.RemoveRatio(vol / air.Volume)

Change existing code to use this method where appropriate.

* Add gas recyclers

Gas recyclers catalyze the conversion of CO2 and N2O to O2 and N2. The
gas recycler component takes waste gas from the input net and releases
the result into the output net.

To make things more fun, the input net must be pressurized to 3 MPa and
heated to at least 300 C; otherwise, no reaction will occur.

Game-mechanic wise, gas recyclers contain the catalyst for the
conversion reaction, and therefore, requires no external power. However,
the external pumps and heaters required to make the reaction happen
still do.

* Fix gas recyclers

Fix negative sqrt, fix pressure check after remove.
This commit is contained in:
Kevin Zheng
2022-09-11 16:02:01 -07:00
committed by GitHub
parent dd66bf305e
commit 45349e3c0d
18 changed files with 256 additions and 12 deletions

View File

@@ -109,8 +109,7 @@ namespace Content.Server.Body.Systems
return;
}
var ratio = (Atmospherics.BreathVolume / ev.Gas.Volume);
var actualGas = ev.Gas.RemoveRatio(ratio);
var actualGas = ev.Gas.RemoveVolume(Atmospherics.BreathVolume);
var lungRatio = 1.0f / organs.Count;
var gas = organs.Count == 1 ? actualGas : actualGas.RemoveRatio(lungRatio);