Refactored integration tests to not use content entity prototypes (#2571)
* Refactored integration tests to not use content prototypes * oops * Apply suggestions from code review Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -17,10 +17,23 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
[TestOf(typeof(BodyComponent))]
|
[TestOf(typeof(BodyComponent))]
|
||||||
public class LegTest : ContentIntegrationTest
|
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]
|
[Test]
|
||||||
public async Task RemoveLegsFallTest()
|
public async Task RemoveLegsFallTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerContentIntegrationOption{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
AppearanceComponent appearance = null;
|
AppearanceComponent appearance = null;
|
||||||
|
|
||||||
@@ -32,7 +45,7 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
mapManager.CreateNewMapEntity(mapId);
|
mapManager.CreateNewMapEntity(mapId);
|
||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
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 IBody body));
|
||||||
Assert.That(human.TryGetComponent(out appearance));
|
Assert.That(human.TryGetComponent(out appearance));
|
||||||
|
|||||||
@@ -23,10 +23,37 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
[TestOf(typeof(LungBehavior))]
|
[TestOf(typeof(LungBehavior))]
|
||||||
public class LungTest : ContentIntegrationTest
|
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]
|
[Test]
|
||||||
public async Task AirConsistencyTest()
|
public async Task AirConsistencyTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerContentIntegrationOption{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
@@ -36,7 +63,7 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
var human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
var human = entityManager.SpawnEntity("HumanBodyAndBloodstreamDummy", MapCoordinates.Nullspace);
|
||||||
|
|
||||||
Assert.That(human.TryGetComponent(out IBody body));
|
Assert.That(human.TryGetComponent(out IBody body));
|
||||||
Assert.That(body.TryGetMechanismBehaviors(out List<LungBehavior> lungs));
|
Assert.That(body.TryGetMechanismBehaviors(out List<LungBehavior> lungs));
|
||||||
|
|||||||
@@ -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]
|
[Test]
|
||||||
public async Task EventsTest()
|
public async Task EventsTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerContentIntegrationOption {ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
@@ -116,7 +128,7 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
mapManager.CreateNewMapEntity(mapId);
|
mapManager.CreateNewMapEntity(mapId);
|
||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
var human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
var human = entityManager.SpawnEntity("HumanBodyDummy", MapCoordinates.Nullspace);
|
||||||
|
|
||||||
Assert.That(human.TryGetComponent(out IBody? body));
|
Assert.That(human.TryGetComponent(out IBody? body));
|
||||||
Assert.NotNull(body);
|
Assert.NotNull(body);
|
||||||
|
|||||||
@@ -21,10 +21,30 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
[TestOf(typeof(StrapComponent))]
|
[TestOf(typeof(StrapComponent))]
|
||||||
public class BuckleTest : ContentIntegrationTest
|
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]
|
[Test]
|
||||||
public async Task BuckleUnbuckleCooldownRangeTest()
|
public async Task BuckleUnbuckleCooldownRangeTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
IEntity human = null;
|
IEntity human = null;
|
||||||
IEntity chair = null;
|
IEntity chair = null;
|
||||||
@@ -39,8 +59,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
human = entityManager.SpawnEntity("BuckleDummy", MapCoordinates.Nullspace);
|
||||||
chair = entityManager.SpawnEntity("ChairWood", MapCoordinates.Nullspace);
|
chair = entityManager.SpawnEntity("StrapDummy", MapCoordinates.Nullspace);
|
||||||
|
|
||||||
// Default state, unbuckled
|
// Default state, unbuckled
|
||||||
Assert.True(human.TryGetComponent(out buckle));
|
Assert.True(human.TryGetComponent(out buckle));
|
||||||
@@ -173,7 +193,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task BuckledDyingDropItemsTest()
|
public async Task BuckledDyingDropItemsTest()
|
||||||
{
|
{
|
||||||
var server = StartServer();
|
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServer(options);
|
||||||
|
|
||||||
IEntity human;
|
IEntity human;
|
||||||
IEntity chair;
|
IEntity chair;
|
||||||
@@ -198,8 +219,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
|
|
||||||
grid.SetTile(coordinates, tile);
|
grid.SetTile(coordinates, tile);
|
||||||
|
|
||||||
human = entityManager.SpawnEntity("HumanMob_Content", coordinates);
|
human = entityManager.SpawnEntity("BuckleDummy", coordinates);
|
||||||
chair = entityManager.SpawnEntity("ChairWood", coordinates);
|
chair = entityManager.SpawnEntity("StrapDummy", coordinates);
|
||||||
|
|
||||||
// Component sanity check
|
// Component sanity check
|
||||||
Assert.True(human.TryGetComponent(out buckle));
|
Assert.True(human.TryGetComponent(out buckle));
|
||||||
@@ -263,7 +284,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task ForceUnbuckleBuckleTest()
|
public async Task ForceUnbuckleBuckleTest()
|
||||||
{
|
{
|
||||||
var server = StartServer();
|
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServer(options);
|
||||||
|
|
||||||
IEntity human = null;
|
IEntity human = null;
|
||||||
IEntity chair = null;
|
IEntity chair = null;
|
||||||
@@ -286,8 +308,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
|
|
||||||
grid.SetTile(coordinates, tile);
|
grid.SetTile(coordinates, tile);
|
||||||
|
|
||||||
human = entityManager.SpawnEntity("HumanMob_Content", coordinates);
|
human = entityManager.SpawnEntity("BuckleDummy", coordinates);
|
||||||
chair = entityManager.SpawnEntity("ChairWood", coordinates);
|
chair = entityManager.SpawnEntity("StrapDummy", coordinates);
|
||||||
|
|
||||||
// Component sanity check
|
// Component sanity check
|
||||||
Assert.True(human.TryGetComponent(out buckle));
|
Assert.True(human.TryGetComponent(out buckle));
|
||||||
|
|||||||
@@ -14,10 +14,22 @@ namespace Content.IntegrationTests.Tests.Commands
|
|||||||
[TestOf(typeof(RejuvenateVerb))]
|
[TestOf(typeof(RejuvenateVerb))]
|
||||||
public class RejuvenateTest : ContentIntegrationTest
|
public class RejuvenateTest : ContentIntegrationTest
|
||||||
{
|
{
|
||||||
|
private const string PROTOTYPES = @"
|
||||||
|
- type: entity
|
||||||
|
name: DamageableDummy
|
||||||
|
id: DamageableDummy
|
||||||
|
components:
|
||||||
|
- type: Damageable
|
||||||
|
damagePrototype: biologicalDamageContainer
|
||||||
|
criticalThreshold: 100
|
||||||
|
deadThreshold: 200
|
||||||
|
";
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task RejuvenateDeadTest()
|
public async Task RejuvenateDeadTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
@@ -27,7 +39,7 @@ namespace Content.IntegrationTests.Tests.Commands
|
|||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
var human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
var human = entityManager.SpawnEntity("DamageableDummy", MapCoordinates.Nullspace);
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
Assert.True(human.TryGetComponent(out IDamageableComponent damageable));
|
Assert.True(human.TryGetComponent(out IDamageableComponent damageable));
|
||||||
|
|||||||
@@ -59,10 +59,46 @@ namespace Content.IntegrationTests.Tests.Disposal
|
|||||||
Assert.That(result || entities.Length == 0, Is.EqualTo(unit.ContainedEntities.Count == 0));
|
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]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
IEntity human;
|
IEntity human;
|
||||||
IEntity wrench;
|
IEntity wrench;
|
||||||
@@ -78,10 +114,10 @@ namespace Content.IntegrationTests.Tests.Disposal
|
|||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
// Spawn the entities
|
// Spawn the entities
|
||||||
human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
human = entityManager.SpawnEntity("HumanDummy", MapCoordinates.Nullspace);
|
||||||
wrench = entityManager.SpawnEntity("Wrench", MapCoordinates.Nullspace);
|
wrench = entityManager.SpawnEntity("WrenchDummy", MapCoordinates.Nullspace);
|
||||||
var disposalUnit = entityManager.SpawnEntity("DisposalUnit", MapCoordinates.Nullspace);
|
var disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", MapCoordinates.Nullspace);
|
||||||
var disposalTrunk = entityManager.SpawnEntity("DisposalTrunk", disposalUnit.Transform.MapPosition);
|
var disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", disposalUnit.Transform.MapPosition);
|
||||||
|
|
||||||
// Test for components existing
|
// Test for components existing
|
||||||
Assert.True(disposalUnit.TryGetComponent(out unit!));
|
Assert.True(disposalUnit.TryGetComponent(out unit!));
|
||||||
|
|||||||
@@ -16,11 +16,20 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
|||||||
[TestOf(typeof(DoAfterComponent))]
|
[TestOf(typeof(DoAfterComponent))]
|
||||||
public class DoAfterServerTest : ContentIntegrationTest
|
public class DoAfterServerTest : ContentIntegrationTest
|
||||||
{
|
{
|
||||||
|
private const string PROTOTYPES = @"
|
||||||
|
- type: entity
|
||||||
|
name: Dummy
|
||||||
|
id: Dummy
|
||||||
|
components:
|
||||||
|
- type: DoAfter
|
||||||
|
";
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task TestFinished()
|
public async Task TestFinished()
|
||||||
{
|
{
|
||||||
Task<DoAfterStatus> task = null;
|
Task<DoAfterStatus> task = null;
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
// That it finishes successfully
|
// That it finishes successfully
|
||||||
server.Post(() =>
|
server.Post(() =>
|
||||||
@@ -29,7 +38,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
|||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
mapManager.CreateNewMapEntity(MapId.Nullspace);
|
mapManager.CreateNewMapEntity(MapId.Nullspace);
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
var mob = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace);
|
||||||
var cancelToken = new CancellationTokenSource();
|
var cancelToken = new CancellationTokenSource();
|
||||||
var args = new DoAfterEventArgs(mob, tickTime / 2, cancelToken.Token);
|
var args = new DoAfterEventArgs(mob, tickTime / 2, cancelToken.Token);
|
||||||
task = EntitySystem.Get<DoAfterSystem>().DoAfter(args);
|
task = EntitySystem.Get<DoAfterSystem>().DoAfter(args);
|
||||||
@@ -43,7 +52,8 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
|||||||
public async Task TestCancelled()
|
public async Task TestCancelled()
|
||||||
{
|
{
|
||||||
Task<DoAfterStatus> task = null;
|
Task<DoAfterStatus> task = null;
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
server.Post(() =>
|
server.Post(() =>
|
||||||
{
|
{
|
||||||
@@ -51,7 +61,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
|||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
mapManager.CreateNewMapEntity(MapId.Nullspace);
|
mapManager.CreateNewMapEntity(MapId.Nullspace);
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
var mob = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
var mob = entityManager.SpawnEntity("Dummy", MapCoordinates.Nullspace);
|
||||||
var cancelToken = new CancellationTokenSource();
|
var cancelToken = new CancellationTokenSource();
|
||||||
var args = new DoAfterEventArgs(mob, tickTime * 2, cancelToken.Token);
|
var args = new DoAfterEventArgs(mob, tickTime * 2, cancelToken.Token);
|
||||||
task = EntitySystem.Get<DoAfterSystem>().DoAfter(args);
|
task = EntitySystem.Get<DoAfterSystem>().DoAfter(args);
|
||||||
|
|||||||
@@ -14,10 +14,18 @@ namespace Content.IntegrationTests.Tests.Doors
|
|||||||
[TestOf(typeof(AirlockComponent))]
|
[TestOf(typeof(AirlockComponent))]
|
||||||
public class AirlockTest : ContentIntegrationTest
|
public class AirlockTest : ContentIntegrationTest
|
||||||
{
|
{
|
||||||
|
private const string PROTOTYPES = @"
|
||||||
|
- type: entity
|
||||||
|
name: AirlockDummy
|
||||||
|
id: AirlockDummy
|
||||||
|
components:
|
||||||
|
- type: Airlock
|
||||||
|
";
|
||||||
[Test]
|
[Test]
|
||||||
public async Task OpenCloseDestroyTest()
|
public async Task OpenCloseDestroyTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
@@ -77,7 +85,8 @@ namespace Content.IntegrationTests.Tests.Doors
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task AirlockBlockTest()
|
public async Task AirlockBlockTest()
|
||||||
{
|
{
|
||||||
var server = StartServer();
|
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -20,17 +20,36 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
|||||||
[TestOf(typeof(HandcuffComponent))]
|
[TestOf(typeof(HandcuffComponent))]
|
||||||
public class CuffUnitTest : ContentIntegrationTest
|
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]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
IEntity human;
|
IEntity human;
|
||||||
IEntity otherHuman;
|
IEntity otherHuman;
|
||||||
IEntity cuffs;
|
IEntity cuffs;
|
||||||
IEntity cables;
|
IEntity secondCuffs;
|
||||||
HandcuffComponent cableHandcuff;
|
|
||||||
HandcuffComponent handcuff;
|
HandcuffComponent handcuff;
|
||||||
|
HandcuffComponent secondHandcuff;
|
||||||
CuffableComponent cuffed;
|
CuffableComponent cuffed;
|
||||||
IHandsComponent hands;
|
IHandsComponent hands;
|
||||||
IBody body;
|
IBody body;
|
||||||
@@ -43,10 +62,10 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
|||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
// Spawn the entities
|
// Spawn the entities
|
||||||
human = entityManager.SpawnEntity("BaseHumanMob_Content", MapCoordinates.Nullspace);
|
human = entityManager.SpawnEntity("HumanDummy", MapCoordinates.Nullspace);
|
||||||
otherHuman = entityManager.SpawnEntity("BaseHumanMob_Content", MapCoordinates.Nullspace);
|
otherHuman = entityManager.SpawnEntity("HumanDummy", MapCoordinates.Nullspace);
|
||||||
cuffs = entityManager.SpawnEntity("Handcuffs", MapCoordinates.Nullspace);
|
cuffs = entityManager.SpawnEntity("HandcuffsDummy", MapCoordinates.Nullspace);
|
||||||
cables = entityManager.SpawnEntity("Cablecuffs", MapCoordinates.Nullspace);
|
secondCuffs = entityManager.SpawnEntity("HandcuffsDummy", MapCoordinates.Nullspace);
|
||||||
|
|
||||||
human.Transform.WorldPosition = otherHuman.Transform.WorldPosition;
|
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 hands!), $"Human has no {nameof(HandsComponent)}");
|
||||||
Assert.True(human.TryGetComponent(out body!), $"Human has no {nameof(IBody)}");
|
Assert.True(human.TryGetComponent(out body!), $"Human has no {nameof(IBody)}");
|
||||||
Assert.True(cuffs.TryGetComponent(out handcuff!), $"Handcuff has no {nameof(HandcuffComponent)}");
|
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
|
// Test to ensure cuffed players register the handcuffs
|
||||||
cuffed.AddNewCuffs(cuffs);
|
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");
|
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
|
// 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");
|
Assert.True(cuffed.CuffedHandCount == 4, "Player doesn't have correct amount of hands cuffed");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,10 +17,26 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
|||||||
[TestOf(typeof(ClimbingComponent))]
|
[TestOf(typeof(ClimbingComponent))]
|
||||||
public class ClimbUnitTest : ContentIntegrationTest
|
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]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
IEntity human;
|
IEntity human;
|
||||||
IEntity table;
|
IEntity table;
|
||||||
@@ -35,8 +51,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
|||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
// Spawn the entities
|
// Spawn the entities
|
||||||
human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
human = entityManager.SpawnEntity("HumanDummy", MapCoordinates.Nullspace);
|
||||||
table = entityManager.SpawnEntity("Table", MapCoordinates.Nullspace);
|
table = entityManager.SpawnEntity("TableDummy", MapCoordinates.Nullspace);
|
||||||
|
|
||||||
// Test for climb components existing
|
// Test for climb components existing
|
||||||
// Players and tables should have these in their prototypes.
|
// Players and tables should have these in their prototypes.
|
||||||
|
|||||||
@@ -20,10 +20,18 @@ namespace Content.IntegrationTests.Tests.Gravity
|
|||||||
[TestOf(typeof(GravityGeneratorComponent))]
|
[TestOf(typeof(GravityGeneratorComponent))]
|
||||||
public class WeightlessStatusTests : ContentIntegrationTest
|
public class WeightlessStatusTests : ContentIntegrationTest
|
||||||
{
|
{
|
||||||
|
private const string PROTOTYPES = @"
|
||||||
|
- type: entity
|
||||||
|
name: HumanDummy
|
||||||
|
id: HumanDummy
|
||||||
|
components:
|
||||||
|
- type: AlertsUI
|
||||||
|
";
|
||||||
[Test]
|
[Test]
|
||||||
public async Task WeightlessStatusTest()
|
public async Task WeightlessStatusTest()
|
||||||
{
|
{
|
||||||
var server = StartServer();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
@@ -56,7 +64,7 @@ namespace Content.IntegrationTests.Tests.Gravity
|
|||||||
|
|
||||||
pauseManager.DoMapInitialize(mapId);
|
pauseManager.DoMapInitialize(mapId);
|
||||||
|
|
||||||
human = entityManager.SpawnEntity("HumanMob_Content", coordinates);
|
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
||||||
|
|
||||||
Assert.True(human.TryGetComponent(out alerts));
|
Assert.True(human.TryGetComponent(out alerts));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,10 +17,19 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[TestOf(typeof(GravityGeneratorComponent))]
|
[TestOf(typeof(GravityGeneratorComponent))]
|
||||||
public class GravityGridTest : ContentIntegrationTest
|
public class GravityGridTest : ContentIntegrationTest
|
||||||
{
|
{
|
||||||
|
private const string PROTOTYPES = @"
|
||||||
|
- type: entity
|
||||||
|
name: GravityGeneratorDummy
|
||||||
|
id: GravityGeneratorDummy
|
||||||
|
components:
|
||||||
|
- type: GravityGenerator
|
||||||
|
- type: PowerReceiver
|
||||||
|
";
|
||||||
[Test]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
IEntity generator = null;
|
IEntity generator = null;
|
||||||
|
|
||||||
@@ -38,7 +47,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
generator = entityMan.SpawnEntity("GravityGenerator", grid2.ToCoordinates());
|
generator = entityMan.SpawnEntity("GravityGeneratorDummy", grid2.ToCoordinates());
|
||||||
Assert.That(generator.HasComponent<GravityGeneratorComponent>());
|
Assert.That(generator.HasComponent<GravityGeneratorComponent>());
|
||||||
Assert.That(generator.HasComponent<PowerReceiverComponent>());
|
Assert.That(generator.HasComponent<PowerReceiverComponent>());
|
||||||
var generatorComponent = generator.GetComponent<GravityGeneratorComponent>();
|
var generatorComponent = generator.GetComponent<GravityGeneratorComponent>();
|
||||||
|
|||||||
@@ -13,10 +13,17 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class GridTileLookupTest : ContentIntegrationTest
|
public class GridTileLookupTest : ContentIntegrationTest
|
||||||
{
|
{
|
||||||
|
private const string PROTOTYPES = @"
|
||||||
|
- type: entity
|
||||||
|
name: Dummy
|
||||||
|
id: Dummy
|
||||||
|
";
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var entityManager = server.ResolveDependency<IEntityManager>();
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
@@ -39,12 +46,12 @@ namespace Content.IntegrationTests.Tests
|
|||||||
Assert.That(entities.Count, Is.EqualTo(0));
|
Assert.That(entities.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
// Space entity, check that nothing intersects it and that also it doesn't throw.
|
// 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();
|
entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new Vector2i(1000, 1000)).ToList();
|
||||||
Assert.That(entities.Count, Is.EqualTo(0));
|
Assert.That(entities.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
var entityOne = entityManager.SpawnEntity("Food4NoRaisins", new EntityCoordinates(gridOne.GridEntityId, Vector2.Zero));
|
var entityOne = entityManager.SpawnEntity("Dummy", new EntityCoordinates(gridOne.GridEntityId, Vector2.Zero));
|
||||||
entityManager.SpawnEntity("Food4NoRaisins", new EntityCoordinates(gridOne.GridEntityId, Vector2.One));
|
entityManager.SpawnEntity("Dummy", new EntityCoordinates(gridOne.GridEntityId, Vector2.One));
|
||||||
|
|
||||||
var entityTiles = tileLookup.GetIndices(entityOne);
|
var entityTiles = tileLookup.GetIndices(entityOne);
|
||||||
Assert.That(entityTiles.Count, Is.EqualTo(2));
|
Assert.That(entityTiles.Count, Is.EqualTo(2));
|
||||||
|
|||||||
@@ -16,10 +16,51 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[TestOf(typeof(HumanInventoryControllerComponent))]
|
[TestOf(typeof(HumanInventoryControllerComponent))]
|
||||||
public class HumanInventoryUniformSlotsTest : ContentIntegrationTest
|
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]
|
[Test]
|
||||||
public async Task Test()
|
public async Task Test()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
IEntity human = null;
|
IEntity human = null;
|
||||||
IEntity uniform = null;
|
IEntity uniform = null;
|
||||||
@@ -35,11 +76,11 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
human = entityMan.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
human = entityMan.SpawnEntity("HumanDummy", MapCoordinates.Nullspace);
|
||||||
uniform = entityMan.SpawnEntity("UniformJanitor", MapCoordinates.Nullspace);
|
uniform = entityMan.SpawnEntity("UniformDummy", MapCoordinates.Nullspace);
|
||||||
idCard = entityMan.SpawnEntity("AssistantIDCard", MapCoordinates.Nullspace);
|
idCard = entityMan.SpawnEntity("IDCardDummy", MapCoordinates.Nullspace);
|
||||||
pocketItem = entityMan.SpawnEntity("FlashlightLantern", MapCoordinates.Nullspace);
|
pocketItem = entityMan.SpawnEntity("FlashlightDummy", MapCoordinates.Nullspace);
|
||||||
var tooBigItem = entityMan.SpawnEntity("ToolboxEmergency", MapCoordinates.Nullspace);
|
var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", MapCoordinates.Nullspace);
|
||||||
|
|
||||||
inventory = human.GetComponent<InventoryComponent>();
|
inventory = human.GetComponent<InventoryComponent>();
|
||||||
|
|
||||||
|
|||||||
@@ -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.GUI;
|
||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using Content.Server.GameObjects.Components.Mobs;
|
using Content.Server.GameObjects.Components.Mobs;
|
||||||
@@ -8,6 +9,7 @@ using Robust.Shared.Interfaces.GameObjects;
|
|||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests
|
namespace Content.IntegrationTests.Tests
|
||||||
@@ -16,10 +18,19 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[TestOf(typeof(InventoryHelpers))]
|
[TestOf(typeof(InventoryHelpers))]
|
||||||
public class InventoryHelpersTest : ContentIntegrationTest
|
public class InventoryHelpersTest : ContentIntegrationTest
|
||||||
{
|
{
|
||||||
|
private const string PROTOTYPES = @"
|
||||||
|
- type: entity
|
||||||
|
name: InventoryStunnableDummy
|
||||||
|
id: InventoryStunnableDummy
|
||||||
|
components:
|
||||||
|
- type: Inventory
|
||||||
|
- type: Stunnable
|
||||||
|
";
|
||||||
[Test]
|
[Test]
|
||||||
public async Task SpawnItemInSlotTest()
|
public async Task SpawnItemInSlotTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
IEntity human = null;
|
IEntity human = null;
|
||||||
InventoryComponent inventory = null;
|
InventoryComponent inventory = null;
|
||||||
@@ -34,7 +45,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
human = entityMan.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
human = entityMan.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace);
|
||||||
inventory = human.GetComponent<InventoryComponent>();
|
inventory = human.GetComponent<InventoryComponent>();
|
||||||
stun = human.GetComponent<StunnableComponent>();
|
stun = human.GetComponent<StunnableComponent>();
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,111 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class PowerTest : ContentIntegrationTest
|
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]
|
[Test]
|
||||||
public async Task PowerNetTest()
|
public async Task PowerNetTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
PowerSupplierComponent supplier = null;
|
PowerSupplierComponent supplier = null;
|
||||||
PowerConsumerComponent consumer1 = null;
|
PowerConsumerComponent consumer1 = null;
|
||||||
@@ -31,9 +132,9 @@ namespace Content.IntegrationTests.Tests
|
|||||||
mapMan.CreateMap(new MapId(1));
|
mapMan.CreateMap(new MapId(1));
|
||||||
var grid = mapMan.CreateGrid(new MapId(1));
|
var grid = mapMan.CreateGrid(new MapId(1));
|
||||||
|
|
||||||
var generatorEnt = entityMan.SpawnEntity("DebugGenerator", grid.ToCoordinates());
|
var generatorEnt = entityMan.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
|
||||||
var consumerEnt1 = entityMan.SpawnEntity("DebugConsumer", grid.ToCoordinates(0, 1));
|
var consumerEnt1 = entityMan.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1));
|
||||||
var consumerEnt2 = entityMan.SpawnEntity("DebugConsumer", grid.ToCoordinates(0, 2));
|
var consumerEnt2 = entityMan.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
if (generatorEnt.TryGetComponent(out AnchorableComponent anchorable))
|
if (generatorEnt.TryGetComponent(out AnchorableComponent anchorable))
|
||||||
{
|
{
|
||||||
@@ -68,7 +169,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task ApcChargingTest()
|
public async Task ApcChargingTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
BatteryComponent apcBattery = null;
|
BatteryComponent apcBattery = null;
|
||||||
PowerSupplierComponent substationSupplier = null;
|
PowerSupplierComponent substationSupplier = null;
|
||||||
@@ -80,9 +182,9 @@ namespace Content.IntegrationTests.Tests
|
|||||||
mapMan.CreateMap(new MapId(1));
|
mapMan.CreateMap(new MapId(1));
|
||||||
var grid = mapMan.CreateGrid(new MapId(1));
|
var grid = mapMan.CreateGrid(new MapId(1));
|
||||||
|
|
||||||
var generatorEnt = entityMan.SpawnEntity("DebugGenerator", grid.ToCoordinates());
|
var generatorEnt = entityMan.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
|
||||||
var substationEnt = entityMan.SpawnEntity("DebugSubstation", grid.ToCoordinates(0, 1));
|
var substationEnt = entityMan.SpawnEntity("SubstationDummy", grid.ToCoordinates(0, 1));
|
||||||
var apcEnt = entityMan.SpawnEntity("DebugApc", grid.ToCoordinates(0, 2));
|
var apcEnt = entityMan.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
Assert.That(generatorEnt.TryGetComponent<PowerSupplierComponent>(out var generatorSupplier));
|
Assert.That(generatorEnt.TryGetComponent<PowerSupplierComponent>(out var generatorSupplier));
|
||||||
|
|
||||||
@@ -115,7 +217,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task ApcNetTest()
|
public async Task ApcNetTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerIntegrationOptions{ExtraPrototypes = PROTOTYPES};
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
|
|
||||||
PowerReceiverComponent receiver = null;
|
PowerReceiverComponent receiver = null;
|
||||||
|
|
||||||
@@ -126,9 +229,9 @@ namespace Content.IntegrationTests.Tests
|
|||||||
mapMan.CreateMap(new MapId(1));
|
mapMan.CreateMap(new MapId(1));
|
||||||
var grid = mapMan.CreateGrid(new MapId(1));
|
var grid = mapMan.CreateGrid(new MapId(1));
|
||||||
|
|
||||||
var apcEnt = entityMan.SpawnEntity("DebugApc", grid.ToCoordinates(0, 0));
|
var apcEnt = entityMan.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 0));
|
||||||
var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCable", grid.ToCoordinates(0, 1));
|
var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCableDummy", grid.ToCoordinates(0, 1));
|
||||||
var powerReceiverEnt = entityMan.SpawnEntity("DebugPowerReceiver", grid.ToCoordinates(0, 2));
|
var powerReceiverEnt = entityMan.SpawnEntity("PowerReceiverDummy", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
Assert.That(apcEnt.TryGetComponent<ApcComponent>(out var apc));
|
Assert.That(apcEnt.TryGetComponent<ApcComponent>(out var apc));
|
||||||
Assert.That(apcExtensionEnt.TryGetComponent<PowerProviderComponent>(out var provider));
|
Assert.That(apcExtensionEnt.TryGetComponent<PowerProviderComponent>(out var provider));
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace Content.Server.GameObjects.Components.ActionBlocking
|
|||||||
_container.Insert(handcuff);
|
_container.Insert(handcuff);
|
||||||
CanStillInteract = _hands.Hands.Count() > CuffedHandCount;
|
CanStillInteract = _hands.Hands.Count() > CuffedHandCount;
|
||||||
|
|
||||||
OnCuffedStateChanged.Invoke();
|
OnCuffedStateChanged?.Invoke();
|
||||||
UpdateAlert();
|
UpdateAlert();
|
||||||
UpdateHeldItems();
|
UpdateHeldItems();
|
||||||
Dirty();
|
Dirty();
|
||||||
|
|||||||
Reference in New Issue
Block a user