Skip to content

Commit

Permalink
Fixed (?) event spam (SerbiaStrong-220#1870)
Browse files Browse the repository at this point in the history
  • Loading branch information
DexlerXD authored Sep 15, 2024
1 parent 0e3c5d9 commit 408b94f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ public sealed class BasicStationEventSchedulerSystem : GameRuleSystem<BasicStati
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly EventManagerSystem _event = default!;

public const float MinEventTime = 60 * 8; //SS220 Event_spawn_decrease
public const float MaxEventTime = 60 * 15; //SS220 Event_spawn_decrease

protected override void Started(EntityUid uid, BasicStationEventSchedulerComponent component, GameRuleComponent gameRule,
GameRuleStartedEvent args)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ public sealed partial class BasicStationEventSchedulerComponent : Component
/// How long the the scheduler waits to begin starting rules.
/// </summary>
[DataField]
public float MinimumTimeUntilFirstEvent = 200;
public float MinimumTimeUntilFirstEvent = 300f; //SS220 Event_spawn_decrease

/// <summary>
/// The minimum and maximum time between rule starts in seconds.
/// </summary>
[DataField]
public MinMax MinMaxEventTiming = new(3 * 60, 10 * 60);
public MinMax MinMaxEventTiming = new(60 * 8, 60 * 15); //SS220 Event_spawn_decrease

/// <summary>
/// How long until the next check for an event runs, is initially set based on MinimumTimeUntilFirstEvent & MinMaxEventTiming.
Expand Down
10 changes: 10 additions & 0 deletions Content.Server/StationEvents/EventManagerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public void RunRandomEvent()
Log.Error(errStr);
return;
}
// SS220 Проверка на отключенные случаные события в текущем пресете

var randomEvent = PickRandomEvent();

Expand All @@ -63,6 +64,15 @@ public void RunRandomEvent()
/// </summary>
public void RunRandomEvent(EntityTableSelector limitedEventsTable)
{
// SS220 Проверка на отключенные случаные события в текущем пресете
if (GameTicker.CurrentPreset != null && GameTicker.CurrentPreset.DisableRandomEvents)
{
var errStr = Loc.GetString("station-event-system-run-random-event-disablerandevents");
Log.Error(errStr);
return;
}
// SS220 Проверка на отключенные случаные события в текущем пресете

if (!TryBuildLimitedEvents(limitedEventsTable, out var limitedEvents))
{
Log.Warning("Provided event table could not build dict!");
Expand Down

0 comments on commit 408b94f

Please sign in to comment.