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 Content.Shared.Players.PlayTimeTracking;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -10,14 +10,14 @@ namespace Content.Shared.Roles
|
|||||||
/// Abstract class for playtime and other requirements for role gates.
|
/// Abstract class for playtime and other requirements for role gates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ImplicitDataDefinitionForInheritors]
|
[ImplicitDataDefinitionForInheritors]
|
||||||
public abstract class JobRequirement
|
public abstract class JobRequirement{}
|
||||||
{
|
|
||||||
[DataField("inverted")] public bool Inverted;
|
|
||||||
}
|
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class DepartmentTimeRequirement : JobRequirement
|
public sealed class DepartmentTimeRequirement : JobRequirement
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Which department needs the required amount of time.
|
||||||
|
/// </summary>
|
||||||
[DataField("department", customTypeSerializer: typeof(PrototypeIdSerializer<DepartmentPrototype>))]
|
[DataField("department", customTypeSerializer: typeof(PrototypeIdSerializer<DepartmentPrototype>))]
|
||||||
public string Department = default!;
|
public string Department = default!;
|
||||||
|
|
||||||
@@ -25,6 +25,15 @@ namespace Content.Shared.Roles
|
|||||||
/// How long (in seconds) this requirement is.
|
/// How long (in seconds) this requirement is.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("time")] public TimeSpan Time;
|
[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]
|
[UsedImplicitly]
|
||||||
@@ -36,19 +45,21 @@ namespace Content.Shared.Roles
|
|||||||
[DataField("role", customTypeSerializer: typeof(PrototypeIdSerializer<PlayTimeTrackerPrototype>))]
|
[DataField("role", customTypeSerializer: typeof(PrototypeIdSerializer<PlayTimeTrackerPrototype>))]
|
||||||
public string Role = default!;
|
public string Role = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc cref="DepartmentTimeRequirement.Time"/>
|
||||||
/// How long (in seconds) this requirement is.
|
|
||||||
/// </summary>
|
|
||||||
[DataField("time")] public TimeSpan Time;
|
[DataField("time")] public TimeSpan Time;
|
||||||
|
|
||||||
|
/// <inheritdoc cref="DepartmentTimeRequirement.Inverted"/>
|
||||||
|
[DataField("inverted")] public bool Inverted;
|
||||||
}
|
}
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class OverallPlaytimeRequirement : JobRequirement
|
public sealed class OverallPlaytimeRequirement : JobRequirement
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <inheritdoc cref="DepartmentTimeRequirement.Time"/>
|
||||||
/// How long (in seconds) this requirement is.
|
|
||||||
/// </summary>
|
|
||||||
[DataField("time")] public TimeSpan Time;
|
[DataField("time")] public TimeSpan Time;
|
||||||
|
|
||||||
|
/// <inheritdoc cref="DepartmentTimeRequirement.Inverted"/>
|
||||||
|
[DataField("inverted")] public bool Inverted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class JobRequirements
|
public static class JobRequirements
|
||||||
|
|||||||
Reference in New Issue
Block a user