Hotfix: Not all pens embed, exploding pens embed when activated (#41105)

* Revert "All pens embed (#39104)"

This reverts commit 3c1982a85f.

* only activated pens embed

* fix disembedding during prediction
This commit is contained in:
slarticodefast
2025-10-26 02:37:41 +02:00
committed by GitHub
parent 27af3ab934
commit bb248dcff8
4 changed files with 35 additions and 40 deletions

View File

@@ -1,18 +1,15 @@
using System.Numerics;
using Content.Shared.CombatMode.Pacification;
using Content.Shared.Damage;
using Content.Shared.DoAfter;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Shared.Mobs.Components;
using Content.Shared.Throwing;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Serialization;
@@ -24,7 +21,6 @@ public abstract partial class SharedProjectileSystem : EntitySystem
{
public const string ProjectileFixture = "projectile";
[Dependency] private readonly INetManager _net = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
@@ -136,20 +132,20 @@ public abstract partial class SharedProjectileSystem : EntitySystem
if (!Resolve(uid, ref component))
return;
if (component.EmbeddedIntoUid is not null)
if (component.EmbeddedIntoUid == null)
return; // the entity is not embedded, so do nothing
if (TryComp<EmbeddedContainerComponent>(component.EmbeddedIntoUid.Value, out var embeddedContainer))
{
if (TryComp<EmbeddedContainerComponent>(component.EmbeddedIntoUid.Value, out var embeddedContainer))
{
embeddedContainer.EmbeddedObjects.Remove(uid);
Dirty(component.EmbeddedIntoUid.Value, embeddedContainer);
if (embeddedContainer.EmbeddedObjects.Count == 0)
RemCompDeferred<EmbeddedContainerComponent>(component.EmbeddedIntoUid.Value);
}
embeddedContainer.EmbeddedObjects.Remove(uid);
Dirty(component.EmbeddedIntoUid.Value, embeddedContainer);
if (embeddedContainer.EmbeddedObjects.Count == 0)
RemCompDeferred<EmbeddedContainerComponent>(component.EmbeddedIntoUid.Value);
}
if (component.DeleteOnRemove && _net.IsServer)
if (component.DeleteOnRemove)
{
QueueDel(uid);
PredictedQueueDel(uid);
return;
}