diff --git a/Content.IntegrationTests/Tests/Body/LegTest.cs b/Content.IntegrationTests/Tests/Body/LegTest.cs index ec20602be0..1ccbe7aa99 100644 --- a/Content.IntegrationTests/Tests/Body/LegTest.cs +++ b/Content.IntegrationTests/Tests/Body/LegTest.cs @@ -17,10 +17,23 @@ namespace Content.IntegrationTests.Tests.Body [TestOf(typeof(BodyComponent))] public class LegTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: HumanBodyAndAppearanceDummy + id: HumanBodyAndAppearanceDummy + components: + - type: Appearance + - type: Body + template: HumanoidTemplate + preset: HumanPreset + centerSlot: torso +"; + [Test] public async Task RemoveLegsFallTest() { - var server = StartServerDummyTicker(); + var options = new ServerContentIntegrationOption{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); AppearanceComponent appearance = null; @@ -32,7 +45,7 @@ namespace Content.IntegrationTests.Tests.Body mapManager.CreateNewMapEntity(mapId); var entityManager = IoCManager.Resolve(); - var human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); + var human = entityManager.SpawnEntity("HumanBodyAndAppearanceDummy", MapCoordinates.Nullspace); Assert.That(human.TryGetComponent(out IBody body)); Assert.That(human.TryGetComponent(out appearance)); diff --git a/Content.IntegrationTests/Tests/Body/LungTest.cs b/Content.IntegrationTests/Tests/Body/LungTest.cs index 6722ea41a0..c0e827dbad 100644 --- a/Content.IntegrationTests/Tests/Body/LungTest.cs +++ b/Content.IntegrationTests/Tests/Body/LungTest.cs @@ -23,10 +23,37 @@ namespace Content.IntegrationTests.Tests.Body [TestOf(typeof(LungBehavior))] public class LungTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: HumanBodyAndBloodstreamDummy + id: HumanBodyAndBloodstreamDummy + components: + - type: Bloodstream + max_volume: 100 + - type: Body + template: HumanoidTemplate + preset: HumanPreset + centerSlot: torso + - type: Metabolism + metabolismHeat: 5000 + radiatedHeat: 400 + implicitHeatRegulation: 5000 + sweatHeatRegulation: 5000 + shiveringHeatRegulation: 5000 + normalBodyTemperature: 310.15 + thermalRegulationTemperatureThreshold: 25 + needsGases: + Oxygen: 0.00060763888 + producesGases: + Oxygen: 0.00045572916 + CarbonDioxide: 0.00015190972 +"; + [Test] public async Task AirConsistencyTest() { - var server = StartServerDummyTicker(); + var options = new ServerContentIntegrationOption{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); server.Assert(() => { @@ -36,7 +63,7 @@ namespace Content.IntegrationTests.Tests.Body var entityManager = IoCManager.Resolve(); - var human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); + var human = entityManager.SpawnEntity("HumanBodyAndBloodstreamDummy", MapCoordinates.Nullspace); Assert.That(human.TryGetComponent(out IBody body)); Assert.That(body.TryGetMechanismBehaviors(out List lungs)); diff --git a/Content.IntegrationTests/Tests/Body/MechanismBehaviorEventsTest.cs b/Content.IntegrationTests/Tests/Body/MechanismBehaviorEventsTest.cs index 08afb1ae91..4ee94cc095 100644 --- a/Content.IntegrationTests/Tests/Body/MechanismBehaviorEventsTest.cs +++ b/Content.IntegrationTests/Tests/Body/MechanismBehaviorEventsTest.cs @@ -103,10 +103,22 @@ namespace Content.IntegrationTests.Tests.Body } } + private const string PROTOTYPES = @" +- type: entity + name: HumanBodyDummy + id: HumanBodyDummy + components: + - type: Body + template: HumanoidTemplate + preset: HumanPreset + centerSlot: torso +"; + [Test] public async Task EventsTest() { - var server = StartServerDummyTicker(); + var options = new ServerContentIntegrationOption {ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); await server.WaitAssertion(() => { @@ -116,7 +128,7 @@ namespace Content.IntegrationTests.Tests.Body mapManager.CreateNewMapEntity(mapId); var entityManager = IoCManager.Resolve(); - var human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); + var human = entityManager.SpawnEntity("HumanBodyDummy", MapCoordinates.Nullspace); Assert.That(human.TryGetComponent(out IBody? body)); Assert.NotNull(body); diff --git a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs index 6bcf4b5872..1091c7e17f 100644 --- a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs +++ b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs @@ -21,10 +21,30 @@ namespace Content.IntegrationTests.Tests.Buckle [TestOf(typeof(StrapComponent))] public class BuckleTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: BuckleDummy + id: BuckleDummy + components: + - type: Buckle + - type: Transform + - type: Hands + - type: Body + template: HumanoidTemplate + preset: HumanPreset + centerSlot: torso + +- type: entity + name: StrapDummy + id: StrapDummy + components: + - type: Strap +"; [Test] public async Task BuckleUnbuckleCooldownRangeTest() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); IEntity human = null; IEntity chair = null; @@ -39,8 +59,8 @@ namespace Content.IntegrationTests.Tests.Buckle var entityManager = IoCManager.Resolve(); - human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); - chair = entityManager.SpawnEntity("ChairWood", MapCoordinates.Nullspace); + human = entityManager.SpawnEntity("BuckleDummy", MapCoordinates.Nullspace); + chair = entityManager.SpawnEntity("StrapDummy", MapCoordinates.Nullspace); // Default state, unbuckled Assert.True(human.TryGetComponent(out buckle)); @@ -173,7 +193,8 @@ namespace Content.IntegrationTests.Tests.Buckle [Test] public async Task BuckledDyingDropItemsTest() { - var server = StartServer(); + var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; + var server = StartServer(options); IEntity human; IEntity chair; @@ -198,8 +219,8 @@ namespace Content.IntegrationTests.Tests.Buckle grid.SetTile(coordinates, tile); - human = entityManager.SpawnEntity("HumanMob_Content", coordinates); - chair = entityManager.SpawnEntity("ChairWood", coordinates); + human = entityManager.SpawnEntity("BuckleDummy", coordinates); + chair = entityManager.SpawnEntity("StrapDummy", coordinates); // Component sanity check Assert.True(human.TryGetComponent(out buckle)); @@ -263,7 +284,8 @@ namespace Content.IntegrationTests.Tests.Buckle [Test] public async Task ForceUnbuckleBuckleTest() { - var server = StartServer(); + var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; + var server = StartServer(options); IEntity human = null; IEntity chair = null; @@ -286,8 +308,8 @@ namespace Content.IntegrationTests.Tests.Buckle grid.SetTile(coordinates, tile); - human = entityManager.SpawnEntity("HumanMob_Content", coordinates); - chair = entityManager.SpawnEntity("ChairWood", coordinates); + human = entityManager.SpawnEntity("BuckleDummy", coordinates); + chair = entityManager.SpawnEntity("StrapDummy", coordinates); // Component sanity check Assert.True(human.TryGetComponent(out buckle)); diff --git a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs index f3f4867e1b..898aa1220e 100644 --- a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs +++ b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs @@ -14,10 +14,22 @@ namespace Content.IntegrationTests.Tests.Commands [TestOf(typeof(RejuvenateVerb))] public class RejuvenateTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: DamageableDummy + id: DamageableDummy + components: + - type: Damageable + damagePrototype: biologicalDamageContainer + criticalThreshold: 100 + deadThreshold: 200 +"; + [Test] public async Task RejuvenateDeadTest() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); await server.WaitAssertion(() => { @@ -27,7 +39,7 @@ namespace Content.IntegrationTests.Tests.Commands var entityManager = IoCManager.Resolve(); - var human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); + var human = entityManager.SpawnEntity("DamageableDummy", MapCoordinates.Nullspace); // Sanity check Assert.True(human.TryGetComponent(out IDamageableComponent damageable)); diff --git a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs index b4296daded..83add9783e 100644 --- a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs +++ b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs @@ -59,10 +59,46 @@ namespace Content.IntegrationTests.Tests.Disposal Assert.That(result || entities.Length == 0, Is.EqualTo(unit.ContainedEntities.Count == 0)); } + private const string PROTOTYPES = @" +- type: entity + name: HumanDummy + id: HumanDummy + components: + - type: Damageable + damagePrototype: biologicalDamageContainer + criticalThreshold: 100 + deadThreshold: 200 + +- type: entity + name: WrenchDummy + id: WrenchDummy + components: + - type: Tool + qualities: + - Anchoring + +- type: entity + name: DisposalUnitDummy + id: DisposalUnitDummy + components: + - type: DisposalUnit + - type: Anchorable + - type: PowerReceiver + - type: Physics + anchored: true + +- type: entity + name: DisposalTrunkDummy + id: DisposalTrunkDummy + components: + - type: DisposalEntry +"; + [Test] public async Task Test() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); IEntity human; IEntity wrench; @@ -78,10 +114,10 @@ namespace Content.IntegrationTests.Tests.Disposal var entityManager = IoCManager.Resolve(); // Spawn the entities - human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); - wrench = entityManager.SpawnEntity("Wrench", MapCoordinates.Nullspace); - var disposalUnit = entityManager.SpawnEntity("DisposalUnit", MapCoordinates.Nullspace); - var disposalTrunk = entityManager.SpawnEntity("DisposalTrunk", disposalUnit.Transform.MapPosition); + human = entityManager.SpawnEntity("HumanDummy", MapCoordinates.Nullspace); + wrench = entityManager.SpawnEntity("WrenchDummy", MapCoordinates.Nullspace); + var disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", MapCoordinates.Nullspace); + var disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", disposalUnit.Transform.MapPosition); // Test for components existing Assert.True(disposalUnit.TryGetComponent(out unit!)); diff --git a/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs b/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs index 5c6fdcfe38..f2198fdc21 100644 --- a/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs +++ b/Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs @@ -16,11 +16,20 @@ namespace Content.IntegrationTests.Tests.DoAfter [TestOf(typeof(DoAfterComponent))] public class DoAfterServerTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: Dummy + id: Dummy + components: + - type: DoAfter +"; + [Test] public async Task TestFinished() { Task task = null; - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); // That it finishes successfully server.Post(() => @@ -29,7 +38,7 @@ namespace Content.IntegrationTests.Tests.DoAfter var mapManager = IoCManager.Resolve(); mapManager.CreateNewMapEntity(MapId.Nullspace); var entityManager = IoCManager.Resolve(); - var mob = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); + var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace); var cancelToken = new CancellationTokenSource(); var args = new DoAfterEventArgs(mob, tickTime / 2, cancelToken.Token); task = EntitySystem.Get().DoAfter(args); @@ -43,7 +52,8 @@ namespace Content.IntegrationTests.Tests.DoAfter public async Task TestCancelled() { Task task = null; - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); server.Post(() => { @@ -51,7 +61,7 @@ namespace Content.IntegrationTests.Tests.DoAfter var mapManager = IoCManager.Resolve(); mapManager.CreateNewMapEntity(MapId.Nullspace); var entityManager = IoCManager.Resolve(); - var mob = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); + var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace); var cancelToken = new CancellationTokenSource(); var args = new DoAfterEventArgs(mob, tickTime * 2, cancelToken.Token); task = EntitySystem.Get().DoAfter(args); diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs index 28d03845ee..ce2cd67532 100644 --- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs +++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs @@ -14,10 +14,18 @@ namespace Content.IntegrationTests.Tests.Doors [TestOf(typeof(AirlockComponent))] public class AirlockTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: AirlockDummy + id: AirlockDummy + components: + - type: Airlock +"; [Test] public async Task OpenCloseDestroyTest() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); await server.WaitIdleAsync(); @@ -77,7 +85,8 @@ namespace Content.IntegrationTests.Tests.Doors [Test] public async Task AirlockBlockTest() { - var server = StartServer(); + var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; + var server = StartServer(options); await server.WaitIdleAsync(); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/CuffUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/CuffUnitTest.cs index 251a19f084..96105a3c24 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/CuffUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/CuffUnitTest.cs @@ -20,17 +20,36 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking [TestOf(typeof(HandcuffComponent))] public class CuffUnitTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: HumanDummy + id: HumanDummy + components: + - type: Cuffable + - type: Hands + - type: Body + template: HumanoidTemplate + preset: HumanPreset + centerSlot: torso + +- type: entity + name: HandcuffsDummy + id: HandcuffsDummy + components: + - type: Handcuff +"; [Test] public async Task Test() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); IEntity human; IEntity otherHuman; IEntity cuffs; - IEntity cables; - HandcuffComponent cableHandcuff; + IEntity secondCuffs; HandcuffComponent handcuff; + HandcuffComponent secondHandcuff; CuffableComponent cuffed; IHandsComponent hands; IBody body; @@ -43,10 +62,10 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking var entityManager = IoCManager.Resolve(); // Spawn the entities - human = entityManager.SpawnEntity("BaseHumanMob_Content", MapCoordinates.Nullspace); - otherHuman = entityManager.SpawnEntity("BaseHumanMob_Content", MapCoordinates.Nullspace); - cuffs = entityManager.SpawnEntity("Handcuffs", MapCoordinates.Nullspace); - cables = entityManager.SpawnEntity("Cablecuffs", MapCoordinates.Nullspace); + human = entityManager.SpawnEntity("HumanDummy", MapCoordinates.Nullspace); + otherHuman = entityManager.SpawnEntity("HumanDummy", MapCoordinates.Nullspace); + cuffs = entityManager.SpawnEntity("HandcuffsDummy", MapCoordinates.Nullspace); + secondCuffs = entityManager.SpawnEntity("HandcuffsDummy", MapCoordinates.Nullspace); human.Transform.WorldPosition = otherHuman.Transform.WorldPosition; @@ -55,7 +74,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking Assert.True(human.TryGetComponent(out hands!), $"Human has no {nameof(HandsComponent)}"); Assert.True(human.TryGetComponent(out body!), $"Human has no {nameof(IBody)}"); Assert.True(cuffs.TryGetComponent(out handcuff!), $"Handcuff has no {nameof(HandcuffComponent)}"); - Assert.True(cables.TryGetComponent(out cableHandcuff!), $"Cablecuff has no {nameof(HandcuffComponent)}"); + Assert.True(secondCuffs.TryGetComponent(out secondHandcuff!), $"Second handcuffs has no {nameof(HandcuffComponent)}"); // Test to ensure cuffed players register the handcuffs cuffed.AddNewCuffs(cuffs); @@ -67,7 +86,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking Assert.True(cuffed.CuffedHandCount == 2 && hands.Hands.Count() == 4, "Player doesn't have correct amount of hands cuffed"); // Test to give a player with 4 hands 2 sets of cuffs - cuffed.AddNewCuffs(cables); + cuffed.AddNewCuffs(secondCuffs); Assert.True(cuffed.CuffedHandCount == 4, "Player doesn't have correct amount of hands cuffed"); }); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index fd2b05ecc4..f9dccac864 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -17,10 +17,26 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement [TestOf(typeof(ClimbingComponent))] public class ClimbUnitTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: HumanDummy + id: HumanDummy + components: + - type: Climbing + - type: Physics + +- type: entity + name: TableDummy + id: TableDummy + components: + - type: Climbable +"; + [Test] public async Task Test() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); IEntity human; IEntity table; @@ -35,8 +51,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement var entityManager = IoCManager.Resolve(); // Spawn the entities - human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); - table = entityManager.SpawnEntity("Table", MapCoordinates.Nullspace); + human = entityManager.SpawnEntity("HumanDummy", MapCoordinates.Nullspace); + table = entityManager.SpawnEntity("TableDummy", MapCoordinates.Nullspace); // Test for climb components existing // Players and tables should have these in their prototypes. diff --git a/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs b/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs index 5e0574c321..b9697ce770 100644 --- a/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs +++ b/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs @@ -20,10 +20,18 @@ namespace Content.IntegrationTests.Tests.Gravity [TestOf(typeof(GravityGeneratorComponent))] public class WeightlessStatusTests : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: HumanDummy + id: HumanDummy + components: + - type: AlertsUI +"; [Test] public async Task WeightlessStatusTest() { - var server = StartServer(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServer(options); await server.WaitIdleAsync(); @@ -56,7 +64,7 @@ namespace Content.IntegrationTests.Tests.Gravity pauseManager.DoMapInitialize(mapId); - human = entityManager.SpawnEntity("HumanMob_Content", coordinates); + human = entityManager.SpawnEntity("HumanDummy", coordinates); Assert.True(human.TryGetComponent(out alerts)); }); diff --git a/Content.IntegrationTests/Tests/GravityGridTest.cs b/Content.IntegrationTests/Tests/GravityGridTest.cs index 4d67306fd7..c373aeba2d 100644 --- a/Content.IntegrationTests/Tests/GravityGridTest.cs +++ b/Content.IntegrationTests/Tests/GravityGridTest.cs @@ -17,10 +17,19 @@ namespace Content.IntegrationTests.Tests [TestOf(typeof(GravityGeneratorComponent))] public class GravityGridTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: GravityGeneratorDummy + id: GravityGeneratorDummy + components: + - type: GravityGenerator + - type: PowerReceiver +"; [Test] public async Task Test() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); IEntity generator = null; @@ -38,7 +47,7 @@ namespace Content.IntegrationTests.Tests var entityMan = IoCManager.Resolve(); - generator = entityMan.SpawnEntity("GravityGenerator", grid2.ToCoordinates()); + generator = entityMan.SpawnEntity("GravityGeneratorDummy", grid2.ToCoordinates()); Assert.That(generator.HasComponent()); Assert.That(generator.HasComponent()); var generatorComponent = generator.GetComponent(); diff --git a/Content.IntegrationTests/Tests/GridTileLookupTest.cs b/Content.IntegrationTests/Tests/GridTileLookupTest.cs index 1538b6341f..1f4988bc99 100644 --- a/Content.IntegrationTests/Tests/GridTileLookupTest.cs +++ b/Content.IntegrationTests/Tests/GridTileLookupTest.cs @@ -13,10 +13,17 @@ namespace Content.IntegrationTests.Tests [TestFixture] public class GridTileLookupTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: Dummy + id: Dummy +"; + [Test] public async Task Test() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); await server.WaitIdleAsync(); var entityManager = server.ResolveDependency(); @@ -39,12 +46,12 @@ namespace Content.IntegrationTests.Tests Assert.That(entities.Count, Is.EqualTo(0)); // Space entity, check that nothing intersects it and that also it doesn't throw. - entityManager.SpawnEntity("HumanMob_Content", new MapCoordinates(Vector2.One * 1000, mapOne)); + entityManager.SpawnEntity("Dummy", new MapCoordinates(Vector2.One * 1000, mapOne)); entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new Vector2i(1000, 1000)).ToList(); Assert.That(entities.Count, Is.EqualTo(0)); - var entityOne = entityManager.SpawnEntity("Food4NoRaisins", new EntityCoordinates(gridOne.GridEntityId, Vector2.Zero)); - entityManager.SpawnEntity("Food4NoRaisins", new EntityCoordinates(gridOne.GridEntityId, Vector2.One)); + var entityOne = entityManager.SpawnEntity("Dummy", new EntityCoordinates(gridOne.GridEntityId, Vector2.Zero)); + entityManager.SpawnEntity("Dummy", new EntityCoordinates(gridOne.GridEntityId, Vector2.One)); var entityTiles = tileLookup.GetIndices(entityOne); Assert.That(entityTiles.Count, Is.EqualTo(2)); diff --git a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs index 3f2b1ca4f8..dd2016e6e5 100644 --- a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs +++ b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs @@ -16,10 +16,51 @@ namespace Content.IntegrationTests.Tests [TestOf(typeof(HumanInventoryControllerComponent))] public class HumanInventoryUniformSlotsTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: HumanDummy + id: HumanDummy + components: + - type: Inventory + - type: HumanInventoryController + +- type: entity + name: UniformDummy + id: UniformDummy + components: + - type: Clothing + Slots: [innerclothing] + size: 5 + +- type: entity + name: IDCardDummy + id: IDCardDummy + components: + - type: Clothing + Slots: + - idcard + size: 5 + - type: IdCard + +- type: entity + name: FlashlightDummy + id: FlashlightDummy + components: + - type: Item + size: 5 + +- type: entity + name: ToolboxDummy + id: ToolboxDummy + components: + - type: Item + size: 9999 +"; [Test] public async Task Test() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); IEntity human = null; IEntity uniform = null; @@ -35,11 +76,11 @@ namespace Content.IntegrationTests.Tests var entityMan = IoCManager.Resolve(); - human = entityMan.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); - uniform = entityMan.SpawnEntity("UniformJanitor", MapCoordinates.Nullspace); - idCard = entityMan.SpawnEntity("AssistantIDCard", MapCoordinates.Nullspace); - pocketItem = entityMan.SpawnEntity("FlashlightLantern", MapCoordinates.Nullspace); - var tooBigItem = entityMan.SpawnEntity("ToolboxEmergency", MapCoordinates.Nullspace); + human = entityMan.SpawnEntity("HumanDummy", MapCoordinates.Nullspace); + uniform = entityMan.SpawnEntity("UniformDummy", MapCoordinates.Nullspace); + idCard = entityMan.SpawnEntity("IDCardDummy", MapCoordinates.Nullspace); + pocketItem = entityMan.SpawnEntity("FlashlightDummy", MapCoordinates.Nullspace); + var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", MapCoordinates.Nullspace); inventory = human.GetComponent(); diff --git a/Content.IntegrationTests/Tests/InventoryHelpersTest.cs b/Content.IntegrationTests/Tests/InventoryHelpersTest.cs index c7377364ce..177f856e3d 100644 --- a/Content.IntegrationTests/Tests/InventoryHelpersTest.cs +++ b/Content.IntegrationTests/Tests/InventoryHelpersTest.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.IO; +using System.Threading.Tasks; using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Mobs; @@ -8,6 +9,7 @@ using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Map; using Robust.Shared.IoC; using Robust.Shared.Map; +using Robust.Shared.Prototypes; using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines; namespace Content.IntegrationTests.Tests @@ -16,10 +18,19 @@ namespace Content.IntegrationTests.Tests [TestOf(typeof(InventoryHelpers))] public class InventoryHelpersTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: InventoryStunnableDummy + id: InventoryStunnableDummy + components: + - type: Inventory + - type: Stunnable +"; [Test] public async Task SpawnItemInSlotTest() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); IEntity human = null; InventoryComponent inventory = null; @@ -34,7 +45,7 @@ namespace Content.IntegrationTests.Tests var entityMan = IoCManager.Resolve(); - human = entityMan.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace); + human = entityMan.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace); inventory = human.GetComponent(); stun = human.GetComponent(); diff --git a/Content.IntegrationTests/Tests/PowerTest.cs b/Content.IntegrationTests/Tests/PowerTest.cs index 3367841cc6..7fdc3c0c15 100644 --- a/Content.IntegrationTests/Tests/PowerTest.cs +++ b/Content.IntegrationTests/Tests/PowerTest.cs @@ -15,10 +15,111 @@ namespace Content.IntegrationTests.Tests [TestFixture] public class PowerTest : ContentIntegrationTest { + private const string PROTOTYPES = @" +- type: entity + name: GeneratorDummy + id: GeneratorDummy + components: + - type: NodeContainer + nodes: + - !type:AdjacentNode + nodeGroupID: HVPower + - type: PowerSupplier + supplyRate: 3000 + - type: Anchorable + - type: SnapGrid + offset: Center + +- type: entity + name: ConsumerDummy + id: ConsumerDummy + components: + - type: SnapGrid + offset: Center + - type: NodeContainer + nodes: + - !type:AdjacentNode + nodeGroupID: HVPower + - type: PowerConsumer + drawRate: 50 + +- type: entity + name: SubstationDummy + id: SubstationDummy + components: + - type: Battery + maxCharge: 1000 + startingCharge: 1000 + - type: NodeContainer + nodes: + - !type:AdjacentNode + nodeGroupID: HVPower + - !type:AdjacentNode + nodeGroupID: MVPower + - type: PowerConsumer + - type: BatteryStorage + activeDrawRate: 1500 + - type: PowerSupplier + voltage: Medium + - type: BatteryDischarger + activeSupplyRate: 1000 + - type: SnapGrid + offset: Center + +- type: entity + name: ApcDummy + id: ApcDummy + components: + - type: Battery + maxCharge: 10000 + startingCharge: 10000 + - type: BatteryStorage + activeDrawRate: 1000 + - type: PowerProvider + voltage: Apc + - type: Apc + voltage: Apc + - type: PowerConsumer + voltage: Medium + - type: NodeContainer + nodes: + - !type:AdjacentNode + nodeGroupID: MVPower + - !type:AdjacentNode + nodeGroupID: Apc + - type: SnapGrid + offset: Center + +- type: entity + name: ApcExtensionCableDummy + id: ApcExtensionCableDummy + components: + - type: NodeContainer + nodes: + - !type:AdjacentNode + nodeGroupID: Apc + - !type:AdjacentNode + nodeGroupID: WireNet + - type: PowerProvider + voltage: Apc + - type: Wire + wireType: Apc + - type: SnapGrid + offset: Center + +- type: entity + name: PowerReceiverDummy + id: PowerReceiverDummy + components: + - type: PowerReceiver + - type: SnapGrid + offset: Center +"; [Test] public async Task PowerNetTest() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); PowerSupplierComponent supplier = null; PowerConsumerComponent consumer1 = null; @@ -31,9 +132,9 @@ namespace Content.IntegrationTests.Tests mapMan.CreateMap(new MapId(1)); var grid = mapMan.CreateGrid(new MapId(1)); - var generatorEnt = entityMan.SpawnEntity("DebugGenerator", grid.ToCoordinates()); - var consumerEnt1 = entityMan.SpawnEntity("DebugConsumer", grid.ToCoordinates(0, 1)); - var consumerEnt2 = entityMan.SpawnEntity("DebugConsumer", grid.ToCoordinates(0, 2)); + var generatorEnt = entityMan.SpawnEntity("GeneratorDummy", grid.ToCoordinates()); + var consumerEnt1 = entityMan.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1)); + var consumerEnt2 = entityMan.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2)); if (generatorEnt.TryGetComponent(out AnchorableComponent anchorable)) { @@ -68,7 +169,8 @@ namespace Content.IntegrationTests.Tests [Test] public async Task ApcChargingTest() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); BatteryComponent apcBattery = null; PowerSupplierComponent substationSupplier = null; @@ -80,9 +182,9 @@ namespace Content.IntegrationTests.Tests mapMan.CreateMap(new MapId(1)); var grid = mapMan.CreateGrid(new MapId(1)); - var generatorEnt = entityMan.SpawnEntity("DebugGenerator", grid.ToCoordinates()); - var substationEnt = entityMan.SpawnEntity("DebugSubstation", grid.ToCoordinates(0, 1)); - var apcEnt = entityMan.SpawnEntity("DebugApc", grid.ToCoordinates(0, 2)); + var generatorEnt = entityMan.SpawnEntity("GeneratorDummy", grid.ToCoordinates()); + var substationEnt = entityMan.SpawnEntity("SubstationDummy", grid.ToCoordinates(0, 1)); + var apcEnt = entityMan.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 2)); Assert.That(generatorEnt.TryGetComponent(out var generatorSupplier)); @@ -115,7 +217,8 @@ namespace Content.IntegrationTests.Tests [Test] public async Task ApcNetTest() { - var server = StartServerDummyTicker(); + var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES}; + var server = StartServerDummyTicker(options); PowerReceiverComponent receiver = null; @@ -126,9 +229,9 @@ namespace Content.IntegrationTests.Tests mapMan.CreateMap(new MapId(1)); var grid = mapMan.CreateGrid(new MapId(1)); - var apcEnt = entityMan.SpawnEntity("DebugApc", grid.ToCoordinates(0, 0)); - var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCable", grid.ToCoordinates(0, 1)); - var powerReceiverEnt = entityMan.SpawnEntity("DebugPowerReceiver", grid.ToCoordinates(0, 2)); + var apcEnt = entityMan.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 0)); + var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCableDummy", grid.ToCoordinates(0, 1)); + var powerReceiverEnt = entityMan.SpawnEntity("PowerReceiverDummy", grid.ToCoordinates(0, 2)); Assert.That(apcEnt.TryGetComponent(out var apc)); Assert.That(apcExtensionEnt.TryGetComponent(out var provider)); diff --git a/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs b/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs index 510715b1e8..b9613c4391 100644 --- a/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs +++ b/Content.Server/GameObjects/Components/ActionBlocking/CuffableComponent.cs @@ -115,7 +115,7 @@ namespace Content.Server.GameObjects.Components.ActionBlocking _container.Insert(handcuff); CanStillInteract = _hands.Hands.Count() > CuffedHandCount; - OnCuffedStateChanged.Invoke(); + OnCuffedStateChanged?.Invoke(); UpdateAlert(); UpdateHeldItems(); Dirty();