ExpelGasSystem.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
  2. // SPDX-FileCopyrightText: 2025 Piras314 <p1r4s@proton.me>
  3. // SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
  4. //
  5. // SPDX-License-Identifier: AGPL-3.0-or-later
  6. using Content.Shared._Shitmed.StatusEffects;
  7. using Content.Server.Atmos.EntitySystems;
  8. using Content.Server.Chat.Systems;
  9. using Robust.Shared.Random;
  10. namespace Content.Server._Shitmed.StatusEffects;
  11. public sealed class ExpelGasEffectSystem : EntitySystem
  12. {
  13. [Dependency] private readonly AtmosphereSystem _atmos = default!;
  14. [Dependency] private readonly ChatSystem _chat = default!;
  15. [Dependency] private readonly IRobustRandom _random = default!;
  16. public override void Initialize()
  17. {
  18. SubscribeLocalEvent<ExpelGasComponent, ComponentInit>(OnInit);
  19. }
  20. private void OnInit(EntityUid uid, ExpelGasComponent component, ComponentInit args)
  21. {
  22. var mix = _atmos.GetContainingMixture((uid, Transform(uid)), true, true) ?? new();
  23. var gas = _random.Pick(component.PossibleGases);
  24. mix.AdjustMoles(gas, 60);
  25. _chat.TryEmoteWithChat(uid, "Fart");
  26. }
  27. }