Фикс лежания (#430)

* Fix

* commit

* clear

* commit

* / WD EDIT
This commit is contained in:
Spatison
2024-07-10 16:26:50 +03:00
committed by GitHub
parent 0b374ebd7c
commit 8deece0091
12 changed files with 145 additions and 26 deletions

View File

@@ -0,0 +1,29 @@
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);
}
}