SubGamemodesSystem.cs 664 B

123456789101112131415161718
  1. using Content.Server.GameTicking.Rules.Components;
  2. using Content.Shared.GameTicking.Components;
  3. using Content.Shared.Storage;
  4. namespace Content.Server.GameTicking.Rules;
  5. public sealed class SubGamemodesSystem : GameRuleSystem<SubGamemodesComponent>
  6. {
  7. protected override void Added(EntityUid uid, SubGamemodesComponent comp, GameRuleComponent rule, GameRuleAddedEvent args)
  8. {
  9. var picked = EntitySpawnCollection.GetSpawns(comp.Rules, RobustRandom);
  10. foreach (var id in picked)
  11. {
  12. Log.Info($"Starting gamerule {id} as a subgamemode of {ToPrettyString(uid):rule}");
  13. GameTicker.AddGameRule(id);
  14. }
  15. }
  16. }