ECS and cleanup body system, merge body templates and presets into body prototypes (#11991)
Co-authored-by: Jezithyr <Jezithyr@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.Rotation;
|
||||
@@ -12,7 +12,7 @@ using Robust.Shared.Maths;
|
||||
namespace Content.IntegrationTests.Tests.Body
|
||||
{
|
||||
[TestFixture]
|
||||
[TestOf(typeof(SharedBodyComponent))]
|
||||
[TestOf(typeof(BodyPartComponent))]
|
||||
[TestOf(typeof(BodyComponent))]
|
||||
public sealed class LegTest
|
||||
{
|
||||
@@ -23,16 +23,15 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
components:
|
||||
- type: Appearance
|
||||
- type: Body
|
||||
template: HumanoidTemplate
|
||||
preset: HumanPreset
|
||||
centerSlot: torso
|
||||
prototype: Human
|
||||
- type: StandingState
|
||||
";
|
||||
|
||||
[Test]
|
||||
public async Task RemoveLegsFallTest()
|
||||
{
|
||||
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes});
|
||||
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
|
||||
{NoClient = true, ExtraPrototypes = Prototypes});
|
||||
var server = pairTracker.Pair.Server;
|
||||
|
||||
AppearanceComponent appearance = null;
|
||||
@@ -44,18 +43,20 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
var mapId = mapManager.CreateMap();
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var human = entityManager.SpawnEntity("HumanBodyAndAppearanceDummy", new MapCoordinates(Vector2.Zero, mapId));
|
||||
var human = entityManager.SpawnEntity("HumanBodyAndAppearanceDummy",
|
||||
new MapCoordinates(Vector2.Zero, mapId));
|
||||
|
||||
Assert.That(entityManager.TryGetComponent(human, out SharedBodyComponent body));
|
||||
Assert.That(entityManager.TryGetComponent(human, out BodyComponent body));
|
||||
Assert.That(entityManager.TryGetComponent(human, out appearance));
|
||||
|
||||
Assert.That(!appearance.TryGetData(RotationVisuals.RotationState, out RotationState _));
|
||||
|
||||
var legs = body.GetPartsOfType(BodyPartType.Leg);
|
||||
var bodySystem = entityManager.System<BodySystem>();
|
||||
var legs = bodySystem.GetBodyChildrenOfType(body.Owner, BodyPartType.Leg, body);
|
||||
|
||||
foreach (var leg in legs)
|
||||
{
|
||||
body.RemovePart(leg);
|
||||
bodySystem.DropPart(leg.Id, leg.Component);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user