fish-station/Content.Server/Standing/LayingDownSystem.cs
haiwwkes 40568a243c
lay down + scope (#476)
* remove old system

* new scope, new laying
2024-10-11 11:52:39 +03:00

28 lines
778 B
C#

using Content.Shared.CCVar;
using Content.Shared.Standing;
using Robust.Shared.Configuration;
namespace Content.Server.Standing;
public sealed class LayingDownSystem : SharedLayingDownSystem
{
[Dependency] private readonly INetConfigurationManager _cfg = default!;
public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<CheckAutoGetUpEvent>(OnCheckAutoGetUp);
}
private void OnCheckAutoGetUp(CheckAutoGetUpEvent ev, EntitySessionEventArgs args)
{
var uid = GetEntity(ev.User);
if (!TryComp(uid, out LayingDownComponent? layingDown))
return;
layingDown.AutoGetUp = _cfg.GetClientCVar(args.SenderSession.Channel, CCVars.AutoGetUp);
Dirty(uid, layingDown);
}
}