Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Crime Assist incorrect entires and add a test #624

Merged
merged 3 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions Content.IntegrationTests/Tests/DeltaV/CrimeassistTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System.Linq;
using Content.Shared.DeltaV.CartridgeLoader.Cartridges;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;

namespace Content.IntegrationTests.Tests.DeltaV;

[TestFixture]
public sealed class CrimeAssistTest
{
[Test]
public async Task CrimeAssistValid()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;
await server.WaitIdleAsync();

var prototypeManager = server.ResolveDependency<IPrototypeManager>();
var allProtos = prototypeManager.EnumeratePrototypes<CrimeAssistPage>().ToArray();

await server.WaitAssertion(() =>
{
foreach (var proto in allProtos)
{
if (proto.LocKey != null)
{
Assert.That(Loc.TryGetString(proto.LocKey, out var _),
$"CrimeAssistPage {proto.ID} has invalid LocKey {proto.LocKey}!");
}

if (proto.LocKeyTitle != null)
{
Assert.That(Loc.TryGetString(proto.LocKeyTitle, out var _),
$"CrimeAssistPage {proto.ID} has invalid LocKeyTitle {proto.LocKeyTitle}!");
}

if (proto.LocKeyDescription != null)
{
Assert.That(Loc.TryGetString(proto.LocKeyDescription, out var _),
$"CrimeAssistPage {proto.ID} has invalid LocKeyDescription {proto.LocKeyDescription}!");
}

if (proto.LocKeySeverity != null)
{
Assert.That(Loc.TryGetString(proto.LocKeySeverity, out var _),
$"CrimeAssistPage {proto.ID} has invalid LocKeySeverity {proto.LocKeySeverity}!");
}

if (proto.LocKeyPunishment != null)
{
Assert.That(Loc.TryGetString(proto.LocKeyPunishment, out var _),
$"CrimeAssistPage {proto.ID} has invalid LocKeyPunishment {proto.LocKeyPunishment}!");
}

if (proto.OnStart != null)
{
Assert.That(allProtos.Any(p => p.ID == proto.OnStart),
$"CrimeAssistPage {proto.ID} has invalid OnStart {proto.OnStart}!");
}

if (proto.OnYes != null)
{
Assert.That(allProtos.Any(p => p.ID == proto.OnYes),
$"CrimeAssistPage {proto.ID} has invalid OnYes {proto.OnYes}!");
}

if (proto.OnNo != null)
{
Assert.That(allProtos.Any(p => p.ID == proto.OnNo),
$"CrimeAssistPage {proto.ID} has invalid OnNo {proto.OnNo}!");
}
}
});

await pair.CleanReturnAsync();
}
}
23 changes: 15 additions & 8 deletions Resources/Prototypes/DeltaV/cartridges/crimeassistflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
- type: crimeAssistPage
id: "questionWasCrimeSexualInNature"
locKey: "crime-assist-question-wascrimesexualinnature"
onYes: "resultSexualHarrassment"
onYes: "resultSexualHarassment"
onNo: "questionWasSuspectANuisance"

- type: crimeAssistPage
Expand Down Expand Up @@ -278,12 +278,19 @@
locKeySeverity: "crime-assist-crimetype-felony"
locKeyPunishment: "crime-assist-crimepunishment-contemptofcourt"

- type: crimeAssistPage
id: "resultBlackMarketeering"
locKeyTitle: "crime-assist-crime-blackmarketeering"
locKeyDescription: "crime-assist-crimedetail-blackmarketeering"
locKeySeverity: "crime-assist-crimetype-felony"
locKeyPunishment: "crime-assist-crimepunishment-blackmarketeering"

- type: crimeAssistPage
id: "resultPerjuryOrFalseReport"
locKeyTitle: "crime-assist-crime-perjuryorfalsereport"
locKeyDescription: "crime-assist-crimedetail-perjuryorfalsereport"
locKeyTitle: "crime-assist-crime-perjuryfalsereport"
locKeyDescription: "crime-assist-crimedetail-perjuryfalsereport"
locKeySeverity: "crime-assist-crimetype-felony"
locKeyPunishment: "crime-assist-crimepunishment-perjuryorfalsereport"
locKeyPunishment: "crime-assist-crimepunishment-perjuryfalsereport"

- type: crimeAssistPage
id: "resultObstructionOfJustice"
Expand Down Expand Up @@ -335,8 +342,8 @@
locKeyPunishment: "crime-assist-crimepunishment-sedition"

- type: crimeAssistPage
id: "resultSexualHarrassment"
locKeyTitle: "crime-assist-crime-sexualharrassment"
locKeyDescription: "crime-assist-crimedetail-sexualharrassment"
id: "resultSexualHarassment"
locKeyTitle: "crime-assist-crime-sexualharassment"
locKeyDescription: "crime-assist-crimedetail-sexualharassment"
locKeySeverity: "crime-assist-crimetype-capital"
locKeyPunishment: "crime-assist-crimepunishment-sexualharrassment"
locKeyPunishment: "crime-assist-crimepunishment-sexualharassment"
Loading