mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-06-09 10:06:49 +02:00
d42adbf05d
* Pass 1. * i'm FREE * Prevent hangups. * okay fine here's an attribute for settings, will polish later and prolly remove the overridable thing. * sigh. * fix singular trigger bug so LatheTest doesn't flake. * Remove SystemAttribute usage. * Poke * I used the shotgun. You know why? Cause the shot gun doesn’t miss, and unlike the shitty hybrid taser it stops a criminal in their tracks in two hits. Bang, bang, and they’re fucking done. I use four shots just to make damn sure. Because, once again, I’m not there to coddle a buncha criminal scum sucking f------, I’m there to 1) Survive the fucking round. 2) Guard the armory. So you can absolutely get fucked. If I get unbanned, which I won’t, you can guarantee I will continue to use the shotgun to apprehend criminals. Because it’s quick, clean and effective as fuck. Why in the seven hells would I fuck around with the disabler shots, which take half a clip just to bring someone down, or with the tazer bolts which are slow as balls, impossible to aim and do about next to jack shit, fuck all. The shotgun is the superior law enforcement weapon. Because it stops crime. And it stops crime by reducing the number of criminals roaming the fucking halls. * Change the faulty store test into two tests, one of which is ignored for failing.
124 lines
4.5 KiB
C#
124 lines
4.5 KiB
C#
using System.Text;
|
|
using Content.IntegrationTests.Fixtures;
|
|
using Content.Server.Construction.Completions;
|
|
using Content.Shared.Construction;
|
|
using Content.Shared.Construction.Prototypes;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.IntegrationTests.Tests.Construction
|
|
{
|
|
[TestFixture]
|
|
public sealed class ConstructionActionValid : GameTest
|
|
{
|
|
private bool IsValid(IGraphAction action, IPrototypeManager protoMan, out string prototype)
|
|
{
|
|
switch (action)
|
|
{
|
|
case SpawnPrototype spawn:
|
|
prototype = spawn.Prototype;
|
|
return protoMan.TryIndex<EntityPrototype>(spawn.Prototype, out _);
|
|
case SpawnPrototypeAtContainer spawn:
|
|
prototype = spawn.Prototype;
|
|
return protoMan.TryIndex<EntityPrototype>(spawn.Prototype, out _);
|
|
case ConditionalAction conditional:
|
|
var valid = IsValid(conditional.Action, protoMan, out var protoA) & IsValid(conditional.Else, protoMan, out var protoB);
|
|
|
|
if (!string.IsNullOrEmpty(protoA) && string.IsNullOrEmpty(protoB))
|
|
{
|
|
prototype = protoA;
|
|
}
|
|
|
|
else if (string.IsNullOrEmpty(protoA) && !string.IsNullOrEmpty(protoB))
|
|
{
|
|
prototype = protoB;
|
|
}
|
|
|
|
else
|
|
{
|
|
prototype = $"{protoA}, {protoB}";
|
|
}
|
|
|
|
return valid;
|
|
default:
|
|
prototype = string.Empty;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task ConstructionGraphSpawnPrototypeValid()
|
|
{
|
|
var pair = Pair;
|
|
var server = pair.Server;
|
|
|
|
var protoMan = server.ResolveDependency<IPrototypeManager>();
|
|
|
|
var valid = true;
|
|
var message = new StringBuilder();
|
|
|
|
await server.WaitPost(() =>
|
|
{
|
|
foreach (var graph in protoMan.EnumeratePrototypes<ConstructionGraphPrototype>())
|
|
{
|
|
foreach (var node in graph.Nodes.Values)
|
|
{
|
|
foreach (var action in node.Actions)
|
|
{
|
|
if (IsValid(action, protoMan, out var prototype)) continue;
|
|
|
|
valid = false;
|
|
message.Append($"Invalid entity prototype \"{prototype}\" on graph action in node \"{node.Name}\" of graph \"{graph.ID}\"\n");
|
|
}
|
|
|
|
foreach (var edge in node.Edges)
|
|
{
|
|
foreach (var action in edge.Completed)
|
|
{
|
|
if (IsValid(action, protoMan, out var prototype)) continue;
|
|
|
|
valid = false;
|
|
message.Append($"Invalid entity prototype \"{prototype}\" on graph action in edge \"{edge.Target}\" of node \"{node.Name}\" of graph \"{graph.ID}\"\n");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
Assert.That(valid, Is.True, $"One or more SpawnPrototype actions specified invalid entity prototypes!\n{message}");
|
|
}
|
|
|
|
[Test]
|
|
public async Task ConstructionGraphEdgeValid()
|
|
{
|
|
var pair = Pair;
|
|
var server = pair.Server;
|
|
|
|
var protoMan = server.ResolveDependency<IPrototypeManager>();
|
|
|
|
var valid = true;
|
|
var message = new StringBuilder();
|
|
|
|
await server.WaitPost(() =>
|
|
{
|
|
foreach (var graph in protoMan.EnumeratePrototypes<ConstructionGraphPrototype>())
|
|
{
|
|
foreach (var node in graph.Nodes.Values)
|
|
{
|
|
foreach (var edge in node.Edges)
|
|
{
|
|
if (graph.Nodes.ContainsKey(edge.Target))
|
|
continue;
|
|
|
|
valid = false;
|
|
message.Append(
|
|
$"Invalid target \"{edge.Target}\" in edge on node \"{node.Name}\" of graph \"{graph.ID}\"\n");
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
Assert.That(valid, Is.True, $"One or more edges specified invalid node targets!\n{message}");
|
|
}
|
|
}
|
|
}
|