using Content.Shared.Destructible.Thresholds;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.GameTicking.Components;
///
/// Component attached to all gamerule entities.
/// Used to both track the entity as well as store basic data
///
[RegisterComponent, EntityCategory("GameRules")]
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;
///
/// If true, this rule not having enough players will cancel the preset selection.
/// If false, it will simply not run silently.
///
[DataField]
public bool CancelPresetOnTooFewPlayers = true;
///
/// A delay for when the rule the is started and when the starting logic actually runs.
///
[DataField]
public MinMax? Delay;
}
///
/// 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);