Clean up the JobRequirements (#13374)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Closes https://github.com/space-wizards/space-station-14/issues/13348
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Players.PlayTimeTracking;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -7,17 +7,17 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
|
||||
namespace Content.Shared.Roles
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract class for playtime and other requirements for role gates.
|
||||
/// Abstract class for playtime and other requirements for role gates.
|
||||
/// </summary>
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public abstract class JobRequirement
|
||||
{
|
||||
[DataField("inverted")] public bool Inverted;
|
||||
}
|
||||
public abstract class JobRequirement{}
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class DepartmentTimeRequirement : JobRequirement
|
||||
{
|
||||
/// <summary>
|
||||
/// Which department needs the required amount of time.
|
||||
/// </summary>
|
||||
[DataField("department", customTypeSerializer: typeof(PrototypeIdSerializer<DepartmentPrototype>))]
|
||||
public string Department = default!;
|
||||
|
||||
@@ -25,6 +25,15 @@ namespace Content.Shared.Roles
|
||||
/// How long (in seconds) this requirement is.
|
||||
/// </summary>
|
||||
[DataField("time")] public TimeSpan Time;
|
||||
|
||||
/// <summary>
|
||||
/// If true, requirement will return false if playtime above the specified time.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>False</c> by default.<br />
|
||||
/// <c>True</c> for invert general requirement
|
||||
/// </value>
|
||||
[DataField("inverted")] public bool Inverted;
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
@@ -36,19 +45,21 @@ namespace Content.Shared.Roles
|
||||
[DataField("role", customTypeSerializer: typeof(PrototypeIdSerializer<PlayTimeTrackerPrototype>))]
|
||||
public string Role = default!;
|
||||
|
||||
/// <summary>
|
||||
/// How long (in seconds) this requirement is.
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="DepartmentTimeRequirement.Time"/>
|
||||
[DataField("time")] public TimeSpan Time;
|
||||
|
||||
/// <inheritdoc cref="DepartmentTimeRequirement.Inverted"/>
|
||||
[DataField("inverted")] public bool Inverted;
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class OverallPlaytimeRequirement : JobRequirement
|
||||
{
|
||||
/// <summary>
|
||||
/// How long (in seconds) this requirement is.
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="DepartmentTimeRequirement.Time"/>
|
||||
[DataField("time")] public TimeSpan Time;
|
||||
|
||||
/// <inheritdoc cref="DepartmentTimeRequirement.Inverted"/>
|
||||
[DataField("inverted")] public bool Inverted;
|
||||
}
|
||||
|
||||
public static class JobRequirements
|
||||
|
||||
Reference in New Issue
Block a user