Skip to content

Commit

Permalink
fewer but more easily configurable events
Browse files Browse the repository at this point in the history
  • Loading branch information
DEATHB4DEFEAT committed Jun 24, 2024
1 parent fcea083 commit f53f530
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
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

0 comments on commit f53f530

Please sign in to comment.