using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.GameTicking.Rules.Components;
///
/// Component attached to all gamerule entities.
/// Used to both track the entity as well as store basic data
///
[RegisterComponent]
public sealed partial class GameRuleComponent : Component
{
///
/// Game time when game rule was activated
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan ActivatedAt;
///
/// The minimum amount of players needed for this game rule.
///
[DataField]
public int MinPlayers;
}
///
/// Raised when a rule is added but hasn't formally begun yet.
/// Good for announcing station events and other such things.
///
[ByRefEvent]
public readonly record struct GameRuleAddedEvent(EntityUid RuleEntity, string RuleId);
///
/// Raised when the rule actually begins.
/// Player-facing logic should begin here.
///
[ByRefEvent]
public readonly record struct GameRuleStartedEvent(EntityUid RuleEntity, string RuleId);
///
/// Raised when the rule ends.
/// Do cleanup and other such things here.
///
[ByRefEvent]
public readonly record struct GameRuleEndedEvent(EntityUid RuleEntity, string RuleId);