Add active and ended game rule components, generic TryRoundStartAttempt and minPlayers field (#20564)

* Improve active game rule querying, add generic try round start attempt method, move minPlayers to GameRuleComponent

* Nukeops todo and cleanup

* Remove Active field

* Add EndedGameRuleComponent
This commit is contained in:
DrSmugleaf
2023-09-28 07:48:59 -07:00
committed by GitHub
parent 78091fb11d
commit 2f4b2cc887
7 changed files with 132 additions and 86 deletions

View File

@@ -9,25 +9,17 @@ namespace Content.Server.GameTicking.Rules.Components;
[RegisterComponent]
public sealed partial class GameRuleComponent : Component
{
/// <summary>
/// Whether or not the rule is active.
/// Is enabled after <see cref="GameRuleStartedEvent"/> and disabled after <see cref="GameRuleEndedEvent"/>
/// </summary>
[DataField("active")]
public bool Active;
/// <summary>
/// Game time when game rule was activated
/// </summary>
[DataField("activatedAt", customTypeSerializer:typeof(TimeOffsetSerializer))]
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan ActivatedAt;
/// <summary>
/// Whether or not the gamerule finished.
/// Used for tracking whether a non-active gamerule has been started before.
/// The minimum amount of players needed for this game rule.
/// </summary>
[DataField("ended")]
public bool Ended;
[DataField]
public int MinPlayers;
}
/// <summary>