@@ -2,8 +2,10 @@ using Content.Server.GameTicking.Presets;
|
|||||||
using Content.Server.GameTicking.Rules.Components;
|
using Content.Server.GameTicking.Rules.Components;
|
||||||
using Content.Shared.Random;
|
using Content.Shared.Random;
|
||||||
using Content.Shared.Random.Helpers;
|
using Content.Shared.Random.Helpers;
|
||||||
|
using Content.Shared.CCVar;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
|
|
||||||
namespace Content.Server.GameTicking.Rules;
|
namespace Content.Server.GameTicking.Rules;
|
||||||
|
|
||||||
@@ -11,6 +13,7 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
||||||
|
|
||||||
protected override void Started(EntityUid uid, SecretRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
protected override void Started(EntityUid uid, SecretRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
||||||
{
|
{
|
||||||
@@ -32,7 +35,8 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
|
|||||||
{
|
{
|
||||||
// TODO: This doesn't consider what can't start due to minimum player count,
|
// TODO: This doesn't consider what can't start due to minimum player count,
|
||||||
// but currently there's no way to know anyway as they use cvars.
|
// but currently there's no way to know anyway as they use cvars.
|
||||||
var preset = _prototypeManager.Index<WeightedRandomPrototype>("Secret").Pick(_random);
|
var presetString = _configurationManager.GetCVar(CCVars.SecretWeightPrototype);
|
||||||
|
var preset = _prototypeManager.Index<WeightedRandomPrototype>(presetString).Pick(_random);
|
||||||
Logger.InfoS("gamepreset", $"Selected {preset} for secret.");
|
Logger.InfoS("gamepreset", $"Selected {preset} for secret.");
|
||||||
|
|
||||||
var rules = _prototypeManager.Index<GamePresetPrototype>(preset).Rules;
|
var rules = _prototypeManager.Index<GamePresetPrototype>(preset).Rules;
|
||||||
|
|||||||
@@ -351,6 +351,12 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<float> RoundRestartTime =
|
public static readonly CVarDef<float> RoundRestartTime =
|
||||||
CVarDef.Create("game.round_restart_time", 120f, CVar.SERVERONLY);
|
CVarDef.Create("game.round_restart_time", 120f, CVar.SERVERONLY);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The prototype to use for secret weights.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<string> SecretWeightPrototype =
|
||||||
|
CVarDef.Create("game.secret_weight_prototype", "Secret", CVar.SERVERONLY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Discord
|
* Discord
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user