Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed Feb 9, 2025
1 parent 730265b commit 3a91554
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 18 deletions.
8 changes: 6 additions & 2 deletions Content.IntegrationTests/Tests/Backmen/Body/HandsTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Linq;
using Content.Server.Body.Systems;
using Content.Server.Hands.Systems;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Humanoid.Prototypes;
using Robust.Shared.GameObjects;
Expand Down Expand Up @@ -36,8 +37,11 @@ await server.WaitAssertion(() =>
await server.WaitAssertion(() =>
{
Assert.That(dummy, Is.Not.EqualTo(EntityUid.Invalid));
var handCount = bodySys.GetBodyPartCount(dummy, BodyPartType.Leg);
Assert.That(handCount, Is.GreaterThanOrEqualTo(2), $"legs {speciesPrototype.ID}({speciesPrototype.Prototype})");
var bodyComp = server.EntMan.GetComponent<BodyComponent>(dummy);
var legs = bodyComp.LegEntities;
var legsCount = bodySys.GetBodyPartCount(dummy, BodyPartType.Leg);
Assert.That(legsCount, Is.EqualTo(legs.Count));
Assert.That(legsCount, Is.GreaterThanOrEqualTo(2), $"legs {speciesPrototype.ID}({speciesPrototype.Prototype})");
});

}
Expand Down
16 changes: 16 additions & 0 deletions Content.Shared/Body/Systems/SharedBodySystem.Parts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,33 @@ private void OnBodyPartInserted(Entity<BodyPartComponent> ent, ref EntInsertedIn
if (ent.Comp.Body is null)
return;


if (TryComp(insertedUid, out BodyPartComponent? part) && slotId.Contains(PartSlotContainerIdPrefix + GetSlotFromBodyPart(part))) // Shitmed Change
{
AddPart(ent.Comp.Body.Value, (insertedUid, part), slotId);
RecursiveBodyUpdate((insertedUid, part), ent.Comp.Body.Value);
CheckBodyPart((insertedUid, part), GetTargetBodyPart(part), false); // Shitmed Change
}
#if DEBUG
else if(HasComp<BodyPartComponent>(insertedUid))
{
DebugTools.Assert(
slotId.Contains(PartSlotContainerIdPrefix + GetSlotFromBodyPart(part)),
$"BodyPartComponent has not been inserted ({MetaData(args.Entity).EntityName})" +
$" прототип должен иметь подключение начиная с {GetSlotFromBodyPart(part)}");
}
#endif

if (TryComp(insertedUid, out OrganComponent? organ) && slotId.Contains(OrganSlotContainerIdPrefix + organ.SlotId)) // Shitmed Change
{
AddOrgan((insertedUid, organ), ent.Comp.Body.Value, ent);
}
#if DEBUG
else if(HasComp<OrganComponent>(insertedUid))
{
DebugTools.Assert($"OrganComponent has not been inserted ({MetaData(args.Entity).EntityName})");
}
#endif
}

private void OnBodyPartRemoved(Entity<BodyPartComponent> ent, ref EntRemovedFromContainerMessage args)
Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/_Backmen/Body/Parts/spider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
sprite: Backmen/Mobs/Species/Moth/parts.rsi
state: "torso_m"
- type: BodyPart #"Other" type
slotId: thorax
containerName: thorax_slot

- type: entity
id: RightLegSpider
Expand Down
32 changes: 16 additions & 16 deletions Resources/Prototypes/_Backmen/Body/Prototypes/arachne.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@
thorax:
part: ThoraxSpider
connections:
- left foreleg
- left second leg
- left third leg
- left hind leg
- right foreleg
- right second leg
- right third leg
- right hind leg
left foreleg:
- left leg first
- left leg second
- left leg third
- left leg hind
- right leg first
- right leg second
- right leg third
- right leg hind
left leg first:
part: LeftLegSpider
left second leg:
left leg second:
part: LeftLegSpider
left third leg:
left leg third:
part: LeftLegSpider
left hind leg:
left leg hind:
part: LeftLegSpider
right foreleg:
right leg first:
part: RightLegSpider
right second leg:
right leg second:
part: RightLegSpider
right third leg:
right leg third:
part: RightLegSpider
right hind leg:
right leg hind:
part: RightLegSpider

0 comments on commit 3a91554

Please sign in to comment.