CatStation/Content.Server/GameTicking/Rules/SubGamemodesSystem.cs
Whatstone 27ca7ebbc6
Cleanup: Resolve GameRule warnings. (#46094)
* Resolve StationEvent warnings

* fix misuses of ent after rename, paracusia flip

* oh god more rules

* comments, whitespace, unnecessary precision

* comments, NotNull->IsNull

oops

* more consistent ent vs. ent.Owner, whitespace

* Greytide: "with accress from... access groups"
2026-09-20 17:55:24 +00:00

26 lines
939 B
C#

using Content.Server.GameTicking.Rules.Components;
using Content.Shared.GameTicking.Components;
using Content.Shared.GameTicking.Rules;
using Content.Shared.Storage;
namespace Content.Server.GameTicking.Rules;
/// <summary>
/// A handler for rules adding one or more additional rules when a first is added.
/// </summary>
/// <seealso cref="SubGamemodesComponent"/>
public sealed partial class SubGamemodesSystem : GameRuleSystem<SubGamemodesComponent>
{
protected override void Added(Entity<SubGamemodesComponent, GameRuleComponent> ent, ref GameRuleAddedEvent args)
{
var picked = EntitySpawnCollection.GetSpawns(ent.Comp1.Rules, RobustRandom);
foreach (var id in picked)
{
if (GameTicker.IsIgnored(id))
continue;
Log.Info($"Starting gamerule {id} as a subgamemode of {ToPrettyString(ent.Owner):rule}");
GameTicker.AddGameRule(id);
}
}
}