diff --git a/Content.Server/StationEvents/BasicStationEventSchedulerSystem.cs b/Content.Server/StationEvents/BasicStationEventSchedulerSystem.cs index a34f35b771..1000782da3 100644 --- a/Content.Server/StationEvents/BasicStationEventSchedulerSystem.cs +++ b/Content.Server/StationEvents/BasicStationEventSchedulerSystem.cs @@ -113,6 +113,7 @@ namespace Content.Server.StationEvents private EntityTableSystem? _entityTable; private IComponentFactory? _compFac; private IRobustRandom? _random; + private IPrototypeManager? _protoMan; /// /// Estimates the expected number of times an event will run over the course of X rounds, taking into account weights and @@ -129,12 +130,13 @@ namespace Content.Server.StationEvents /// to even exist) so I think it's fine. /// [CommandImplementation("simulate")] - public IEnumerable<(string, float)> Simulate([CommandArgument] Prototype eventSchedulerProto, [CommandArgument] int rounds, [CommandArgument] int playerCount, [CommandArgument] float roundEndMean, [CommandArgument] float roundEndStdDev) + public IEnumerable<(string, float)> Simulate([CommandArgument] EntProtoId eventSchedulerProto, [CommandArgument] int rounds, [CommandArgument] int playerCount, [CommandArgument] float roundEndMean, [CommandArgument] float roundEndStdDev) { _stationEvent ??= GetSys(); _entityTable ??= GetSys(); _compFac ??= IoCManager.Resolve(); _random ??= IoCManager.Resolve(); + _protoMan ??= IoCManager.Resolve(); var occurrences = new Dictionary(); @@ -143,7 +145,7 @@ namespace Content.Server.StationEvents occurrences.Add(ev.Key.ID, 0); } - eventSchedulerProto.Deconstruct(out EntityPrototype eventScheduler); + var eventScheduler = _protoMan.Index(eventSchedulerProto); if (!eventScheduler.TryGetComponent(out var basicScheduler, _compFac)) { @@ -178,16 +180,17 @@ namespace Content.Server.StationEvents } } - return occurrences.Select(p => (p.Key, (float) p.Value)).OrderByDescending(p => p.Item2); + return occurrences.Select(p => (p.Key, (float)p.Value)).OrderByDescending(p => p.Item2); } [CommandImplementation("lsprob")] - public IEnumerable<(string, float)> LsProb([CommandArgument] Prototype eventSchedulerProto) + public IEnumerable<(string, float)> LsProb([CommandArgument] EntProtoId eventSchedulerProto) { _compFac ??= IoCManager.Resolve(); _stationEvent ??= GetSys(); + _protoMan ??= IoCManager.Resolve(); - eventSchedulerProto.Deconstruct(out EntityPrototype eventScheduler); + var eventScheduler = _protoMan.Index(eventSchedulerProto); if (!eventScheduler.TryGetComponent(out var basicScheduler, _compFac)) yield break; @@ -205,12 +208,13 @@ namespace Content.Server.StationEvents } [CommandImplementation("lsprobtheoretical")] - public IEnumerable<(string, float)> LsProbTime([CommandArgument] Prototype eventSchedulerProto, [CommandArgument] int playerCount, [CommandArgument] float time) + public IEnumerable<(string, float)> LsProbTime([CommandArgument] EntProtoId eventSchedulerProto, [CommandArgument] int playerCount, [CommandArgument] float time) { _compFac ??= IoCManager.Resolve(); _stationEvent ??= GetSys(); + _protoMan ??= IoCManager.Resolve(); - eventSchedulerProto.Deconstruct(out EntityPrototype eventScheduler); + var eventScheduler = _protoMan.Index(eventSchedulerProto); if (!eventScheduler.TryGetComponent(out var basicScheduler, _compFac)) yield break; @@ -232,12 +236,13 @@ namespace Content.Server.StationEvents } [CommandImplementation("prob")] - public float Prob([CommandArgument] Prototype eventSchedulerProto, [CommandArgument] string eventId) + public float Prob([CommandArgument] EntProtoId eventSchedulerProto, [CommandArgument] string eventId) { _compFac ??= IoCManager.Resolve(); _stationEvent ??= GetSys(); + _protoMan ??= IoCManager.Resolve(); - eventSchedulerProto.Deconstruct(out EntityPrototype eventScheduler); + var eventScheduler = _protoMan.Index(eventSchedulerProto); if (!eventScheduler.TryGetComponent(out var basicScheduler, _compFac)) return 0f;