Multiantag Gamemode (#37783)

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: Southbridge <7013162+southbridge-fur@users.noreply.github.com>
Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
This commit is contained in:
Nemanja
2025-08-15 10:06:51 -04:00
committed by GitHub
parent b2c505df6a
commit f23e8c2861
19 changed files with 787 additions and 5 deletions

View File

@@ -0,0 +1,71 @@
using Content.Shared.EntityTable.EntitySelectors;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.GameTicking.Rules;
/// <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 = 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(10);
/// <summary>
/// Maximum delay between rules
/// </summary>
[DataField]
public TimeSpan MaxRuleInterval = TimeSpan.FromMinutes(30);
/// <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();
}