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:
@@ -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);
|
||||
|
||||
|
||||
@@ -35,11 +35,9 @@ namespace Content.Shared.Research.Components
|
||||
public sealed class ResearchConsoleBoundInterfaceState : BoundUserInterfaceState
|
||||
{
|
||||
public int Points;
|
||||
public int PointsPerSecond;
|
||||
public ResearchConsoleBoundInterfaceState(int points, int pointsPerSecond)
|
||||
public ResearchConsoleBoundInterfaceState(int points)
|
||||
{
|
||||
Points = points;
|
||||
PointsPerSecond = pointsPerSecond;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,56 @@
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using Content.Shared.Research.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
|
||||
namespace Content.Shared.Research.Components
|
||||
{
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class TechnologyDatabaseComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The ids of all the technologies which have been unlocked.
|
||||
/// </summary>
|
||||
[DataField("technologyIds", customTypeSerializer: typeof(PrototypeIdListSerializer<TechnologyPrototype>))]
|
||||
public List<string> TechnologyIds = new();
|
||||
namespace Content.Shared.Research.Components;
|
||||
|
||||
/// <summary>
|
||||
/// The ids of all the lathe recipes which have been unlocked.
|
||||
/// This is maintained alongside the TechnologyIds
|
||||
/// </summary>
|
||||
[DataField("recipeIds", customTypeSerializer: typeof(PrototypeIdListSerializer<LatheRecipePrototype>))]
|
||||
public List<string> RecipeIds = new();
|
||||
}
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedResearchSystem)), AutoGenerateComponentState]
|
||||
public sealed partial class TechnologyDatabaseComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// A main discipline that locks out other discipline technology past a certain tier.
|
||||
/// </summary>
|
||||
[AutoNetworkedField]
|
||||
[DataField("mainDiscipline", customTypeSerializer: typeof(PrototypeIdSerializer<TechDisciplinePrototype>))]
|
||||
public string? MainDiscipline;
|
||||
|
||||
[AutoNetworkedField(true)]
|
||||
[DataField("currentTechnologyCards")]
|
||||
public List<string> CurrentTechnologyCards = new();
|
||||
|
||||
/// <summary>
|
||||
/// Event raised on the database whenever its
|
||||
/// technologies or recipes are modified.
|
||||
/// Which research disciplines are able to be unlocked
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This event is forwarded from the
|
||||
/// server to all of it's clients.
|
||||
/// </remarks>
|
||||
[ByRefEvent]
|
||||
public readonly record struct TechnologyDatabaseModifiedEvent;
|
||||
[AutoNetworkedField(true)]
|
||||
[DataField("supportedDisciplines", customTypeSerializer: typeof(PrototypeIdListSerializer<TechDisciplinePrototype>))]
|
||||
public List<string> SupportedDisciplines = new();
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class TechnologyDatabaseState : ComponentState
|
||||
{
|
||||
public List<string> Technologies;
|
||||
public List<string> Recipes;
|
||||
/// <summary>
|
||||
/// The ids of all the technologies which have been unlocked.
|
||||
/// </summary>
|
||||
[AutoNetworkedField(true)]
|
||||
[DataField("unlockedTechnologies", customTypeSerializer: typeof(PrototypeIdListSerializer<TechnologyPrototype>))]
|
||||
public List<string> UnlockedTechnologies = new();
|
||||
|
||||
public TechnologyDatabaseState(List<string> technologies, List<string> recipes)
|
||||
{
|
||||
Technologies = technologies;
|
||||
Recipes = recipes;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The ids of all the lathe recipes which have been unlocked.
|
||||
/// This is maintained alongside the TechnologyIds
|
||||
/// </summary>
|
||||
/// todo: if you unlock all the recipes in a tech, it doesn't count as unlocking the tech. sadge
|
||||
[AutoNetworkedField(true)]
|
||||
[DataField("unlockedRecipes", customTypeSerializer: typeof(PrototypeIdListSerializer<LatheRecipePrototype>))]
|
||||
public List<string> UnlockedRecipes = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event raised on the database whenever its
|
||||
/// technologies or recipes are modified.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This event is forwarded from the
|
||||
/// server to all of it's clients.
|
||||
/// </remarks>
|
||||
[ByRefEvent]
|
||||
public readonly record struct TechnologyDatabaseModifiedEvent;
|
||||
|
||||
Reference in New Issue
Block a user