2022-07-16 13:51:52 +10:00
|
|
|
using Content.Client.Buckle.Strap;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Buckle;
|
2022-07-16 13:51:52 +10:00
|
|
|
using Content.Shared.Buckle.Components;
|
|
|
|
|
using Robust.Shared.GameStates;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
|
|
|
|
namespace Content.Client.Buckle
|
|
|
|
|
{
|
|
|
|
|
internal sealed class BuckleSystem : SharedBuckleSystem
|
|
|
|
|
{
|
2022-07-16 13:51:52 +10:00
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
SubscribeLocalEvent<StrapComponent, ComponentHandleState>(OnStrapHandleState);
|
|
|
|
|
}
|
2021-06-09 22:19:39 +02:00
|
|
|
|
2022-07-16 13:51:52 +10:00
|
|
|
private void OnStrapHandleState(EntityUid uid, StrapComponent component, ref ComponentHandleState args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Current is not StrapComponentState state) return;
|
|
|
|
|
component.Position = state.Position;
|
|
|
|
|
component.BuckleOffsetUnclamped = state.BuckleOffsetClamped;
|
|
|
|
|
component.BuckledEntities.Clear();
|
|
|
|
|
component.BuckledEntities.UnionWith(state.BuckledEntities);
|
|
|
|
|
component.MaxBuckleDistance = state.MaxBuckleDistance;
|
|
|
|
|
}
|
2021-06-09 22:19:39 +02:00
|
|
|
}
|
|
|
|
|
}
|