clean up a bunch of R&D code (#13071)

* clean up a bunch of R&D code

* don't store components

* brug

* speedrun some sloth review
This commit is contained in:
Nemanja
2022-12-19 16:14:02 -05:00
committed by GitHub
parent f78dca8504
commit 0549b22cbc
12 changed files with 159 additions and 143 deletions

View File

@@ -1,22 +1,45 @@
using Content.Server.Research.Systems;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Research.Components
{
[Access(typeof(ResearchSystem))]
[RegisterComponent]
public sealed class ResearchServerComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)] public string ServerName => _serverName;
[DataField("servername"), ViewVariables(VVAccess.ReadWrite)]
public string ServerName = "RDSERVER";
[DataField("servername")]
private string _serverName = "RDSERVER";
[ViewVariables(VVAccess.ReadWrite)] [DataField("points")]
public int Points = 0;
[ViewVariables(VVAccess.ReadOnly)] public int Id { get; set; }
[DataField("points"), ViewVariables(VVAccess.ReadWrite)]
public int Points;
[ViewVariables(VVAccess.ReadOnly)]
public List<ResearchPointSourceComponent> PointSources { get; } = new();
public int Id;
[ViewVariables(VVAccess.ReadOnly)]
public List<ResearchClientComponent> Clients { get; } = new();
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);
}