1
0

GeneratorExhaustGasSystem.cs 1.0 KB

1234567891011121314151617181920212223242526272829
  1. using Content.Server.Atmos;
  2. using Content.Server.Atmos.EntitySystems;
  3. using Content.Shared.Atmos;
  4. using Content.Shared.Power.Generator;
  5. namespace Content.Server.Power.Generator;
  6. /// <seealso cref="GeneratorSystem"/>
  7. /// <seealso cref="GeneratorExhaustGasComponent"/>
  8. public sealed class GeneratorExhaustGasSystem : EntitySystem
  9. {
  10. [Dependency] private readonly AtmosphereSystem _atmosphere = default!;
  11. public override void Initialize()
  12. {
  13. SubscribeLocalEvent<GeneratorExhaustGasComponent, GeneratorUseFuel>(FuelUsed);
  14. }
  15. private void FuelUsed(EntityUid uid, GeneratorExhaustGasComponent component, GeneratorUseFuel args)
  16. {
  17. var exhaustMixture = new GasMixture();
  18. exhaustMixture.SetMoles(component.GasType, args.FuelUsed * component.MoleRatio);
  19. exhaustMixture.Temperature = component.Temperature;
  20. var environment = _atmosphere.GetContainingMixture(uid, false, true);
  21. if (environment != null)
  22. _atmosphere.Merge(environment, exhaustMixture);
  23. }
  24. }