STLaySystem.Handle.cs 772 B

12345678910111213141516171819202122232425262728
  1. using Content.Shared.Input;
  2. using Robust.Shared.Input.Binding;
  3. using Robust.Shared.Player;
  4. namespace Content.Server._Stalker.Lay;
  5. public sealed partial class STLaySystem
  6. {
  7. private void InitializeHandle()
  8. {
  9. CommandBinds.Builder
  10. .Bind(ContentKeyFunctions.Lay, InputCmdHandler.FromDelegate(HandleLay, handle: false, outsidePrediction: false))
  11. .Register<STLaySystem>();
  12. }
  13. private void HandleLay(ICommonSession? session)
  14. {
  15. var entity = session?.AttachedEntity;
  16. if (entity is null)
  17. return;
  18. if (!TryComp<STLayComponent>(entity, out var comp))
  19. return;
  20. var nextState = comp.StateTransitions[comp.State];
  21. StartSetState((entity.Value, comp), nextState);
  22. }
  23. }