Change all of body system to use entities and components (#2074)
* Early commit * Early commit 2 * merging master broke my git * does anyone even read these * life is fleeting * it just works * this time passing integration tests * Remove hashset yaml serialization for now * You got a license for those nullables? * No examine, no context menu, part and mechanism parenting and visibility * Fix wrong brain sprite state * Removing layers was a mistake * just tear body system a new one and see if it still breathes * Remove redundant code * Add that comment back * Separate damage and body, component states, stomach rework * Add containers for body parts * Bring layers back pls * Fix parts magically changing color * Reimplement sprite layer visibility * Fix tests * Add leg test * Active legs is gone Crab rave * Merge fixes, rename DamageState to CurrentState * Remove IShowContextMenu and ICanExamine
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
#nullable enable
|
||||
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Client.GameObjects.Components.Items;
|
||||
using Content.Server.Body;
|
||||
using Content.Server.GameObjects.Components.ActionBlocking;
|
||||
using Content.Server.GameObjects.Components.Body;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using NUnit.Framework;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
{
|
||||
@@ -36,7 +33,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
HandcuffComponent handcuff;
|
||||
CuffableComponent cuffed;
|
||||
IHandsComponent hands;
|
||||
BodyManagerComponent body;
|
||||
IBody body;
|
||||
|
||||
server.Assert(() =>
|
||||
{
|
||||
@@ -56,7 +53,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
// Test for components existing
|
||||
Assert.True(human.TryGetComponent(out cuffed!), $"Human has no {nameof(CuffableComponent)}");
|
||||
Assert.True(human.TryGetComponent(out hands!), $"Human has no {nameof(HandsComponent)}");
|
||||
Assert.True(human.TryGetComponent(out body!), $"Human has no {nameof(BodyManagerComponent)}");
|
||||
Assert.True(human.TryGetBody(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)}");
|
||||
|
||||
@@ -65,8 +62,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
Assert.True(cuffed.CuffedHandCount > 0, "Handcuffing a player did not result in their hands being cuffed");
|
||||
|
||||
// Test to ensure a player with 4 hands will still only have 2 hands cuffed
|
||||
AddHand(body);
|
||||
AddHand(body);
|
||||
AddHand(cuffed.Owner);
|
||||
AddHand(cuffed.Owner);
|
||||
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
|
||||
@@ -78,16 +75,10 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
await server.WaitIdleAsync();
|
||||
}
|
||||
|
||||
private void AddHand(BodyManagerComponent body)
|
||||
private void AddHand(IEntity to)
|
||||
{
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
prototypeManager.TryIndex("bodyPart.LHand.BasicHuman", out BodyPartPrototype prototype);
|
||||
|
||||
var part = new BodyPart(prototype);
|
||||
var slot = part.GetHashCode().ToString();
|
||||
|
||||
body.Template.Slots.Add(slot, BodyPartType.Hand);
|
||||
body.TryAddPart(slot, part, true);
|
||||
var shell = IoCManager.Resolve<IConsoleShell>();
|
||||
shell.ExecuteCommand($"addhand {to.Uid}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user