1
0

SandboxRuleSystem.cs 811 B

12345678910111213141516171819202122
  1. using Content.Server.GameTicking.Rules.Components;
  2. using Content.Server.Sandbox;
  3. using Content.Shared.GameTicking.Components;
  4. namespace Content.Server.GameTicking.Rules;
  5. public sealed class SandboxRuleSystem : GameRuleSystem<SandboxRuleComponent>
  6. {
  7. [Dependency] private readonly SandboxSystem _sandbox = default!;
  8. protected override void Started(EntityUid uid, SandboxRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
  9. {
  10. base.Started(uid, component, gameRule, args);
  11. _sandbox.IsSandboxEnabled = true;
  12. }
  13. protected override void Ended(EntityUid uid, SandboxRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args)
  14. {
  15. base.Ended(uid, component, gameRule, args);
  16. _sandbox.IsSandboxEnabled = false;
  17. }
  18. }