Refactor Game Modes (#5819)

This commit is contained in:
Vera Aguilera Puerto
2021-12-21 18:56:47 +01:00
committed by GitHub
parent 8be5c25bd4
commit 8831d08229
59 changed files with 1969 additions and 1713 deletions

View File

@@ -1,5 +1,6 @@
using System;
using Content.Server.Administration;
using Content.Server.GameTicking.Presets;
using Content.Shared;
using Content.Shared.Administration;
using Content.Shared.CCVar;
@@ -18,14 +19,14 @@ namespace Content.Server.GameTicking.Commands
public string Help => $"Usage: {Command} / {Command} <preset>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
Type? preset = null;
GamePresetPrototype? preset = null;
var presetName = string.Join(" ", args);
var ticker = EntitySystem.Get<GameTicker>();
if (args.Length > 0)
{
if (!ticker.TryGetPreset(presetName, out preset))
if (!ticker.TryFindGamePreset(presetName, out preset))
{
shell.WriteLine($"No preset found with name {presetName}");
return;
@@ -39,7 +40,7 @@ namespace Content.Server.GameTicking.Commands
if (preset != null)
{
ticker.SetStartPreset(preset);
ticker.SetGamePreset(preset);
}
shell.WriteLine($"Enabling the lobby and restarting the round.{(preset == null ? "" : $"\nPreset set to {presetName}")}");