Merge remote-tracking branch 'refs/remotes/upstream/master' into ed-13-05-2024-upstream
# Conflicts: # Content.Shared/Lock/LockSystem.cs # Resources/Prototypes/Maps/oasis.yml
This commit is contained in:
@@ -22,6 +22,7 @@ public static partial class PoolManager
|
||||
(CVars.ThreadParallelCount.Name, "1"),
|
||||
(CCVars.GameRoleTimers.Name, "false"),
|
||||
(CCVars.GridFill.Name, "false"),
|
||||
(CCVars.PreloadGrids.Name, "false"),
|
||||
(CCVars.ArrivalsShuttles.Name, "false"),
|
||||
(CCVars.EmergencyShuttleEnabled.Name, "false"),
|
||||
(CCVars.ProcgenPreload.Name, "false"),
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.GameTicking.Commands;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Commands
|
||||
@@ -40,8 +41,7 @@ namespace Content.IntegrationTests.Tests.Commands
|
||||
|
||||
tickBeforeRestart = entityManager.CurrentTick;
|
||||
|
||||
var command = new RestartRoundNowCommand();
|
||||
command.Execute(null, string.Empty, Array.Empty<string>());
|
||||
gameTicker.RestartRound();
|
||||
|
||||
if (lobbyEnabled)
|
||||
{
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
// Sloth: Okay I'm sorry but I hate having to rewrite tests for every refactor
|
||||
// If you see this yell at me in discord so I can continue to pretend this didn't happen.
|
||||
// REMINDER THAT I STILL HAVE TO FIX THIS TEST EVERY OTHER PHYSICS PR
|
||||
// Assert.That(AirlockPhysicsDummy.Transform.MapPosition.X, Is.GreaterThan(AirlockPhysicsDummyStartingX));
|
||||
// _transform.GetMapCoordinates(UID HERE, xform: Assert.That(AirlockPhysicsDummy.Transform).X, Is.GreaterThan(AirlockPhysicsDummyStartingX));
|
||||
|
||||
// Blocked by the airlock
|
||||
await server.WaitAssertion(() =>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
@@ -24,6 +25,7 @@ public sealed class HandTests
|
||||
var playerMan = server.ResolveDependency<IPlayerManager>();
|
||||
var mapMan = server.ResolveDependency<IMapManager>();
|
||||
var sys = entMan.System<SharedHandsSystem>();
|
||||
var tSys = entMan.System<TransformSystem>();
|
||||
|
||||
var data = await pair.CreateTestMap();
|
||||
await pair.RunTicksSync(5);
|
||||
@@ -35,7 +37,7 @@ public sealed class HandTests
|
||||
{
|
||||
player = playerMan.Sessions.First().AttachedEntity!.Value;
|
||||
var xform = entMan.GetComponent<TransformComponent>(player);
|
||||
item = entMan.SpawnEntity("Crowbar", xform.MapPosition);
|
||||
item = entMan.SpawnEntity("Crowbar", tSys.GetMapCoordinates(player, xform: xform));
|
||||
hands = entMan.GetComponent<HandsComponent>(player);
|
||||
sys.TryPickup(player, item, hands.ActiveHand!);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
@@ -32,6 +33,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
var sEntities = server.ResolveDependency<IEntityManager>();
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
var conSystem = sEntities.EntitySysManager.GetEntitySystem<SharedContainerSystem>();
|
||||
var tSystem = sEntities.EntitySysManager.GetEntitySystem<TransformSystem>();
|
||||
|
||||
EntityUid origin = default;
|
||||
EntityUid other = default;
|
||||
@@ -45,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
origin = sEntities.SpawnEntity(HumanId, coordinates);
|
||||
other = sEntities.SpawnEntity(HumanId, coordinates);
|
||||
conSystem.EnsureContainer<Container>(other, "InRangeUnobstructedTestOtherContainer");
|
||||
mapCoordinates = sEntities.GetComponent<TransformComponent>(other).MapPosition;
|
||||
mapCoordinates = tSystem.GetMapCoordinates(other);
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Client.Lobby;
|
||||
using Content.Client.Preferences;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Shared.Preferences;
|
||||
using Robust.Client.State;
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Cargo.Systems;
|
||||
using Content.Server.Construction.Completions;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Server.Destructible;
|
||||
using Content.Server.Destructible.Thresholds.Behaviors;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Construction.Components;
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using Content.Shared.Construction.Steps;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Construction.Components;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Materials;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.IntegrationTests.Tests;
|
||||
|
||||
@@ -52,10 +53,10 @@ public sealed class MaterialArbitrageTest
|
||||
var destructibleName = compFact.GetComponentName(typeof(DestructibleComponent));
|
||||
|
||||
// construct inverted lathe recipe dictionary
|
||||
Dictionary<string, LatheRecipePrototype> latheRecipes = new();
|
||||
Dictionary<string, List<LatheRecipePrototype>> latheRecipes = new();
|
||||
foreach (var proto in protoManager.EnumeratePrototypes<LatheRecipePrototype>())
|
||||
{
|
||||
latheRecipes.Add(proto.Result, proto);
|
||||
latheRecipes.GetOrNew(proto.Result).Add(proto);
|
||||
}
|
||||
|
||||
// Lets assume the possible lathe for resource multipliers:
|
||||
@@ -186,13 +187,16 @@ public sealed class MaterialArbitrageTest
|
||||
Assert.That(spawnedPrice, Is.LessThanOrEqualTo(price), $"{id} increases in price after being destroyed\nEntities spawned on destruction: {string.Join(',', spawnedEnts)}");
|
||||
|
||||
// Check lathe production
|
||||
if (latheRecipes.TryGetValue(id, out var recipe))
|
||||
if (latheRecipes.TryGetValue(id, out var recipes))
|
||||
{
|
||||
foreach (var (matId, amount) in recipe.RequiredMaterials)
|
||||
foreach (var recipe in recipes)
|
||||
{
|
||||
var actualAmount = SharedLatheSystem.AdjustMaterial(amount, recipe.ApplyMaterialDiscount, multiplier);
|
||||
if (spawnedMats.TryGetValue(matId, out var numSpawned))
|
||||
Assert.That(numSpawned, Is.LessThanOrEqualTo(actualAmount), $"destroying a {id} spawns more {matId} than required to produce via an (upgraded) lathe.");
|
||||
foreach (var (matId, amount) in recipe.RequiredMaterials)
|
||||
{
|
||||
var actualAmount = SharedLatheSystem.AdjustMaterial(amount, recipe.ApplyMaterialDiscount, multiplier);
|
||||
if (spawnedMats.TryGetValue(matId, out var numSpawned))
|
||||
Assert.That(numSpawned, Is.LessThanOrEqualTo(actualAmount), $"destroying a {id} spawns more {matId} than required to produce via an (upgraded) lathe.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,13 +267,16 @@ public sealed class MaterialArbitrageTest
|
||||
Assert.That(deconstructedPrice, Is.LessThanOrEqualTo(price), $"{id} increases in price after being deconstructed");
|
||||
|
||||
// Check lathe production
|
||||
if (latheRecipes.TryGetValue(id, out var recipe))
|
||||
if (latheRecipes.TryGetValue(id, out var recipes))
|
||||
{
|
||||
foreach (var (matId, amount) in recipe.RequiredMaterials)
|
||||
foreach (var recipe in recipes)
|
||||
{
|
||||
var actualAmount = SharedLatheSystem.AdjustMaterial(amount, recipe.ApplyMaterialDiscount, multiplier);
|
||||
if (deconstructedMats.TryGetValue(matId, out var numSpawned))
|
||||
Assert.That(numSpawned, Is.LessThanOrEqualTo(actualAmount), $"deconstructing {id} spawns more {matId} than required to produce via an (upgraded) lathe.");
|
||||
foreach (var (matId, amount) in recipe.RequiredMaterials)
|
||||
{
|
||||
var actualAmount = SharedLatheSystem.AdjustMaterial(amount, recipe.ApplyMaterialDiscount, multiplier);
|
||||
if (deconstructedMats.TryGetValue(matId, out var numSpawned))
|
||||
Assert.That(numSpawned, Is.LessThanOrEqualTo(actualAmount), $"deconstructing {id} spawns more {matId} than required to produce via an (upgraded) lathe.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,13 +322,16 @@ public sealed class MaterialArbitrageTest
|
||||
Assert.That(sumPrice, Is.LessThanOrEqualTo(price), $"{id} increases in price after decomposed into raw materials");
|
||||
|
||||
// Check lathe production
|
||||
if (latheRecipes.TryGetValue(id, out var recipe))
|
||||
if (latheRecipes.TryGetValue(id, out var recipes))
|
||||
{
|
||||
foreach (var (matId, amount) in recipe.RequiredMaterials)
|
||||
foreach (var recipe in recipes)
|
||||
{
|
||||
var actualAmount = SharedLatheSystem.AdjustMaterial(amount, recipe.ApplyMaterialDiscount, multiplier);
|
||||
if (compositionComponent.MaterialComposition.TryGetValue(matId, out var numSpawned))
|
||||
Assert.That(numSpawned, Is.LessThanOrEqualTo(actualAmount), $"The physical composition of {id} has more {matId} than required to produce via an (upgraded) lathe.");
|
||||
foreach (var (matId, amount) in recipe.RequiredMaterials)
|
||||
{
|
||||
var actualAmount = SharedLatheSystem.AdjustMaterial(amount, recipe.ApplyMaterialDiscount, multiplier);
|
||||
if (compositionComponent.MaterialComposition.TryGetValue(matId, out var numSpawned))
|
||||
Assert.That(numSpawned, Is.LessThanOrEqualTo(actualAmount), $"The physical composition of {id} has more {matId} than required to produce via an (upgraded) lathe.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.IntegrationTests.Pair;
|
||||
using Content.Server.Ghost.Roles;
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Players;
|
||||
@@ -26,7 +27,7 @@ public sealed class GhostRoleTests
|
||||
";
|
||||
|
||||
/// <summary>
|
||||
/// This is a simple test that just checks if a player can take a ghost roll and then regain control of their
|
||||
/// This is a simple test that just checks if a player can take a ghost role and then regain control of their
|
||||
/// original entity without encountering errors.
|
||||
/// </summary>
|
||||
[Test]
|
||||
@@ -34,12 +35,15 @@ public sealed class GhostRoleTests
|
||||
{
|
||||
await using var pair = await PoolManager.GetServerClient(new PoolSettings
|
||||
{
|
||||
Dirty = true,
|
||||
DummyTicker = false,
|
||||
Connected = true
|
||||
});
|
||||
var server = pair.Server;
|
||||
var client = pair.Client;
|
||||
|
||||
var mapData = await pair.CreateTestMap();
|
||||
|
||||
var entMan = server.ResolveDependency<IEntityManager>();
|
||||
var sPlayerMan = server.ResolveDependency<Robust.Server.Player.IPlayerManager>();
|
||||
var conHost = client.ResolveDependency<IConsoleHost>();
|
||||
@@ -51,7 +55,7 @@ public sealed class GhostRoleTests
|
||||
EntityUid originalMob = default;
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
originalMob = entMan.SpawnEntity(null, MapCoordinates.Nullspace);
|
||||
originalMob = entMan.SpawnEntity(null, mapData.GridCoords);
|
||||
mindSystem.TransferTo(originalMindId, originalMob, true);
|
||||
});
|
||||
|
||||
@@ -69,12 +73,12 @@ public sealed class GhostRoleTests
|
||||
Assert.That(entMan.HasComponent<GhostComponent>(ghost));
|
||||
Assert.That(ghost, Is.Not.EqualTo(originalMob));
|
||||
Assert.That(session.ContentData()?.Mind, Is.EqualTo(originalMindId));
|
||||
Assert.That(originalMind.OwnedEntity, Is.EqualTo(originalMob));
|
||||
Assert.That(originalMind.OwnedEntity, Is.EqualTo(originalMob), $"Original mob: {originalMob}, Ghost: {ghost}");
|
||||
Assert.That(originalMind.VisitingEntity, Is.EqualTo(ghost));
|
||||
|
||||
// Spawn ghost takeover entity.
|
||||
EntityUid ghostRole = default;
|
||||
await server.WaitPost(() => ghostRole = entMan.SpawnEntity("GhostRoleTestEntity", MapCoordinates.Nullspace));
|
||||
await server.WaitPost(() => ghostRole = entMan.SpawnEntity("GhostRoleTestEntity", mapData.GridCoords));
|
||||
|
||||
// Take the ghost role
|
||||
await server.WaitPost(() =>
|
||||
|
||||
159
Content.IntegrationTests/Tests/Minds/GhostTests.cs
Normal file
159
Content.IntegrationTests/Tests/Minds/GhostTests.cs
Normal file
@@ -0,0 +1,159 @@
|
||||
using System.Numerics;
|
||||
using Content.IntegrationTests.Pair;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.UnitTesting;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Minds;
|
||||
|
||||
[TestFixture]
|
||||
public sealed class GhostTests
|
||||
{
|
||||
struct GhostTestData
|
||||
{
|
||||
public IEntityManager SEntMan;
|
||||
public Robust.Server.Player.IPlayerManager SPlayerMan;
|
||||
public Server.Mind.MindSystem SMindSys;
|
||||
public SharedTransformSystem STransformSys = default!;
|
||||
|
||||
public TestPair Pair = default!;
|
||||
|
||||
public TestMapData MapData => Pair.TestMap!;
|
||||
|
||||
public RobustIntegrationTest.ServerIntegrationInstance Server => Pair.Server;
|
||||
public RobustIntegrationTest.ClientIntegrationInstance Client => Pair.Client;
|
||||
|
||||
/// <summary>
|
||||
/// Initial player coordinates. Note that this does not necessarily correspond to the position of the
|
||||
/// <see cref="Player"/> entity.
|
||||
/// </summary>
|
||||
public NetCoordinates PlayerCoords = default!;
|
||||
|
||||
public NetEntity Player = default!;
|
||||
public EntityUid SPlayerEnt = default!;
|
||||
|
||||
public ICommonSession ClientSession = default!;
|
||||
public ICommonSession ServerSession = default!;
|
||||
|
||||
public GhostTestData()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<GhostTestData> SetupData()
|
||||
{
|
||||
var data = new GhostTestData();
|
||||
|
||||
// Client is needed to create a session for the ghost system. Creating a dummy session was too difficult.
|
||||
data.Pair = await PoolManager.GetServerClient(new PoolSettings
|
||||
{
|
||||
DummyTicker = false,
|
||||
Connected = true,
|
||||
Dirty = true
|
||||
});
|
||||
|
||||
data.SEntMan = data.Pair.Server.ResolveDependency<IServerEntityManager>();
|
||||
data.SPlayerMan = data.Pair.Server.ResolveDependency<Robust.Server.Player.IPlayerManager>();
|
||||
data.SMindSys = data.SEntMan.System<Server.Mind.MindSystem>();
|
||||
data.STransformSys = data.SEntMan.System<SharedTransformSystem>();
|
||||
|
||||
// Setup map.
|
||||
await data.Pair.CreateTestMap();
|
||||
data.PlayerCoords = data.SEntMan.GetNetCoordinates(data.MapData.GridCoords.Offset(new Vector2(0.5f, 0.5f)).WithEntityId(data.MapData.MapUid, data.STransformSys, data.SEntMan));
|
||||
|
||||
if (data.Client.Session == null)
|
||||
Assert.Fail("No player");
|
||||
data.ClientSession = data.Client.Session!;
|
||||
data.ServerSession = data.SPlayerMan.GetSessionById(data.ClientSession.UserId);
|
||||
|
||||
Entity<MindComponent> mind = default!;
|
||||
await data.Pair.Server.WaitPost(() =>
|
||||
{
|
||||
data.Player = data.SEntMan.GetNetEntity(data.SEntMan.SpawnEntity(null, data.SEntMan.GetCoordinates(data.PlayerCoords)));
|
||||
mind = data.SMindSys.CreateMind(data.ServerSession.UserId, "DummyPlayerEntity");
|
||||
data.SPlayerEnt = data.SEntMan.GetEntity(data.Player);
|
||||
data.SMindSys.TransferTo(mind, data.SPlayerEnt, mind: mind.Comp);
|
||||
data.Server.PlayerMan.SetAttachedEntity(data.ServerSession, data.SPlayerEnt);
|
||||
});
|
||||
|
||||
await data.Pair.RunTicksSync(5);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(data.ServerSession.ContentData()?.Mind, Is.EqualTo(mind.Owner));
|
||||
Assert.That(data.ServerSession.AttachedEntity, Is.EqualTo(data.SPlayerEnt));
|
||||
Assert.That(data.ServerSession.AttachedEntity, Is.EqualTo(mind.Comp.CurrentEntity),
|
||||
"Player is not attached to the mind's current entity.");
|
||||
Assert.That(data.SEntMan.EntityExists(mind.Comp.OwnedEntity),
|
||||
"The mind's current entity does not exist");
|
||||
Assert.That(mind.Comp.VisitingEntity == null || data.SEntMan.EntityExists(mind.Comp.VisitingEntity),
|
||||
"The minds visited entity does not exist.");
|
||||
});
|
||||
|
||||
Assert.That(data.SPlayerEnt, Is.Not.EqualTo(null));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that a ghost gets created when the player entity is deleted.
|
||||
/// 1. Delete mob
|
||||
/// 2. Assert is ghost
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task TestGridGhostOnDelete()
|
||||
{
|
||||
var data = await SetupData();
|
||||
|
||||
var oldPosition = data.SEntMan.GetComponent<TransformComponent>(data.SPlayerEnt).Coordinates;
|
||||
|
||||
Assert.That(!data.SEntMan.HasComponent<GhostComponent>(data.SPlayerEnt), "Player was initially a ghost?");
|
||||
|
||||
// Delete entity
|
||||
await data.Server.WaitPost(() => data.SEntMan.DeleteEntity(data.SPlayerEnt));
|
||||
await data.Pair.RunTicksSync(5);
|
||||
|
||||
var ghost = data.ServerSession.AttachedEntity!.Value;
|
||||
Assert.That(data.SEntMan.HasComponent<GhostComponent>(ghost), "Player did not become a ghost");
|
||||
|
||||
// Ensure the position is the same
|
||||
var ghostPosition = data.SEntMan.GetComponent<TransformComponent>(ghost).Coordinates;
|
||||
Assert.That(ghostPosition, Is.EqualTo(oldPosition));
|
||||
|
||||
await data.Pair.CleanReturnAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that a ghost gets created when the player entity is queue deleted.
|
||||
/// 1. Delete mob
|
||||
/// 2. Assert is ghost
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task TestGridGhostOnQueueDelete()
|
||||
{
|
||||
var data = await SetupData();
|
||||
|
||||
var oldPosition = data.SEntMan.GetComponent<TransformComponent>(data.SPlayerEnt).Coordinates;
|
||||
|
||||
Assert.That(!data.SEntMan.HasComponent<GhostComponent>(data.SPlayerEnt), "Player was initially a ghost?");
|
||||
|
||||
// Delete entity
|
||||
await data.Server.WaitPost(() => data.SEntMan.QueueDeleteEntity(data.SPlayerEnt));
|
||||
await data.Pair.RunTicksSync(5);
|
||||
|
||||
var ghost = data.ServerSession.AttachedEntity!.Value;
|
||||
Assert.That(data.SEntMan.HasComponent<GhostComponent>(ghost), "Player did not become a ghost");
|
||||
|
||||
// Ensure the position is the same
|
||||
var ghostPosition = data.SEntMan.GetComponent<TransformComponent>(ghost).Coordinates;
|
||||
Assert.That(ghostPosition, Is.EqualTo(oldPosition));
|
||||
|
||||
await data.Pair.CleanReturnAsync();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Shared.Ghost;
|
||||
@@ -77,7 +78,7 @@ public sealed partial class MindTests
|
||||
await using var pair = await SetupPair(dirty: true);
|
||||
var server = pair.Server;
|
||||
var testMap = await pair.CreateTestMap();
|
||||
var coordinates = testMap.GridCoords;
|
||||
var testMap2 = await pair.CreateTestMap();
|
||||
|
||||
var entMan = server.ResolveDependency<IServerEntityManager>();
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
@@ -91,7 +92,7 @@ public sealed partial class MindTests
|
||||
MindComponent mind = default!;
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
playerEnt = entMan.SpawnEntity(null, coordinates);
|
||||
playerEnt = entMan.SpawnEntity(null, testMap.GridCoords);
|
||||
mindId = player.ContentData()!.Mind!.Value;
|
||||
mind = entMan.GetComponent<MindComponent>(mindId);
|
||||
mindSystem.TransferTo(mindId, playerEnt);
|
||||
@@ -100,14 +101,20 @@ public sealed partial class MindTests
|
||||
});
|
||||
|
||||
await pair.RunTicksSync(5);
|
||||
await server.WaitPost(() => mapManager.DeleteMap(testMap.MapId));
|
||||
await server.WaitAssertion(() => mapManager.DeleteMap(testMap.MapId));
|
||||
await pair.RunTicksSync(5);
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
#pragma warning disable NUnit2045 // Interdependent assertions.
|
||||
Assert.That(entMan.EntityExists(mind.CurrentEntity), Is.True);
|
||||
Assert.That(mind.CurrentEntity, Is.Not.EqualTo(playerEnt));
|
||||
// Spawn ghost on the second map
|
||||
var attachedEntity = player.AttachedEntity;
|
||||
Assert.That(entMan.EntityExists(attachedEntity), Is.True);
|
||||
Assert.That(attachedEntity, Is.Not.EqualTo(playerEnt));
|
||||
Assert.That(entMan.HasComponent<GhostComponent>(attachedEntity));
|
||||
var transform = entMan.GetComponent<TransformComponent>(attachedEntity.Value);
|
||||
Assert.That(transform.MapID, Is.Not.EqualTo(MapId.Nullspace));
|
||||
Assert.That(transform.MapID, Is.Not.EqualTo(testMap.MapId));
|
||||
#pragma warning restore NUnit2045
|
||||
});
|
||||
|
||||
|
||||
@@ -39,32 +39,21 @@ namespace Content.IntegrationTests.Tests.Preferences
|
||||
|
||||
private static HumanoidCharacterProfile CharlieCharlieson()
|
||||
{
|
||||
return new(
|
||||
"Charlie Charlieson",
|
||||
"The biggest boy around.",
|
||||
"Human",
|
||||
21,
|
||||
Sex.Male,
|
||||
Gender.Epicene,
|
||||
new HumanoidCharacterAppearance(
|
||||
return new()
|
||||
{
|
||||
Name = "Charlie Charlieson",
|
||||
FlavorText = "The biggest boy around.",
|
||||
Species = "Human",
|
||||
Age = 21,
|
||||
Appearance = new(
|
||||
"Afro",
|
||||
Color.Aqua,
|
||||
"Shaved",
|
||||
Color.Aquamarine,
|
||||
Color.Azure,
|
||||
Color.Beige,
|
||||
new ()
|
||||
),
|
||||
SpawnPriorityPreference.None,
|
||||
new Dictionary<string, JobPriority>
|
||||
{
|
||||
{SharedGameTicker.FallbackOverflowJob, JobPriority.High}
|
||||
},
|
||||
PreferenceUnavailableMode.StayInLobby,
|
||||
new List<string> (),
|
||||
new List<string>(),
|
||||
new Dictionary<string, RoleLoadout>()
|
||||
);
|
||||
new ())
|
||||
};
|
||||
}
|
||||
|
||||
private static ServerDbSqlite GetDb(RobustIntegrationTest.ServerIntegrationInstance server)
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
private sealed class RoundEndTestSystem : EntitySystem
|
||||
{
|
||||
public int Count;
|
||||
public int RoundCount;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -22,7 +22,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
private void OnRoundEnd(RoundEndSystemChangedEvent ev)
|
||||
{
|
||||
Interlocked.Increment(ref Count);
|
||||
Interlocked.Increment(ref RoundCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Content.IntegrationTests.Tests
|
||||
var ticker = sysManager.GetEntitySystem<GameTicker>();
|
||||
var roundEndSystem = sysManager.GetEntitySystem<RoundEndSystem>();
|
||||
var sys = server.System<RoundEndTestSystem>();
|
||||
sys.Count = 0;
|
||||
sys.RoundCount = 0;
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
@@ -128,8 +128,8 @@ namespace Content.IntegrationTests.Tests
|
||||
async Task WaitForEvent()
|
||||
{
|
||||
var timeout = Task.Delay(TimeSpan.FromSeconds(10));
|
||||
var currentCount = Thread.VolatileRead(ref sys.Count);
|
||||
while (currentCount == Thread.VolatileRead(ref sys.Count) && !timeout.IsCompleted)
|
||||
var currentCount = Thread.VolatileRead(ref sys.RoundCount);
|
||||
while (currentCount == Thread.VolatileRead(ref sys.RoundCount) && !timeout.IsCompleted)
|
||||
{
|
||||
await pair.RunTicksSync(5);
|
||||
}
|
||||
|
||||
@@ -87,8 +87,9 @@ public sealed class EvacShuttleTest
|
||||
Assert.That(LifeStage(salternXform.MapUid.Value), Is.EqualTo(EntityLifeStage.MapInitialized));
|
||||
|
||||
// Set up shuttle timing
|
||||
var shuttleSys = server.System<ShuttleSystem>();
|
||||
var evacSys = server.System<EmergencyShuttleSystem>();
|
||||
evacSys.TransitTime = ShuttleSystem.DefaultTravelTime; // Absolute minimum transit time, so the test has to run for at least this long
|
||||
evacSys.TransitTime = shuttleSys.DefaultTravelTime; // Absolute minimum transit time, so the test has to run for at least this long
|
||||
// TODO SHUTTLE fix spaghetti
|
||||
|
||||
var dockTime = server.CfgMan.GetCVar(CCVars.EmergencyShuttleDockTime);
|
||||
@@ -112,7 +113,7 @@ public sealed class EvacShuttleTest
|
||||
Assert.That(shuttleXform.MapUid, Is.EqualTo(ftl.Owner));
|
||||
|
||||
// Shuttle should have arrived at centcomm
|
||||
await pair.RunSeconds(ShuttleSystem.DefaultTravelTime);
|
||||
await pair.RunSeconds(shuttleSys.DefaultTravelTime);
|
||||
Assert.That(shuttleXform.MapUid, Is.EqualTo(centcommMap));
|
||||
|
||||
// Round should be ending now
|
||||
|
||||
Reference in New Issue
Block a user