Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fewer Mid-Round Events #486

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Components;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using JetBrains.Annotations;
using Robust.Shared.Configuration;
using Robust.Shared.Random;
using Robust.Shared.Toolshed;
using Robust.Shared.Utility;
Expand All @@ -20,6 +22,7 @@ public sealed class BasicStationEventSchedulerSystem : GameRuleSystem<BasicStati
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly EventManagerSystem _event = default!;
[Dependency] private readonly IConfigurationManager _config = default!;

protected override void Ended(EntityUid uid, BasicStationEventSchedulerComponent component, GameRuleComponent gameRule,
GameRuleEndedEvent args)
Expand Down Expand Up @@ -57,8 +60,8 @@ public override void Update(float frameTime)
/// </summary>
private void ResetTimer(BasicStationEventSchedulerComponent component)
{
// 5 - 25 minutes. TG does 3-10 but that's pretty frequent
component.TimeUntilNextEvent = _random.Next(300, 1500);
component.TimeUntilNextEvent = _random.Next(_config.GetCVar(CCVars.GameEventsBasicMinimumTime),
_config.GetCVar(CCVars.GameEventsBasicMaximumTime));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void PickNextEventTime(EntityUid uid, RampingStationEventSchedulerCompon
{
var mod = GetChaosModifier(uid, component);

// 4-12 minutes baseline. Will get faster over time as the chaos mod increases.
component.TimeUntilNextEvent = _random.NextFloat(240f / mod, 720f / mod);
component.TimeUntilNextEvent = _random.NextFloat(_cfg.GetCVar(CCVars.GameEventsRampingMinimumTime) / mod,
_cfg.GetCVar(CCVars.GameEventsRampingMaximumTime)) / mod;
}
}
31 changes: 29 additions & 2 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ public static readonly CVarDef<bool>
/// Close to how long you expect a round to last, so you'll probably have to tweak this on downstreams.
/// </summary>
public static readonly CVarDef<float>
EventsRampingAverageEndTime = CVarDef.Create("events.ramping_average_end_time", 40f, CVar.ARCHIVE | CVar.SERVERONLY);
EventsRampingAverageEndTime = CVarDef.Create("events.ramping_average_end_time", 120f, CVar.ARCHIVE | CVar.SERVERONLY);

/// <summary>
/// Average ending chaos modifier for the ramping event scheduler.
/// Max chaos chosen for a round will deviate from this
/// </summary>
public static readonly CVarDef<float>
EventsRampingAverageChaos = CVarDef.Create("events.ramping_average_chaos", 6f, CVar.ARCHIVE | CVar.SERVERONLY);
EventsRampingAverageChaos = CVarDef.Create("events.ramping_average_chaos", 4f, CVar.ARCHIVE | CVar.SERVERONLY);

/*
* Game
Expand Down Expand Up @@ -173,6 +173,33 @@ public static readonly CVarDef<string>
public static readonly CVarDef<bool>
GameLobbyEnableWin = CVarDef.Create("game.enablewin", true, CVar.ARCHIVE);

/// <summary>
/// Minimum time between Basic station events in seconds
/// </summary>
public static readonly CVarDef<int> // 15 Minutes
GameEventsBasicMinimumTime = CVarDef.Create("game.events_basic_minimum_time", 900, CVar.SERVERONLY);

/// <summary>
/// Maximum time between Basic station events in seconds
/// </summary>
public static readonly CVarDef<int> // 35 Minutes
GameEventsBasicMaximumTime = CVarDef.Create("game.events_basic_maximum_time", 2100, CVar.SERVERONLY);

/// <summary>
/// Minimum time between Ramping station events in seconds
/// </summary>
public static readonly CVarDef<int> // 20 Minutes
GameEventsRampingMinimumTime = CVarDef.Create("game.events_ramping_minimum_time", 1200, CVar.SERVERONLY);

/// <summary>
/// Maximum time between Ramping station events in seconds
/// </summary>
public static readonly CVarDef<int> // 45 Minutes
GameEventsRampingMaximumTime = CVarDef.Create("game.events_ramping_maximum_time", 2700, CVar.SERVERONLY);

/// <summary>
///

/// <summary>
/// Controls the maximum number of character slots a player is allowed to have.
/// </summary>
Expand Down
Loading