RND Rework [Death to Techweb] (#16370)

* Techweb rework

* more ui work

* finishing ui

* Finish all the C# logic

* the techs + lathes

* remove old-tech

* mirror-review
This commit is contained in:
Nemanja
2023-05-15 16:17:30 -04:00
committed by GitHub
parent a71d9c8eff
commit 9efc727fe1
51 changed files with 1732 additions and 1401 deletions

View File

@@ -2,73 +2,62 @@ using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Research.Components
namespace Content.Shared.Research.Components;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ResearchServerComponent : Component
{
[RegisterComponent, NetworkedComponent]
public sealed class ResearchServerComponent : Component
{
/// <summary>
/// The name of the server
/// </summary>
[DataField("servername"), ViewVariables(VVAccess.ReadWrite)]
public string ServerName = "RDSERVER";
/// <summary>
/// The amount of points on the server.
/// </summary>
[DataField("points"), ViewVariables(VVAccess.ReadWrite)]
public int Points;
/// <summary>
/// A unique numeric id representing the server
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public int Id;
/// <summary>
/// Entities connected to the server
/// </summary>
/// <remarks>
/// This is not safe to read clientside
/// </remarks>
[ViewVariables(VVAccess.ReadOnly)]
public List<EntityUid> Clients = new();
[DataField("nextUpdateTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextUpdateTime = TimeSpan.Zero;
[DataField("researchConsoleUpdateTime"), ViewVariables(VVAccess.ReadWrite)]
public readonly TimeSpan ResearchConsoleUpdateTime = TimeSpan.FromSeconds(1);
}
[Serializable, NetSerializable]
public sealed class ResearchServerState : ComponentState
{
public string ServerName;
public int Points;
public int Id;
public ResearchServerState(string serverName, int points, int id)
{
ServerName = serverName;
Points = points;
Id = id;
}
}
/// <summary>
/// The name of the server
/// </summary>
[AutoNetworkedField]
[DataField("serverName"), ViewVariables(VVAccess.ReadWrite)]
public string ServerName = "RDSERVER";
/// <summary>
/// Event raised on a server's clients when the point value of the server is changed.
/// The amount of points on the server.
/// </summary>
/// <param name="Server"></param>
/// <param name="Total"></param>
/// <param name="Delta"></param>
[ByRefEvent]
public readonly record struct ResearchServerPointsChangedEvent(EntityUid Server, int Total, int Delta);
[AutoNetworkedField]
[DataField("points"), ViewVariables(VVAccess.ReadWrite)]
public int Points;
/// <summary>
/// Event raised every second to calculate the amount of points added to the server.
/// A unique numeric id representing the server
/// </summary>
/// <param name="Server"></param>
/// <param name="Points"></param>
[ByRefEvent]
public record struct ResearchServerGetPointsPerSecondEvent(EntityUid Server, int Points);
[AutoNetworkedField]
[ViewVariables(VVAccess.ReadOnly)]
public int Id;
/// <summary>
/// Entities connected to the server
/// </summary>
/// <remarks>
/// This is not safe to read clientside
/// </remarks>
[ViewVariables(VVAccess.ReadOnly)]
public List<EntityUid> Clients = new();
[DataField("nextUpdateTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextUpdateTime = TimeSpan.Zero;
[DataField("researchConsoleUpdateTime"), ViewVariables(VVAccess.ReadWrite)]
public readonly TimeSpan ResearchConsoleUpdateTime = TimeSpan.FromSeconds(1);
}
/// <summary>
/// Event raised on a server's clients when the point value of the server is changed.
/// </summary>
/// <param name="Server"></param>
/// <param name="Total"></param>
/// <param name="Delta"></param>
[ByRefEvent]
public readonly record struct ResearchServerPointsChangedEvent(EntityUid Server, int Total, int Delta);
/// <summary>
/// Event raised every second to calculate the amount of points added to the server.
/// </summary>
/// <param name="Server"></param>
/// <param name="Points"></param>
[ByRefEvent]
public record struct ResearchServerGetPointsPerSecondEvent(EntityUid Server, int Points);