make thief a subgamemode (#25740)
* add SubGamemodes comp/sys * remove RuleChance from thief rule * use SubGamemodes for adding thief rule instead of adding ThiefRule component to random gamemodes * clean up thief rule prototype * add better logging + end rule if it fails to start * march 1st incident * preset ops * the dreaded --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
17
Content.Server/GameTicking/Rules/SubGamemodesSystem.cs
Normal file
17
Content.Server/GameTicking/Rules/SubGamemodesSystem.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Shared.Storage;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules;
|
||||
|
||||
public sealed class SubGamemodesSystem : GameRuleSystem<SubGamemodesComponent>
|
||||
{
|
||||
protected override void Added(EntityUid uid, SubGamemodesComponent comp, GameRuleComponent rule, GameRuleAddedEvent args)
|
||||
{
|
||||
var picked = EntitySpawnCollection.GetSpawns(comp.Rules, RobustRandom);
|
||||
foreach (var id in picked)
|
||||
{
|
||||
Log.Info($"Starting gamerule {id} as a subgamemode of {ToPrettyString(uid):rule}");
|
||||
GameTicker.AddGameRule(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user