From 1ef3dbe0757bb047ba0448651b75de251c5d8ddc Mon Sep 17 00:00:00 2001
From: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
Date: Wed, 15 Jan 2025 14:24:09 -0500
Subject: [PATCH 1/8] nukeblops
---
.../GameTicking/Presets/GamePresetPrototype.cs | 11 +++++++++++
.../GameTicking/Rules/SecretRuleSystem.cs | 16 ++++++++++++++++
Resources/Prototypes/game_presets.yml | 6 ++++--
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/Content.Server/GameTicking/Presets/GamePresetPrototype.cs b/Content.Server/GameTicking/Presets/GamePresetPrototype.cs
index 4731364ace2..db4df0eec00 100644
--- a/Content.Server/GameTicking/Presets/GamePresetPrototype.cs
+++ b/Content.Server/GameTicking/Presets/GamePresetPrototype.cs
@@ -33,6 +33,17 @@ public sealed partial class GamePresetPrototype : IPrototype
[DataField("maxPlayers")]
public int? MaxPlayers;
+ // Begin Imp
+ ///
+ /// Ensures that this gamemode does not get selected for a number of rounds
+ /// by something like Secret. This is not considered when the preset is forced.
+ ///
+ [DataField("cooldown")]
+ public int Cooldown = 0;
+ // End Imp
+
+
+
[DataField("rules", customTypeSerializer: typeof(PrototypeIdListSerializer))]
public IReadOnlyList Rules { get; private set; } = Array.Empty();
diff --git a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
index e82cecde368..d29e8e0e4cb 100644
--- a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
+++ b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
@@ -22,6 +22,11 @@ public sealed class SecretRuleSystem : GameRuleSystem
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly IComponentFactory _compFact = default!;
+ [Dependency] private readonly GameTicker _ticker = default!; // begin Imp
+
+ // Dictionary that contains the minimum round number for certain preset
+ // prototypes to be allowed to roll again
+ private static Dictionary, int> _nextRoundAllowed = new(); // end Imp
private string _ruleCompName = default!;
@@ -46,6 +51,12 @@ protected override void Added(EntityUid uid, SecretRuleComponent component, Game
Log.Info($"Selected {preset.ID} as the secret preset.");
_adminLogger.Add(LogType.EventStarted, $"Selected {preset.ID} as the secret preset.");
+ if (preset.Cooldown > 0) // Begin Imp
+ {
+ _nextRoundAllowed[preset.ID] = _ticker.RoundId + preset.Cooldown + 1;
+ Log.Info($"{preset.ID} is now on cooldown until {_nextRoundAllowed[preset.ID]}");
+ } // End Imp
+
foreach (var rule in preset.Rules)
{
EntityUid ruleEnt;
@@ -166,6 +177,11 @@ private bool CanPick([NotNullWhen(true)] GamePresetPrototype? selected, int play
if (ruleComp.MinPlayers > players && ruleComp.CancelPresetOnTooFewPlayers)
return false;
}
+ if (_nextRoundAllowed.ContainsKey(selected.ID) && _nextRoundAllowed[selected.ID] > _ticker.RoundId) // Begin Imp
+ {
+ Log.Info($"Skipping preset {selected.ID} (Not available until round {_nextRoundAllowed[selected.ID]}");
+ return false;
+ } // End Imp
return true;
}
diff --git a/Resources/Prototypes/game_presets.yml b/Resources/Prototypes/game_presets.yml
index f27d5599f5b..2a5439287d6 100644
--- a/Resources/Prototypes/game_presets.yml
+++ b/Resources/Prototypes/game_presets.yml
@@ -5,6 +5,7 @@
name: survival-title
showInVote: true # secret # DeltaV - Me when the survival. Used for periapsis.
description: survival-description
+ cooldown: 2 # Imp - Can't occur thrice
rules:
- MeteorSwarmScheduler
- RampingStationEventScheduler
@@ -96,7 +97,7 @@
showInVote: true #4boring4vote # DeltaV - Enable greenshift in gamemode vote
description: greenshift-description
rules:
- - SpaceTrafficControlFriendlyEventScheduler
+ - SpaceTrafficControlFriendlyEventScheduler
- BasicRoundstartVariation
- GlimmerEventScheduler # DeltaV
@@ -133,7 +134,7 @@
showInVote: false #Admin Use
description: secret-description
rules:
- - SpaceTrafficControlFriendlyEventScheduler
+ - SpaceTrafficControlFriendlyEventScheduler
- BasicRoundstartVariation
- GlimmerEventScheduler # DeltaV
@@ -185,6 +186,7 @@
name: nukeops-title
description: nukeops-description
showInVote: false
+ cooldown: 1 # Imp - Can't occur back to back
rules:
- Nukeops
- SubGamemodesRule
From 569aa0adaedc5c88ff5c095872325053a5b8a7e4 Mon Sep 17 00:00:00 2001
From: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
Date: Wed, 15 Jan 2025 14:53:34 -0500
Subject: [PATCH 2/8] Update game_presets.yml
i hate whitespace
Signed-off-by: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
---
Resources/Prototypes/game_presets.yml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Resources/Prototypes/game_presets.yml b/Resources/Prototypes/game_presets.yml
index 2a5439287d6..8fe5022f115 100644
--- a/Resources/Prototypes/game_presets.yml
+++ b/Resources/Prototypes/game_presets.yml
@@ -97,7 +97,7 @@
showInVote: true #4boring4vote # DeltaV - Enable greenshift in gamemode vote
description: greenshift-description
rules:
- - SpaceTrafficControlFriendlyEventScheduler
+ - SpaceTrafficControlFriendlyEventScheduler
- BasicRoundstartVariation
- GlimmerEventScheduler # DeltaV
@@ -134,7 +134,7 @@
showInVote: false #Admin Use
description: secret-description
rules:
- - SpaceTrafficControlFriendlyEventScheduler
+ - SpaceTrafficControlFriendlyEventScheduler
- BasicRoundstartVariation
- GlimmerEventScheduler # DeltaV
@@ -224,6 +224,7 @@
- zomber
name: zombie-title
description: zombie-description
+ cooldown: 2 # Imp - Can't occur thrice
showInVote: false
rules:
- Zombie
From 810cc41ad5ba1a170934e4c559bd9638a0f15b35 Mon Sep 17 00:00:00 2001
From: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
Date: Wed, 15 Jan 2025 14:54:20 -0500
Subject: [PATCH 3/8] Update GamePresetPrototype.cs
Signed-off-by: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
---
Content.Server/GameTicking/Presets/GamePresetPrototype.cs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/Content.Server/GameTicking/Presets/GamePresetPrototype.cs b/Content.Server/GameTicking/Presets/GamePresetPrototype.cs
index db4df0eec00..f82f0c25c70 100644
--- a/Content.Server/GameTicking/Presets/GamePresetPrototype.cs
+++ b/Content.Server/GameTicking/Presets/GamePresetPrototype.cs
@@ -38,12 +38,10 @@ public sealed partial class GamePresetPrototype : IPrototype
/// Ensures that this gamemode does not get selected for a number of rounds
/// by something like Secret. This is not considered when the preset is forced.
///
- [DataField("cooldown")]
+ [DataField]
public int Cooldown = 0;
// End Imp
-
-
[DataField("rules", customTypeSerializer: typeof(PrototypeIdListSerializer))]
public IReadOnlyList Rules { get; private set; } = Array.Empty();
From 83efcc7de5ab7e10e1acc105a17cc79c24a19fa5 Mon Sep 17 00:00:00 2001
From: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
Date: Thu, 16 Jan 2025 09:13:25 -0500
Subject: [PATCH 4/8] Update game_presets.yml
Signed-off-by: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
---
Resources/Prototypes/game_presets.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Resources/Prototypes/game_presets.yml b/Resources/Prototypes/game_presets.yml
index 8fe5022f115..34154a1a0f9 100644
--- a/Resources/Prototypes/game_presets.yml
+++ b/Resources/Prototypes/game_presets.yml
@@ -156,6 +156,7 @@
- tator
name: traitor-title
description: traitor-description
+ cooldown: 2 # Imp - Can't occur thrice
showInVote: false
rules:
- Traitor
From f3b9723a98a5f66a5987888fb9b9f273b6144e22 Mon Sep 17 00:00:00 2001
From: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
Date: Thu, 16 Jan 2025 09:13:46 -0500
Subject: [PATCH 5/8] Update game_presets.yml
Signed-off-by: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
---
Resources/Prototypes/game_presets.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Resources/Prototypes/game_presets.yml b/Resources/Prototypes/game_presets.yml
index 34154a1a0f9..448fde656c0 100644
--- a/Resources/Prototypes/game_presets.yml
+++ b/Resources/Prototypes/game_presets.yml
@@ -225,7 +225,7 @@
- zomber
name: zombie-title
description: zombie-description
- cooldown: 2 # Imp - Can't occur thrice
+ cooldown: 1 # Imp - Can't occur thrice
showInVote: false
rules:
- Zombie
From 0fa149ef5ccfb121d20ad9bd505cf0adfd7b88b6 Mon Sep 17 00:00:00 2001
From: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
Date: Thu, 16 Jan 2025 12:23:26 -0500
Subject: [PATCH 6/8] Update game_presets.yml
Signed-off-by: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
---
Resources/Prototypes/game_presets.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Resources/Prototypes/game_presets.yml b/Resources/Prototypes/game_presets.yml
index 448fde656c0..948a9566225 100644
--- a/Resources/Prototypes/game_presets.yml
+++ b/Resources/Prototypes/game_presets.yml
@@ -187,7 +187,7 @@
name: nukeops-title
description: nukeops-description
showInVote: false
- cooldown: 1 # Imp - Can't occur back to back
+ cooldown: 2 # Imp - Can't occur thrice
rules:
- Nukeops
- SubGamemodesRule
@@ -225,7 +225,7 @@
- zomber
name: zombie-title
description: zombie-description
- cooldown: 1 # Imp - Can't occur thrice
+ cooldown: 2 # Imp - Can't occur thrice
showInVote: false
rules:
- Zombie
From 17de7f7506808bffb07b425e1924df371c6be176 Mon Sep 17 00:00:00 2001
From: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
Date: Fri, 17 Jan 2025 23:07:41 -0500
Subject: [PATCH 7/8] cvar making
---
.../GameTicking/Rules/SecretRuleSystem.cs | 26 ++++++++++++-------
Content.Shared/_DV/CCVars/DCCVars.cs | 6 +++++
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
index d29e8e0e4cb..43b8fc40a1a 100644
--- a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
+++ b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
@@ -4,6 +4,7 @@
using Content.Server.Chat.Managers;
using Content.Server.GameTicking.Presets;
using Content.Server.GameTicking.Rules.Components;
+using Content.Shared._DV.CCVars;
using Content.Shared.GameTicking.Components;
using Content.Shared.Random;
using Content.Shared.CCVar;
@@ -51,13 +52,16 @@ protected override void Added(EntityUid uid, SecretRuleComponent component, Game
Log.Info($"Selected {preset.ID} as the secret preset.");
_adminLogger.Add(LogType.EventStarted, $"Selected {preset.ID} as the secret preset.");
- if (preset.Cooldown > 0) // Begin Imp
+ if (_configurationManager.GetCVar(DCCVars.EnableBacktoBack) == true) // DeltaV
{
- _nextRoundAllowed[preset.ID] = _ticker.RoundId + preset.Cooldown + 1;
- Log.Info($"{preset.ID} is now on cooldown until {_nextRoundAllowed[preset.ID]}");
- } // End Imp
+ if (preset.Cooldown > 0) // Begin Imp
+ {
+ _nextRoundAllowed[preset.ID] = _ticker.RoundId + preset.Cooldown + 1;
+ Log.Info($"{preset.ID} is now on cooldown until {_nextRoundAllowed[preset.ID]}");
+ } // End Imp
+ } // DeltaV
- foreach (var rule in preset.Rules)
+foreach (var rule in preset.Rules)
{
EntityUid ruleEnt;
@@ -177,11 +181,15 @@ private bool CanPick([NotNullWhen(true)] GamePresetPrototype? selected, int play
if (ruleComp.MinPlayers > players && ruleComp.CancelPresetOnTooFewPlayers)
return false;
}
- if (_nextRoundAllowed.ContainsKey(selected.ID) && _nextRoundAllowed[selected.ID] > _ticker.RoundId) // Begin Imp
+
+ if (_configurationManager.GetCVar(DCCVars.EnableBacktoBack) == true) // DeltaV
{
- Log.Info($"Skipping preset {selected.ID} (Not available until round {_nextRoundAllowed[selected.ID]}");
- return false;
- } // End Imp
+ if (_nextRoundAllowed.ContainsKey(selected.ID) && _nextRoundAllowed[selected.ID] > _ticker.RoundId) // Begin Imp
+ {
+ Log.Info($"Skipping preset {selected.ID} (Not available until round {_nextRoundAllowed[selected.ID]}");
+ return false;
+ } // End Imp
+ } // DeltaV
return true;
}
diff --git a/Content.Shared/_DV/CCVars/DCCVars.cs b/Content.Shared/_DV/CCVars/DCCVars.cs
index d28faf854d2..059f16732da 100644
--- a/Content.Shared/_DV/CCVars/DCCVars.cs
+++ b/Content.Shared/_DV/CCVars/DCCVars.cs
@@ -155,4 +155,10 @@ public sealed class DCCVars
///
public static readonly CVarDef DiscordReplyColor =
CVarDef.Create("admin.discord_reply_color", string.Empty, CVar.SERVERONLY);
+
+ ///
+ /// Whether or not to disable the preset selecting test rule from running. Should be disabled in production. DeltaV specific, attached to Impstation Secret concurrent feature.
+ ///
+ public static readonly CVarDef EnableBacktoBack =
+ CVarDef.Create("game.disable_preset_test", false, CVar.SERVERONLY);
}
From 691d1778ec0e62646ea762a7b863c101e2dc4024 Mon Sep 17 00:00:00 2001
From: Lyndomen <49795619+Lyndomen@users.noreply.github.com>
Date: Sat, 18 Jan 2025 19:19:21 -0500
Subject: [PATCH 8/8] untroll
---
Content.Server/GameTicking/Rules/SecretRuleSystem.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
index 43b8fc40a1a..d38b798bc58 100644
--- a/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
+++ b/Content.Server/GameTicking/Rules/SecretRuleSystem.cs
@@ -4,7 +4,7 @@
using Content.Server.Chat.Managers;
using Content.Server.GameTicking.Presets;
using Content.Server.GameTicking.Rules.Components;
-using Content.Shared._DV.CCVars;
+using Content.Shared._DV.CCVars; // DeltaV
using Content.Shared.GameTicking.Components;
using Content.Shared.Random;
using Content.Shared.CCVar;
@@ -61,7 +61,7 @@ protected override void Added(EntityUid uid, SecretRuleComponent component, Game
} // End Imp
} // DeltaV
-foreach (var rule in preset.Rules)
+ foreach (var rule in preset.Rules)
{
EntityUid ruleEnt;