Files
OldThink/Content.Shared/_White/Standing/StandingStateSystem.cs
Spatison 8deece0091 Фикс лежания (#430)
* Fix

* commit

* clear

* commit

* / WD EDIT
2024-07-10 16:26:50 +03:00

30 lines
859 B
C#

using Content.Shared.Standing;
using Robust.Shared.Configuration;
namespace Content.Shared._White.Standing;
public sealed class StandingStateSystem : EntitySystem
{
[Dependency] private readonly INetConfigurationManager _cfg = default!;
public override void Initialize()
{
SubscribeNetworkEvent<CheckAutoGetUpEvent>(OnCheckAutoGetUp);
}
private void OnCheckAutoGetUp(CheckAutoGetUpEvent ev, EntitySessionEventArgs args)
{
if (!args.SenderSession.AttachedEntity.HasValue)
return;
var uid = args.SenderSession.AttachedEntity.Value;
if (!TryComp(uid, out StandingStateComponent? standing))
return;
standing.AutoGetUp = _cfg.GetClientCVar(args.SenderSession.Channel, WhiteCVars.AutoGetUp);
Dirty(args.SenderSession.AttachedEntity.Value, standing);
}
}