Canisters [ Continuation of clement-or #2544 ] (#2628)

* Added atmos sprites from CEV-Eris

* Moved canister sprites to appropriate dir

* Removed unnecessary sprites, edited canisters prototype

* Created Gas Canister UI and release pressure buttons

* Changed GasMixture's pressure calculation (convert liters to cube meters)

* Added relabeling Canisters

* Reverted changes on GasMixture

* Changed my name in the credits

* Added valve opening on canisters

* Change canister visual state when connected to a port

* Added nullable to SharedGasCanisterComponent

* Replaced nullable contexts

* Changed again nullable annotation context

* Moved name in the credits to correct alphabetical order

* Canisters: Fix the most blatant issues with this PR (the added project interdependencies for no reason whatsoever)

* Canisters: Stop crashes when canisters leave atmosphere

* Canisters: Gas released into no atmosphere gets transferred "into space" (deleted)

* Atmos: Nullability annotations on TileAtmosphere, explaination of the states of TileAtmosphere.Air

* Canisters: If in an airblocked tile, do NOT release gas

* Scrubbers: Fix typo leading to them not connecting properly.

* Revert manual changes to credits file (sorry!) (1/2)

This reverts commit 94f3b0e5df8d9c2fa189866a17a231920f99bdaf.

* Revert manual changes to credits file (sorry!) (2/2)

This reverts commit 1986fb094dfaa44060f08d280f36b755258d17a6.

* Canisters: Apply @Zumorica 's reviews

* Canisters: Add missing localization as suggested by PJB

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>

* Canisters: Pressure lights!

* Canisters: Light is now unshaded.

* Canisters: Now using IActivate

* Gas canisters (& air canister), now with their numbers properly calibrated (hopefully)

* Canisters: Refactor how their layers are added to be more like ApcVisualizer

* Canisters: Clean up of the tile invalidation/air release logic

* Canisters: Some gas canister window improvements

* Canisters: Clean up release pressure change button label code

Co-authored-by: Clement-O <topy72.mine@gmail.com>
Co-authored-by: Clément <clement.orlandini@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
20kdc
2020-12-08 19:45:24 +00:00
committed by GitHub
parent 2b6964746c
commit 58af9003e7
38 changed files with 1055 additions and 21 deletions

View File

@@ -452,15 +452,16 @@ namespace Content.Server.Atmos
/// <summary>
/// Releases gas from this mixture to the output mixture.
/// If the output mixture is null, then this is being released into space.
/// It can't transfer air to a mixture with higher pressure.
/// </summary>
/// <param name="outputAir"></param>
/// <param name="targetPressure"></param>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool ReleaseGasTo(GasMixture outputAir, float targetPressure)
public bool ReleaseGasTo(GasMixture? outputAir, float targetPressure)
{
var outputStartingPressure = outputAir.Pressure;
var outputStartingPressure = outputAir?.Pressure ?? 0;
var inputStartingPressure = Pressure;
if (outputStartingPressure >= MathF.Min(targetPressure, inputStartingPressure - 10))
@@ -472,11 +473,11 @@ namespace Content.Server.Atmos
// We calculate the necessary moles to transfer with the ideal gas law.
var pressureDelta = MathF.Min(targetPressure - outputStartingPressure, (inputStartingPressure - outputStartingPressure) / 2f);
var transferMoles = pressureDelta * outputAir.Volume / (Temperature * Atmospherics.R);
var transferMoles = pressureDelta * (outputAir?.Volume ?? Atmospherics.CellVolume) / (Temperature * Atmospherics.R);
// And now we transfer the gas.
var removed = Remove(transferMoles);
outputAir.Merge(removed);
outputAir?.Merge(removed);
return true;