Фикс присоединения и ампутаций предметов (#3758)

This commit is contained in:
k // d270rg 2026-01-21 23:55:49 +03:00 committed by GitHub
parent f2440b1824
commit 6e37dd002d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 14 deletions

View file

@ -121,6 +121,7 @@ public sealed class CustomLimbVisualizerSystem : EntitySystem
{
var index = sprite.LayerMapReserveBlank($"custom-{layer}");
sprite.LayerSetVisible(layer, false);
sprite.LayerSetVisible($"custom-{layer}", false);
}
}
}

View file

@ -4,10 +4,10 @@ using Content.Shared._Sunrise;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Starlight;
namespace Content.Server._Starlight.Medical.Limbs;
public sealed partial class LimbSystem : SharedLimbSystem
{
public void AddLimbVisual(Entity<HumanoidAppearanceComponent> body, Entity<BodyPartComponent> limb)

View file

@ -1,4 +1,4 @@
using System.Linq;
using Content.Server.Administration.Systems;
using Content.Server.Body.Systems;
using Content.Server.Hands.Systems;
using Content.Server.Humanoid;
@ -8,14 +8,13 @@ using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Hands.Components;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Interaction.Components;
using Content.Shared.Starlight;
using Content.Shared.Starlight.Medical.Surgery;
using Robust.Server.Containers;
using Robust.Shared.Prototypes;
namespace Content.Server._Starlight.Medical.Limbs;
public sealed partial class LimbSystem : SharedLimbSystem
{
[Dependency] private readonly ContainerSystem _containers = default!;
@ -24,6 +23,7 @@ public sealed partial class LimbSystem : SharedLimbSystem
[Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearanceSystem = default!;
[Dependency] private readonly MetaDataSystem _metadata = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly StarlightEntitySystem _entity = default!;
private readonly EntProtoId _virtual = "PartVirtual";
public override void Initialize()
@ -64,7 +64,7 @@ public sealed partial class LimbSystem : SharedLimbSystem
return true;
}
public void Amputatate(Entity<TransformComponent, HumanoidAppearanceComponent, BodyComponent> body, Entity<TransformComponent, MetaDataComponent, BodyPartComponent> limb)
public void Amputate(Entity<TransformComponent, HumanoidAppearanceComponent, BodyComponent> body, Entity<TransformComponent, MetaDataComponent> limb)
{
if (!_containers.TryGetContainingContainer((limb.Owner, limb.Comp1, limb.Comp2), out var container)
|| _body.GetParentPartAndSlotOrNull(limb.Owner) is not var (_, slotId)
@ -72,10 +72,10 @@ public sealed partial class LimbSystem : SharedLimbSystem
if (TryComp<CustomLimbComponent>(limb, out var virtualLimb))
AmputateItemLimb((body, body.Comp1, body.Comp3), limb, slotId, virtualLimb);
else
else if (_entity.TryEntity<TransformComponent, MetaDataComponent, BodyPartComponent>(limb, out var bodyPart))
{
RemoveLimbVisual(body, limb);
RemoveLimb(body, limb);
RemoveLimbVisual(body, bodyPart);
RemoveLimb(body, bodyPart);
}
}
@ -87,7 +87,7 @@ public sealed partial class LimbSystem : SharedLimbSystem
Dirty(body, vizualizer);
}
private void AmputateItemLimb(Entity<TransformComponent, BodyComponent> body, Entity<TransformComponent, MetaDataComponent, BodyPartComponent> limb, string slotId, CustomLimbComponent virtualLimb)
private void AmputateItemLimb(Entity<TransformComponent, BodyComponent> body, Entity<TransformComponent, MetaDataComponent> limb, string slotId, CustomLimbComponent virtualLimb)
{
RemoveItemLimb(body, virtualLimb.Item, BodySystem.GetPartSlotContainerId(slotId));

View file

@ -7,10 +7,8 @@ using Content.Shared.Body.Components;
using Content.Shared.Body.Organ;
using Content.Shared.Body.Part;
using Content.Shared.Body.Systems;
using Content.Shared.Damage;
using Content.Shared.Humanoid;
using Content.Shared.Traits.Assorted;
using Microsoft.CodeAnalysis;
using Content.Server._Starlight.Medical.Limbs;
using Content.Server.Administration.Systems;
using Content.Shared.Bed.Sleep;
@ -170,8 +168,8 @@ public sealed partial class SurgerySystem : SharedSurgerySystem
private void OnStepAmputationComplete(Entity<SurgeryStepAmputationEffectComponent> ent, ref SurgeryStepEvent args)
{
if (_entity.TryEntity<TransformComponent, HumanoidAppearanceComponent, BodyComponent>(args.Body, out var body)
&& _entity.TryEntity<TransformComponent, MetaDataComponent, BodyPartComponent>(args.Part, out var limb))
_limbSystem.Amputatate(body, limb);
&& _entity.TryEntity<TransformComponent, MetaDataComponent>(args.Part, out var limb))
_limbSystem.Amputate(body, limb);
}
private void CustomLimbRemoved(Entity<CustomLimbMarkerComponent> ent, ref ComponentRemove args)

View file

@ -21,7 +21,6 @@
tags:
- Trash
# Sunrise-start
- type: SurgeryTarget
- type: UserInterface
interfaces:
enum.SurgeryUIKey.Key:

View file

@ -48,6 +48,7 @@
voice: Portal2FactCore # Sunrise-TTS
- type: StaticPrice
price: 0 # Sunrise-TTS
- type: SurgeryTarget # Sunrise added
- type: entity
name: "storage item"