Fix 3000 errors

This commit is contained in:
DrSmugleaf
2021-12-05 18:09:01 +01:00
parent 2bfec7ec62
commit 2a3b7d809d
569 changed files with 2979 additions and 3280 deletions

View File

@@ -66,13 +66,16 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
await server.WaitIdleAsync();
await client.WaitIdleAsync();
var cEntities = IoCManager.Resolve<IEntityManager>();
var sEntities = IoCManager.Resolve<IEntityManager>();
var serverPlayerManager = server.ResolveDependency<IPlayerManager>();
var innateActions = new List<ActionType>();
await server.WaitAssertion(() =>
{
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt!);
var actionsComponent = sEntities.GetComponent<ServerActionsComponent>(playerEnt!.Value);
// player should begin with their innate actions granted
innateActions.AddRange(actionsComponent.InnateActions);
@@ -99,7 +102,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
{
var local = clientPlayerMgr.LocalPlayer;
var controlled = local!.ControlledEntity;
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!);
var actionsComponent = cEntities.GetComponent<ClientActionsComponent>(controlled!);
// we should have our innate actions and debug1.
foreach (var innateAction in innateActions)
@@ -123,14 +126,14 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
if (expectEmpty)
{
Assert.That(slot.HasAssignment, Is.False);
Assert.That(slot.Item, Is.Null);
Assert.That(slot.Item, Is.EqualTo(default));
Assert.That(slot.Action, Is.Null);
Assert.That(slot.ActionEnabled, Is.False);
continue;
}
Assert.That(slot.HasAssignment);
// all the actions we gave so far are not tied to an item
Assert.That(slot.Item, Is.Null);
Assert.That(slot.Item, Is.EqualTo(default));
Assert.That(slot.Action, Is.Not.Null);
Assert.That(slot.ActionEnabled);
var asAction = slot.Action as ActionPrototype;
@@ -154,7 +157,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
await server.WaitAssertion(() =>
{
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt!);
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt!.Value);
actionsComponent.Revoke(ActionType.DebugInstant);
});
@@ -189,7 +192,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
var expected = expectedOrder[idx++];
Assert.That(slot.HasAssignment);
// all the actions we gave so far are not tied to an item
Assert.That(slot.Item, Is.Null);
Assert.That(slot.Item, Is.EqualTo(default));
Assert.That(slot.Action, Is.Not.Null);
var asAction = slot.Action as ActionPrototype;
Assert.That(asAction, Is.Not.Null);
@@ -207,7 +210,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
else
{
Assert.That(slot.HasAssignment, Is.False);
Assert.That(slot.Item, Is.Null);
Assert.That(slot.Item, Is.EqualTo(default));
Assert.That(slot.Action, Is.Null);
Assert.That(slot.ActionEnabled, Is.False);
}
@@ -232,6 +235,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
await server.WaitIdleAsync();
await client.WaitIdleAsync();
var clientEntities = client.ResolveDependency<IEntityManager>();
var serverPlayerManager = server.ResolveDependency<IPlayerManager>();
var serverEntManager = server.ResolveDependency<IEntityManager>();
var serverGameTiming = server.ResolveDependency<IGameTiming>();
@@ -240,18 +245,18 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
ServerActionsComponent serverActionsComponent = null;
ClientActionsComponent clientActionsComponent = null;
IEntity serverPlayerEnt = null;
IEntity serverFlashlight = null;
EntityUid serverPlayerEnt = default;
EntityUid serverFlashlight = default;
await server.WaitAssertion(() =>
{
serverPlayerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
serverActionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(serverPlayerEnt!);
serverPlayerEnt = serverPlayerManager.Sessions.Single().AttachedEntity!.Value;
serverActionsComponent = serverEntManager.GetComponent<ServerActionsComponent>(serverPlayerEnt);
// spawn and give them an item that has actions
serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight",
new EntityCoordinates(serverPlayerEnt, (0, 0)));
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(serverFlashlight, out var itemActions));
Assert.That(serverEntManager.TryGetComponent<ItemActionsComponent>(serverFlashlight, out var itemActions));
// we expect this only to have a toggle light action initially
var actionConfigs = itemActions.ActionConfigs.ToList();
Assert.That(actionConfigs.Count == 1);
@@ -260,11 +265,11 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
// grant an extra item action, before pickup, initially disabled
itemActions.GrantOrUpdate(ItemActionType.DebugToggle, false);
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt).PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(serverFlashlight), false);
serverEntManager.GetComponent<HandsComponent>(serverPlayerEnt).PutInHand(serverEntManager.GetComponent<ItemComponent>(serverFlashlight), false);
// grant an extra item action, after pickup, with a cooldown
itemActions.GrantOrUpdate(ItemActionType.DebugInstant, cooldown: cooldown);
Assert.That(serverActionsComponent.TryGetItemActionStates((EntityUid) serverFlashlight, out var state));
Assert.That(serverActionsComponent.TryGetItemActionStates(serverFlashlight, out var state));
// they should have been granted all 3 actions
Assert.That(state.Count == 3);
Assert.That(state.TryGetValue(ItemActionType.ToggleLight, out var toggleLightState));
@@ -286,7 +291,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
{
var local = clientPlayerMgr.LocalPlayer;
var controlled = local!.ControlledEntity;
clientActionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!);
clientActionsComponent = clientEntities.GetComponent<ClientActionsComponent>(controlled!);
var lightEntry = clientActionsComponent.ItemActionStates()
.Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight))
@@ -334,8 +339,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
await server.WaitAssertion(() =>
{
// drop the item, and the item actions should go away
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt)
.TryDropEntity(serverFlashlight, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(serverPlayerEnt).Coordinates, false);
serverEntManager.GetComponent<HandsComponent>(serverPlayerEnt)
.TryDropEntity(serverFlashlight, serverEntManager.GetComponent<TransformComponent>(serverPlayerEnt).Coordinates, false);
Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight), Is.False);
});
@@ -352,7 +357,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
{
// pick the item up again, the states should be back to what they were when dropped,
// as the states "stick" with the item
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt).PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(serverFlashlight), false);
serverEntManager.GetComponent<HandsComponent>(serverPlayerEnt).PutInHand(serverEntManager.GetComponent<ItemComponent>(serverFlashlight), false);
Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight, out var lightStates));
Assert.That(lightStates.TryGetValue(ItemActionType.ToggleLight, out var lightState));
Assert.That(lightState.Equals(new ActionState(true, toggledOn: true)));