mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-06-09 10:06:43 +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.
71 lines
2.6 KiB
C#
71 lines
2.6 KiB
C#
#nullable enable
|
|
using System.Linq;
|
|
using Content.IntegrationTests.Fixtures;
|
|
using Content.IntegrationTests.Fixtures.Attributes;
|
|
using Content.Shared.Actions;
|
|
using Content.Shared.Eye;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.IntegrationTests.Tests.Actions;
|
|
|
|
[TestFixture]
|
|
public sealed class ActionPvsDetachTest : GameTest
|
|
{
|
|
[SidedDependency(Side.Server)] private readonly SharedActionsSystem _sActionsSys = null!;
|
|
[SidedDependency(Side.Client)] private readonly SharedActionsSystem _cActionsSys = null!;
|
|
|
|
[Test]
|
|
public async Task TestActionDetach()
|
|
{
|
|
var pair = Pair;
|
|
var (server, client) = (Server, Client);
|
|
var sys = _sActionsSys;
|
|
var cSys = _cActionsSys;
|
|
|
|
// Spawn mob that has some actions
|
|
EntityUid ent = default;
|
|
var map = await pair.CreateTestMap();
|
|
await server.WaitPost(() => ent = server.EntMan.SpawnAtPosition("MobHuman", map.GridCoords));
|
|
await pair.RunTicksSync(5);
|
|
var cEnt = pair.ToClientUid(ent);
|
|
|
|
// Verify that both the client & server agree on the number of actions
|
|
var initActions = sys.GetActions(ent).Count();
|
|
Assert.That(initActions, Is.GreaterThan(0));
|
|
Assert.That(initActions, Is.EqualTo(cSys.GetActions(cEnt).Count()));
|
|
|
|
// PVS-detach action entities
|
|
// We do this by just giving them the ghost layer
|
|
var visSys = server.System<VisibilitySystem>();
|
|
server.Post(() =>
|
|
{
|
|
var enumerator = server.Transform(ent).ChildEnumerator;
|
|
while (enumerator.MoveNext(out var child))
|
|
{
|
|
visSys.AddLayer(child, (int) VisibilityFlags.Ghost);
|
|
}
|
|
});
|
|
await pair.RunTicksSync(5);
|
|
|
|
// Client's actions have left been detached / are out of view, but action comp state has not changed
|
|
Assert.That(sys.GetActions(ent).Count(), Is.EqualTo(initActions));
|
|
Assert.That(cSys.GetActions(cEnt).Count(), Is.EqualTo(initActions));
|
|
|
|
// Re-enter PVS view
|
|
server.Post(() =>
|
|
{
|
|
var enumerator = server.Transform(ent).ChildEnumerator;
|
|
while (enumerator.MoveNext(out var child))
|
|
{
|
|
visSys.RemoveLayer(child, (int) VisibilityFlags.Ghost);
|
|
}
|
|
});
|
|
await pair.RunTicksSync(5);
|
|
Assert.That(sys.GetActions(ent).Count(), Is.EqualTo(initActions));
|
|
Assert.That(cSys.GetActions(cEnt).Count(), Is.EqualTo(initActions));
|
|
|
|
await server.WaitPost(() => server.EntMan.DeleteEntity(map.MapUid));
|
|
}
|
|
}
|