Device network as ecs (#4205)

* Work on DeviceNetworkSystem

* Implement device networking as ecs
Remove mailing unit code for now
Remove device network metadata

* Implement integration tests for device networking

* Remove manual updating DeviceNetworkSystem and use WaitRunTicks

* Fix wrong component name in ignored components

* Apply suggestions from code review

Co-authored-by: mirrorcult <notzombiedude@gmail.com>

* Rename NetworkUtils to DeviceNetworkConstants
Change connection type constants to enum
Remove create function from network payload class

* Change broken nodegroup check in wirenet to grid check

* Change ComponentManager to entity manager in DeviceNetworkSystem

* Fix smaller mistakes

* Wtf random test fail pls run them again smh

* Fix DataField in DeviceNetworkComponent

* Fix yaml in DeviceNetworkTest

* Fix DeviceNetworkComponent DeviceNetId property

Co-authored-by: Julian Giebel <j.giebel@netrocks.info>
Co-authored-by: mirrorcult <notzombiedude@gmail.com>
This commit is contained in:
Julian Giebel
2021-10-11 23:41:18 +02:00
committed by GitHub
parent 4c80fb9586
commit a6f2c21919
22 changed files with 772 additions and 641 deletions

View File

@@ -0,0 +1,28 @@
using Robust.Shared.Log;
using System.Collections.Generic;
using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;
namespace Content.Server.DeviceNetwork
{
public class NetworkPayload : Dictionary<string, object>
{
/// <summary>
/// Tries to get a value from the payload and checks if that value is of type T.
/// </summary>
/// <typeparam name="T">The type that should be casted to</typeparam>
/// <returns>Whether the value was present in the payload and of the required type</returns>
public bool TryGetValue<T>(string key, [NotNullWhen(true)] out T? value)
{
if (this.TryCastValue(key, out T? result))
{
value = result;
return true;
}
value = default;
return false;
}
}
}