CatStation/Content.Shared/GameTicking/Rules/Components/DynamicRuleComponent.cs
Jessica M 2dbcfa7649
Tweak dynamic rule a bit (#46249)
* lets see how well it works ???

* MOVE the calm events and rat king and stuff into the dynamic

* lets see about that shit
2026-09-30 01:15:05 +00:00

77 lines
2 KiB
C#

using Content.Shared.EntityTable.EntitySelectors;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.GameTicking.Rules.Components;
/// <summary>
/// Gamerule the spawns multiple antags at intervals based on a budget
/// </summary>
[RegisterComponent, AutoGenerateComponentPause]
public sealed partial class DynamicRuleComponent : Component
{
/// <summary>
/// The total budget for antags.
/// </summary>
[DataField]
public float Budget;
/// <summary>
/// The last time budget was updated.
/// </summary>
[DataField]
public TimeSpan LastBudgetUpdate;
/// <summary>
/// The amount of budget accumulated every second.
/// </summary>
[DataField]
public float BudgetPerSecond;
[DataField]
public float MinBudgetPerSecond = 0.05f;
[DataField]
public float MaxBudgetPerSecond = 0.1f;
/// <summary>
/// The minimum or lower bound for budgets to start at.
/// </summary>
[DataField]
public int StartingBudgetMin = 200;
/// <summary>
/// The maximum or upper bound for budgets to start at.
/// </summary>
[DataField]
public int StartingBudgetMax = 350;
/// <summary>
/// The time at which the next rule will start
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
public TimeSpan NextRuleTime;
/// <summary>
/// Minimum delay between rules
/// </summary>
[DataField]
public TimeSpan MinRuleInterval = TimeSpan.FromMinutes(5);
/// <summary>
/// Maximum delay between rules
/// </summary>
[DataField]
public TimeSpan MaxRuleInterval = TimeSpan.FromMinutes(15);
/// <summary>
/// A table of rules that are picked from.
/// </summary>
[DataField]
public EntityTableSelector Table = new NoneSelector();
/// <summary>
/// The rules that have been spawned
/// </summary>
[DataField]
public List<EntityUid> Rules = new();
}