Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Surgery Fixs #1471

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ public sealed partial class SurgeryOrganConditionComponent : Component

[DataField]
public bool Reattaching;
}

[DataField(required: true)]
public string SlotId = string.Empty;
}
4 changes: 3 additions & 1 deletion Content.Shared/_Shitmed/Surgery/SharedSurgerySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Content.Shared.Prototypes;
using Content.Shared.Standing;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
Expand All @@ -47,6 +48,7 @@ public abstract partial class SharedSurgerySystem : EntitySystem
[Dependency] private readonly RotateToFaceSystem _rotateToFace = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;

/// <summary>
/// Cache of all surgery prototypes' singleton entities.
Expand Down Expand Up @@ -265,7 +267,7 @@ private void OnOrganConditionValid(Entity<SurgeryOrganConditionComponent> ent, r
&& !organs.Any(organ => HasComp<OrganReattachedComponent>(organ.Id))))
args.Cancelled = true;
}
else if (!ent.Comp.Inverse)
else if (!ent.Comp.Inverse || !_container.TryGetContainer(args.Part, SharedBodySystem.GetOrganContainerId(ent.Comp.SlotId), out _))
args.Cancelled = true;
}
}
Expand Down
15 changes: 15 additions & 0 deletions Resources/Prototypes/Body/Organs/diona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@
- type: IsDeadIC
- type: Body
prototype: AnimalNymphBrain
- type: SurgeryTarget
- type: UserInterface
interfaces:
enum.SurgeryUIKey.Key:
type: SurgeryBui

- type: entity
id: OrganDionaNymphStomach
Expand All @@ -196,6 +201,11 @@
- type: IsDeadIC
- type: Body
prototype: AnimalNymphStomach
- type: SurgeryTarget
- type: UserInterface
interfaces:
enum.SurgeryUIKey.Key:
type: SurgeryBui

- type: entity
id: OrganDionaNymphLungs
Expand All @@ -208,3 +218,8 @@
- type: IsDeadIC
- type: Body
prototype: AnimalNymphLungs
- type: SurgeryTarget
- type: UserInterface
interfaces:
enum.SurgeryUIKey.Key:
type: SurgeryBui
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Mobs/Species/skeleton.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
- type: FireVisuals
alternateState: Standing
- type: FootPrints
- type: LayingDown

- type: entity
parent: BaseSpeciesDummy
Expand Down
32 changes: 32 additions & 0 deletions Resources/Prototypes/_Shitmed/Entities/Surgery/surgeries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,16 @@
- type: SurgeryOrganCondition
organ:
- type: Brain
slotId: brain

- type: entity
parent: SurgeryRemoveBrain
id: SurgeryRemoveBrainTorso
name: Remove Brain
categories: [ HideSpawnMenu ]
components:
- type: SurgeryPartCondition
part: Torso

- type: entity
parent: SurgeryBase
Expand All @@ -397,6 +407,16 @@
- type: Brain
inverse: true
reattaching: true
slotId: brain

- type: entity
parent: SurgeryInsertBrain
id: SurgeryInsertBrainTorso
name: Insert Brain
categories: [ HideSpawnMenu ]
components:
- type: SurgeryPartCondition
part: Torso

- type: entity
parent: SurgeryBase
Expand All @@ -415,6 +435,7 @@
- type: SurgeryOrganCondition
organ:
- type: Heart
slotId: heart

- type: entity
parent: SurgeryBase
Expand All @@ -435,6 +456,7 @@
- type: Heart
inverse: true
reattaching: true
slotId: heart

- type: entity
parent: SurgeryBase
Expand All @@ -453,6 +475,7 @@
- type: SurgeryOrganCondition
organ:
- type: Liver
slotId: liver

- type: entity
parent: SurgeryBase
Expand All @@ -473,6 +496,7 @@
- type: Liver
inverse: true
reattaching: true
slotId: liver

- type: entity
parent: SurgeryBase
Expand All @@ -491,6 +515,7 @@
- type: SurgeryOrganCondition
organ:
- type: Lung
slotId: lungs

- type: entity
parent: SurgeryBase
Expand All @@ -511,6 +536,7 @@
- type: Lung
inverse: true
reattaching: true
slotId: lungs

- type: entity
parent: SurgeryBase
Expand All @@ -529,6 +555,7 @@
- type: SurgeryOrganCondition
organ:
- type: Stomach
slotId: stomach

- type: entity
parent: SurgeryBase
Expand All @@ -549,6 +576,7 @@
- type: Stomach
inverse: true
reattaching: true
slotId: stomach

- type: entity
parent: SurgeryBase
Expand All @@ -567,6 +595,7 @@
- type: SurgeryOrganCondition
organ:
- type: Eyes
slotId: eyes

- type: entity
parent: SurgeryBase
Expand All @@ -587,6 +616,7 @@
- type: Eyes
inverse: true
reattaching: true
slotId: eyes

- type: entity
parent: SurgeryBase
Expand All @@ -602,6 +632,7 @@
- type: SurgeryOrganCondition
organ:
- type: Brain
slotId: brain
- type: SurgeryOrganOnAddCondition
components:
brain:
Expand Down Expand Up @@ -629,6 +660,7 @@
- type: SurgeryOrganCondition
organ:
- type: Brain
slotId: brain
- type: SurgeryOrganOnAddCondition
components:
brain:
Expand Down
Loading