using Robust.Shared.GameStates; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Research.Components; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class ResearchServerComponent : Component { /// /// The name of the server /// [AutoNetworkedField] [DataField] public string ServerName = "RDSERVER"; /// /// The amount of points on the server. /// [AutoNetworkedField] [DataField] public int Points; /// /// Cost of technology research options reroll. /// [AutoNetworkedField] [DataField] public int RediscoverCost = 2000; /// /// A unique numeric id representing the server /// [AutoNetworkedField] [ViewVariables(VVAccess.ReadOnly)] public int Id; /// /// Entities connected to the server /// /// /// This is not safe to read clientside /// [ViewVariables(VVAccess.ReadOnly)] public List Clients = new(); [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] public TimeSpan NextUpdateTime = TimeSpan.Zero; [DataField] public TimeSpan ResearchConsoleUpdateTime = TimeSpan.FromSeconds(1); /// /// Time when next reroll for tech to research will be available. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField] public TimeSpan NextRediscover; /// /// Minimal interval between rediscover actions. /// [DataField] public TimeSpan RediscoverInterval = TimeSpan.FromSeconds(1); } /// /// Event raised on a server's clients when the point value of the server is changed. /// [ByRefEvent] public readonly record struct ResearchServerPointsChangedEvent(EntityUid Server, int Total, int Delta); /// /// Event raised every second to calculate the amount of points added to the server. /// [ByRefEvent] public record struct ResearchServerGetPointsPerSecondEvent(EntityUid Server, int Points);