Portable Generator Rework (#19302)
This commit is contained in:
committed by
GitHub
parent
50828363fe
commit
bf16698efa
28
Content.Server/Power/Generator/GeneratorExhaustGasSystem.cs
Normal file
28
Content.Server/Power/Generator/GeneratorExhaustGasSystem.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Power.Generator;
|
||||
|
||||
namespace Content.Server.Power.Generator;
|
||||
|
||||
/// <seealso cref="GeneratorSystem"/>
|
||||
/// <seealso cref="GeneratorExhaustGasComponent"/>
|
||||
public sealed class GeneratorExhaustGasSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<GeneratorExhaustGasComponent, GeneratorUseFuel>(FuelUsed);
|
||||
}
|
||||
|
||||
private void FuelUsed(EntityUid uid, GeneratorExhaustGasComponent component, GeneratorUseFuel args)
|
||||
{
|
||||
var exhaustMixture = new GasMixture();
|
||||
exhaustMixture.SetMoles(component.GasType, args.FuelUsed * component.MoleRatio);
|
||||
exhaustMixture.Temperature = component.Temperature;
|
||||
|
||||
var environment = _atmosphere.GetContainingMixture(uid, false, true);
|
||||
if (environment != null)
|
||||
_atmosphere.Merge(environment, exhaustMixture);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user