clean up infinite researchsystem shitcode (#13136)

* clean up infinite researchsystem shitcode

* fml some more shit

* make syncing work logically

* naming naming naming
This commit is contained in:
Nemanja
2022-12-25 16:22:23 -05:00
committed by GitHub
parent 9afbdf6a17
commit 4eee1ee9b2
23 changed files with 497 additions and 293 deletions

View File

@@ -0,0 +1,79 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Research.Components
{
/// <summary>
/// This is an entity that is able to connect to a <see cref="ResearchServerComponent"/>
/// </summary>
[RegisterComponent]
public sealed class ResearchClientComponent : Component
{
public bool ConnectedToServer => Server != null;
/// <summary>
/// The server the client is connected to
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public EntityUid? Server { get; set; }
}
/// <summary>
/// Raised on the client whenever its server is changed
/// </summary>
/// <param name="Server">Its new server</param>
[ByRefEvent]
public readonly record struct ResearchRegistrationChangedEvent(EntityUid? Server);
/// <summary>
/// Sent to the server when the client deselects a research server.
/// </summary>
[Serializable, NetSerializable]
public sealed class ResearchClientServerDeselectedMessage : BoundUserInterfaceMessage
{
}
/// <summary>
/// Sent to the server when the client chooses a research server.
/// </summary>
[Serializable, NetSerializable]
public sealed class ResearchClientServerSelectedMessage : BoundUserInterfaceMessage
{
public int ServerId;
public ResearchClientServerSelectedMessage(int serverId)
{
ServerId = serverId;
}
}
/// <summary>
/// Request that the server updates the client.
/// </summary>
[Serializable, NetSerializable]
public sealed class ResearchClientSyncMessage : BoundUserInterfaceMessage
{
}
[NetSerializable, Serializable]
public enum ResearchClientUiKey
{
Key,
}
[Serializable, NetSerializable]
public sealed class ResearchClientBoundInterfaceState : BoundUserInterfaceState
{
public int ServerCount;
public string[] ServerNames;
public int[] ServerIds;
public int SelectedServerId;
public ResearchClientBoundInterfaceState(int serverCount, string[] serverNames, int[] serverIds, int selectedServerId = -1)
{
ServerCount = serverCount;
ServerNames = serverNames;
ServerIds = serverIds;
SelectedServerId = selectedServerId;
}
}
}