Skip to content

Commit

Permalink
fix shitmed test (#1040)
Browse files Browse the repository at this point in the history
* fix tests

* fix

* fix

* Update base.yml

* fix
  • Loading branch information
Rxup authored Feb 10, 2025
1 parent 730265b commit 0a89028
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 49 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
19 changes: 18 additions & 1 deletion Content.Shared/Body/Systems/SharedBodySystem.Parts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Robust.Shared.Containers;
using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using Content.Shared.Backmen.Mood;
using Content.Shared.Backmen.Surgery.Body.Events;
Expand Down Expand Up @@ -167,17 +168,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 ({Prototype(args.Entity)?.ID}) into {Prototype(ent.Comp.Body.Value)?.ID}" +
$" прототип должен иметь подключение начиная с {GetSlotFromBodyPart(part)} (сейчас {slotId.Replace(PartSlotContainerIdPrefix,"")})");
}
#endif

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

private void OnBodyPartRemoved(Entity<BodyPartComponent> ent, ref EntRemovedFromContainerMessage args)
Expand Down
8 changes: 4 additions & 4 deletions Resources/Prototypes/Body/Prototypes/primate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
torso:
part: TorsoAnimal
connections:
- hands 1
- hands 2
- left hands 1
- left hands 2
- legs
- head
organs:
Expand All @@ -23,9 +23,9 @@
liver: OrganAnimalLiver
heart: OrganAnimalHeart
kidneys: OrganAnimalKidneys
hands 1:
left hands 1:
part: HandsAnimal
hands 2:
left hands 2:
part: HandsAnimal
legs:
part: LegsAnimal
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
24 changes: 12 additions & 12 deletions Resources/Prototypes/_Backmen/Body/Prototypes/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
torso:
part: TorsoDrone
connections:
- hand 1
- hand 2
- hand 3
- hand 4
- hand 5
- hand 6
hand 1:
- left arm 1
- left arm 2
- left arm 3
- left arm 4
- right arm 5
- right arm 6
left arm 1:
part: LeftArmBorg
hand 2:
left arm 2:
part: LeftArmBorg
hand 3:
left arm 3:
part: LeftArmBorg
hand 4:
left arm 4:
part: LeftArmBorg
hand 5:
right arm 5:
part: RightArmBorg
hand 6:
right arm 6:
part: RightArmBorg

- type: entity
Expand Down
16 changes: 8 additions & 8 deletions Resources/Prototypes/_Backmen/Body/Prototypes/haisenberg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
heart: OrganAnimalHeart
kidneys: OrganAnimalKidneys
connections:
- right_arm
- left_arm
- right arm
- left arm
- legs
right_arm:
right arm:
part: RightArmHuman
connections:
- right_hand
left_arm:
- right hand
left arm:
part: LeftArmHuman
connections:
- left_hand
right_hand:
- left hand
right hand:
part: RightHandHuman
left_hand:
left hand:
part: LeftHandHuman
legs:
part: LegsAnimal
Expand Down
35 changes: 29 additions & 6 deletions Resources/Prototypes/_Backmen/Entities/Mobs/NPCs/base.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
- type: entity
name: BaseNpc
name: Базированная База НПЦ
id: MobBaseNpc
parent: SimpleSpaceMobBase
parent: [SimpleSpaceMobBase, StripableInventoryBase]
description: Just a body, be calm.
components:
- type: UniversalLanguageSpeaker
- type: DiseaseCarrier
- type: CombatMode
- type: SurgeryTarget
- type: Stripping
- type: Strippable
- type: UserInterface
interfaces:
enum.StrippingUiKey.Key:
type: StrippableBoundUserInterface
enum.SurgeryUIKey.Key:
type: SurgeryBui
- type: ComplexInteraction
- type: StatusEffects
allowed:
- Stun
Expand All @@ -16,7 +29,6 @@
- StaminaModifier
- type: ZombieImmune
- type: Rotatable
- type: CombatMode
- type: InputMover
- type: MobMover
- type: MeleeWeapon
Expand All @@ -40,6 +52,8 @@
- type: NpcFactionMember
factions:
- SimpleNeutral
- type: Inventory
templateId: human
- type: Hands
- type: RotationVisuals
defaultRotation: 90
Expand Down Expand Up @@ -117,16 +131,25 @@
torso:
part: TorsoHuman
connections:
- legs
- right leg
- left leg
organs:
lungs: OrganAnimalLungs
stomach: OrganAnimalStomach
liver: OrganAnimalLiver
heart: OrganAnimalHeart
kidneys: OrganAnimalKidneys
legs:
right leg:
part: RightLegHuman
connections:
- feet
- right foot
left leg:
part: LeftLegHuman
connections:
- left foot
right foot:
part: RightFootHuman
left foot:
part: LeftFootHuman
feet:
part: RightFootHuman

0 comments on commit 0a89028

Please sign in to comment.