2023-04-25 20:23:14 -04:00
|
|
|
using Content.Server.GameTicking.Rules.Components;
|
2021-12-21 21:23:29 +01:00
|
|
|
using Content.Server.Sandbox;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.GameTicking.Rules;
|
|
|
|
|
|
2023-04-25 20:23:14 -04:00
|
|
|
public sealed class SandboxRuleSystem : GameRuleSystem<SandboxRuleComponent>
|
2021-12-21 21:23:29 +01:00
|
|
|
{
|
2022-02-24 11:00:30 +11:00
|
|
|
[Dependency] private readonly SandboxSystem _sandbox = default!;
|
2021-12-21 21:23:29 +01:00
|
|
|
|
2023-04-25 20:23:14 -04:00
|
|
|
protected override void Started(EntityUid uid, SandboxRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
2021-12-21 21:23:29 +01:00
|
|
|
{
|
2023-04-25 20:23:14 -04:00
|
|
|
base.Started(uid, component, gameRule, args);
|
2021-12-21 21:23:29 +01:00
|
|
|
_sandbox.IsSandboxEnabled = true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-25 20:23:14 -04:00
|
|
|
protected override void Ended(EntityUid uid, SandboxRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args)
|
2021-12-21 21:23:29 +01:00
|
|
|
{
|
2023-04-25 20:23:14 -04:00
|
|
|
base.Ended(uid, component, gameRule, args);
|
2021-12-21 21:23:29 +01:00
|
|
|
_sandbox.IsSandboxEnabled = false;
|
|
|
|
|
}
|
|
|
|
|
}
|