Skip to content

Commit

Permalink
Some Surgery Fixs (#1471)
Browse files Browse the repository at this point in the history
<!--
This is a semi-strict format, you can add/remove sections as needed but
the order/format should be kept the same
Remove these comments before submitting
-->

# Description

<!--
Explain this PR in as much detail as applicable

Some example prompts to consider:
How might this affect the game? The codebase?
What might be some alternatives to this?
How/Who does this benefit/hurt [the game/codebase]?
-->

When attempting to insert an organ, a check is now performed to ensure a
container exists for it. Skeletons can now lie down, and nymphs can now
be subject to surgery.
---

# Changelog

<!--
You can add an author after the `:cl:` to change the name that appears
in the changelog (ex: `:cl: Death`)
Leaving it blank will default to your GitHub display name
This includes all available types for the changelog
-->

:cl: Spatison
- tweak: Nymphs are now operable.
- fix: Skeletons can now lie down.
- fix: It is no longer possible to insert an organ into a body if the
required space is unavailable.
  • Loading branch information
Spatison authored Jan 10, 2025
1 parent 86296da commit b89412a
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 2 deletions.
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

0 comments on commit b89412a

Please sign in to comment.