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.
76 lines
3.3 KiB
C#
76 lines
3.3 KiB
C#
#nullable enable
|
|
using System.Linq;
|
|
using Content.IntegrationTests.Fixtures;
|
|
using Content.Shared.Actions;
|
|
using Content.Shared.Actions.Components;
|
|
using Content.Shared.CombatMode;
|
|
using Robust.Server.Player;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.IntegrationTests.Tests.Actions;
|
|
|
|
/// <summary>
|
|
/// This tests checks that actions properly get added to an entity's actions component..
|
|
/// </summary>
|
|
[TestFixture]
|
|
public sealed class ActionsAddedTest : GameTest
|
|
{
|
|
public override PoolSettings PoolSettings => new PoolSettings { Connected = true, DummyTicker = false };
|
|
|
|
// TODO add magboot test (inventory action)
|
|
// TODO add ghost toggle-fov test (client-side action)
|
|
|
|
[Test]
|
|
public async Task TestCombatActionsAdded()
|
|
{
|
|
var pair = Pair;
|
|
var server = pair.Server;
|
|
var client = pair.Client;
|
|
var sEntMan = server.ResolveDependency<IEntityManager>();
|
|
var cEntMan = client.ResolveDependency<IEntityManager>();
|
|
var clientSession = client.Session;
|
|
var serverSession = server.ResolveDependency<IPlayerManager>().Sessions.Single();
|
|
var sActionSystem = server.System<SharedActionsSystem>();
|
|
var cActionSystem = client.System<SharedActionsSystem>();
|
|
|
|
// Dummy ticker is disabled - client should be in control of a normal mob.
|
|
Assert.That(serverSession.AttachedEntity, Is.Not.Null);
|
|
var serverEnt = serverSession.AttachedEntity!.Value;
|
|
var clientEnt = clientSession!.AttachedEntity!.Value;
|
|
Assert.That(sEntMan.EntityExists(serverEnt));
|
|
Assert.That(cEntMan.EntityExists(clientEnt));
|
|
Assert.That(sEntMan.HasComponent<ActionsComponent>(serverEnt));
|
|
Assert.That(cEntMan.HasComponent<ActionsComponent>(clientEnt));
|
|
Assert.That(sEntMan.HasComponent<CombatModeComponent>(serverEnt));
|
|
Assert.That(cEntMan.HasComponent<CombatModeComponent>(clientEnt));
|
|
|
|
var sComp = sEntMan.GetComponent<ActionsComponent>(serverEnt);
|
|
var cComp = cEntMan.GetComponent<ActionsComponent>(clientEnt);
|
|
|
|
// Mob should have a combat-mode action.
|
|
// This action should have a non-null event both on the server & client.
|
|
var evType = typeof(ToggleCombatActionEvent);
|
|
|
|
var sQuery = sEntMan.GetEntityQuery<InstantActionComponent>();
|
|
var cQuery = cEntMan.GetEntityQuery<InstantActionComponent>();
|
|
var sActions = sActionSystem.GetActions(serverEnt).Where(
|
|
ent => sQuery.CompOrNull(ent)?.Event?.GetType() == evType).ToArray();
|
|
var cActions = cActionSystem.GetActions(clientEnt).Where(
|
|
ent => cQuery.CompOrNull(ent)?.Event?.GetType() == evType).ToArray();
|
|
|
|
Assert.That(sActions.Length, Is.EqualTo(1));
|
|
Assert.That(cActions.Length, Is.EqualTo(1));
|
|
|
|
var sAct = sActions[0];
|
|
var cAct = cActions[0];
|
|
|
|
Assert.That(sAct.Comp, Is.Not.Null);
|
|
Assert.That(cAct.Comp, Is.Not.Null);
|
|
|
|
// Finally, these two actions are not the same object
|
|
// required, because integration tests do not respect the [NonSerialized] attribute and will simply events by reference.
|
|
Assert.That(ReferenceEquals(sAct.Comp, cAct.Comp), Is.False);
|
|
Assert.That(ReferenceEquals(sQuery.GetComponent(sAct).Event, cQuery.GetComponent(cAct).Event), Is.False);
|
|
}
|
|
}
|