DeviceNetworkTestSystem.cs 956 B

12345678910111213141516171819202122232425262728293031
  1. using Content.Server.DeviceNetwork.Components;
  2. using Content.Server.DeviceNetwork.Systems;
  3. using Content.Shared.DeviceNetwork;
  4. using Robust.Shared.GameObjects;
  5. using Robust.Shared.Reflection;
  6. namespace Content.IntegrationTests.Tests.DeviceNetwork
  7. {
  8. [Reflect(false)]
  9. public sealed class DeviceNetworkTestSystem : EntitySystem
  10. {
  11. public NetworkPayload LastPayload = default;
  12. public override void Initialize()
  13. {
  14. base.Initialize();
  15. SubscribeLocalEvent<DeviceNetworkComponent, DeviceNetworkPacketEvent>(OnPacketReceived);
  16. }
  17. public void SendBaselineTestEvent(EntityUid uid)
  18. {
  19. RaiseLocalEvent(uid, new DeviceNetworkPacketEvent(0, "", 0, "", uid, new NetworkPayload()));
  20. }
  21. private void OnPacketReceived(EntityUid uid, DeviceNetworkComponent component, DeviceNetworkPacketEvent args)
  22. {
  23. LastPayload = args.Data;
  24. }
  25. }
  26. }