SolutionContainerMixerSystem.cs 878 B

123456789101112131415161718192021222324252627282930
  1. using Content.Server.Power.Components;
  2. using Content.Server.Power.EntitySystems;
  3. using Content.Shared.Chemistry.Components;
  4. using Content.Shared.Chemistry.EntitySystems;
  5. using Content.Shared.Power;
  6. namespace Content.Server.Chemistry.EntitySystems;
  7. /// <inheritdoc/>
  8. public sealed class SolutionContainerMixerSystem : SharedSolutionContainerMixerSystem
  9. {
  10. /// <inheritdoc/>
  11. public override void Initialize()
  12. {
  13. base.Initialize();
  14. SubscribeLocalEvent<SolutionContainerMixerComponent, PowerChangedEvent>(OnPowerChanged);
  15. }
  16. private void OnPowerChanged(Entity<SolutionContainerMixerComponent> ent, ref PowerChangedEvent args)
  17. {
  18. if (!args.Powered)
  19. StopMix(ent);
  20. }
  21. protected override bool HasPower(Entity<SolutionContainerMixerComponent> entity)
  22. {
  23. return this.IsPowered(entity, EntityManager);
  24. }
  25. }