Фиксы тестов
This commit is contained in:
parent
348083ca15
commit
2638cd0709
5 changed files with 44 additions and 34 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.Server._Sunrise.StationCentComm;
|
||||
using Content.Server._Sunrise.TransitHub;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.GameTicking.Presets;
|
||||
|
|
@ -78,7 +79,7 @@ public sealed class NukeOpsTest
|
|||
Assert.That(entMan.Count<MapGridComponent>(), Is.Zero);
|
||||
Assert.That(entMan.Count<StationMapComponent>(), Is.Zero);
|
||||
Assert.That(entMan.Count<StationMemberComponent>(), Is.Zero);
|
||||
Assert.That(entMan.Count<StationCentCommComponent>(), Is.Zero); // Sunrise-Edit
|
||||
Assert.That(entMan.Count<StationTransitHubComponent>(), Is.Zero); // Sunrise-Edit
|
||||
|
||||
// And no nukie related components
|
||||
Assert.That(entMan.Count<NukeopsRuleComponent>(), Is.Zero);
|
||||
|
|
@ -106,7 +107,7 @@ public sealed class NukeOpsTest
|
|||
// Maps now exist
|
||||
Assert.That(entMan.Count<MapComponent>(), Is.GreaterThan(0));
|
||||
Assert.That(entMan.Count<MapGridComponent>(), Is.GreaterThan(0));
|
||||
Assert.That(entMan.Count<StationCentCommComponent>(), Is.EqualTo(1));
|
||||
Assert.That(entMan.Count<StationTransitHubComponent>(), Is.EqualTo(1)); // Sunrise-Edit
|
||||
|
||||
// And we now have nukie related components
|
||||
Assert.That(entMan.Count<NukeopsRuleComponent>(), Is.EqualTo(1));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Robust.Shared.Prototypes;
|
|||
|
||||
namespace Content.Server.GameTicking.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
[AdminCommand(AdminFlags.Host)]
|
||||
sealed class ForcePresetCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _e = default!;
|
||||
|
|
@ -38,14 +38,6 @@ namespace Content.Server.GameTicking.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
// Sunrise-Start
|
||||
if (type.Hide)
|
||||
{
|
||||
shell.WriteError(Loc.GetString("set-game-preset-preset-error", ("preset", args[0])));
|
||||
return;
|
||||
}
|
||||
// Sunrise-End
|
||||
|
||||
ticker.SetGamePreset(type, true);
|
||||
shell.WriteLine($"Forced the game to start with preset {name}.");
|
||||
ticker.UpdateInfoText();
|
||||
|
|
@ -55,19 +47,10 @@ namespace Content.Server.GameTicking.Commands
|
|||
{
|
||||
if (args.Length == 1)
|
||||
{
|
||||
var gamePresets = IoCManager.Resolve<IPrototypeManager>().EnumeratePrototypes<GamePresetPrototype>()
|
||||
.OrderBy(p => p.ID);
|
||||
|
||||
// Sunrise-Start
|
||||
var options = new List<string>();
|
||||
foreach (var preset in gamePresets)
|
||||
{
|
||||
if (preset.Hide)
|
||||
continue;
|
||||
|
||||
options.Add(preset.ID);
|
||||
}
|
||||
// Sunrise-End
|
||||
var options = IoCManager.Resolve<IPrototypeManager>()
|
||||
.EnumeratePrototypes<GamePresetPrototype>()
|
||||
.OrderBy(p => p.ID)
|
||||
.Select(p => p.ID);
|
||||
|
||||
return CompletionResult.FromHintOptions(options, "<preset>");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Content.Server._Sunrise.PlanetPrison
|
|||
{
|
||||
if (!TryComp<MindComponent>(uid, out var mind) || mind.OwnedEntity == null)
|
||||
return;
|
||||
if (HasComp<PlanetPrisonerRoleComponent>(uid)) // don't show both briefings
|
||||
if (HasComp<PlanetPrisonerRoleComponent>(uid))
|
||||
return;
|
||||
args.Append(Loc.GetString("planet-prisoner-role-greeting"));
|
||||
}
|
||||
|
|
@ -54,6 +54,8 @@ namespace Content.Server._Sunrise.PlanetPrison
|
|||
private void OnObjectivesTextPrepend(EntityUid uid, PlanetPrisonRuleComponent comp, ref ObjectivesTextPrependEvent args)
|
||||
{
|
||||
var planetPrisonRule = GetPlanetPrisonRule();
|
||||
if (planetPrisonRule == null)
|
||||
return;
|
||||
args.Text += Loc.GetString("planet-prison-round-end-result", ("count", planetPrisonRule.EscapedPrisoners.Count));
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +73,9 @@ namespace Content.Server._Sunrise.PlanetPrison
|
|||
NextTick += RefreshCooldown;
|
||||
|
||||
var planetPrisonRule = GetPlanetPrisonRule();
|
||||
if (planetPrisonRule == null)
|
||||
return;
|
||||
|
||||
var planetPrisonStation = EntityQuery<PlanetPrisonStationComponent>().FirstOrDefault();
|
||||
if (planetPrisonStation == null || planetPrisonStation.PrisonGrid == EntityUid.Invalid)
|
||||
return;
|
||||
|
|
@ -112,14 +117,16 @@ namespace Content.Server._Sunrise.PlanetPrison
|
|||
}
|
||||
}
|
||||
|
||||
public PlanetPrisonRuleComponent GetPlanetPrisonRule()
|
||||
public PlanetPrisonRuleComponent? GetPlanetPrisonRule()
|
||||
{
|
||||
var planetPrisonRule = EntityQuery<PlanetPrisonRuleComponent>().FirstOrDefault();
|
||||
if (planetPrisonRule != null)
|
||||
return planetPrisonRule;
|
||||
return planetPrisonRule;
|
||||
}
|
||||
|
||||
public PlanetPrisonRuleComponent StartPlanetPrisonRule()
|
||||
{
|
||||
_gameTicker.StartGameRule(GameRule, out var ruleEntity);
|
||||
planetPrisonRule = Comp<PlanetPrisonRuleComponent>(ruleEntity);
|
||||
var planetPrisonRule = Comp<PlanetPrisonRuleComponent>(ruleEntity);
|
||||
|
||||
return planetPrisonRule;
|
||||
}
|
||||
|
|
@ -127,12 +134,14 @@ namespace Content.Server._Sunrise.PlanetPrison
|
|||
public bool PrisonerEscaped(EntityUid mind)
|
||||
{
|
||||
var planetPrisonRule = GetPlanetPrisonRule();
|
||||
if (planetPrisonRule == null)
|
||||
return false;
|
||||
return planetPrisonRule.EscapedPrisoners.Contains(mind);
|
||||
}
|
||||
|
||||
private void OnMindAdded(EntityUid uid, PlanetPrisonerComponent component, MindAddedMessage args)
|
||||
{
|
||||
var planetPrisonRule = GetPlanetPrisonRule();
|
||||
var planetPrisonRule = GetPlanetPrisonRule() ?? StartPlanetPrisonRule();
|
||||
|
||||
if (!_mindSystem.TryGetMind(uid, out var mindId, out var mind))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
using Content.Server.GameTicking;
|
||||
using Content.Server.RoundEnd;
|
||||
using Content.Server.Voting.Managers;
|
||||
using Content.Shared._Sunrise.SunriseCCVars;
|
||||
using Content.Shared.Voting;
|
||||
using Robust.Shared.Configuration;
|
||||
|
||||
namespace Content.Server._Sunrise.RoundEndVote;
|
||||
|
||||
|
|
@ -9,6 +11,7 @@ public sealed class RoundEndVoteSystem : EntitySystem
|
|||
{
|
||||
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly IVoteManager _voteManager = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
|
@ -22,9 +25,13 @@ public sealed class RoundEndVoteSystem : EntitySystem
|
|||
if (_gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
return;
|
||||
|
||||
// Очень жаль
|
||||
//_voteManager.CreateStandardVote(null, StandardVoteType.Preset);
|
||||
_voteManager.CreateStandardVote(null, StandardVoteType.Map);
|
||||
_gameTicker.SetGamePreset("Secret");
|
||||
if (_cfg.GetCVar(SunriseCCVars.RunMapVoteAfterRestart))
|
||||
_voteManager.CreateStandardVote(null, StandardVoteType.Map);
|
||||
|
||||
if (_cfg.GetCVar(SunriseCCVars.RunPresetVoteAfterRestart))
|
||||
_voteManager.CreateStandardVote(null, StandardVoteType.Preset);
|
||||
|
||||
if (_cfg.GetCVar(SunriseCCVars.ResetPresetAfterRestart))
|
||||
_gameTicker.SetGamePreset("Secret");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,4 +251,14 @@ public sealed class SunriseCCVars
|
|||
public static readonly CVarDef<bool> ShowPresetVotes = CVarDef.Create("vote.show_preset_votes", true);
|
||||
|
||||
public static readonly CVarDef<bool> ShowMapVotes = CVarDef.Create("vote.show_map_votes", true);
|
||||
|
||||
public static readonly CVarDef<bool> RunMapVoteAfterRestart = CVarDef.Create("vote.run_map_vote_after_restart", false);
|
||||
|
||||
public static readonly CVarDef<bool> RunPresetVoteAfterRestart = CVarDef.Create("vote.run_preset_vote_after_restart", false);
|
||||
|
||||
/*
|
||||
* Preset
|
||||
*/
|
||||
|
||||
public static readonly CVarDef<bool> ResetPresetAfterRestart = CVarDef.Create("game.reset_preset_after_restart", false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue