From bb248dcff8960552d638f106a21e41a70f038252 Mon Sep 17 00:00:00 2001 From: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Date: Sun, 26 Oct 2025 02:37:41 +0200 Subject: [PATCH] Hotfix: Not all pens embed, exploding pens embed when activated (#41105) * Revert "All pens embed (#39104)" This reverts commit 3c1982a85fedb8a38a7bcf51ea05a22b1eea5a99. * only activated pens embed * fix disembedding during prediction --- .../Projectiles/SharedProjectileSystem.cs | 24 +++++++-------- Resources/Changelog/Changelog.yml | 7 ----- .../Prototypes/Entities/Objects/Misc/pen.yml | 30 ++++++++----------- .../Entities/Objects/Weapons/Bombs/pen.yml | 14 +++++++-- 4 files changed, 35 insertions(+), 40 deletions(-) diff --git a/Content.Shared/Projectiles/SharedProjectileSystem.cs b/Content.Shared/Projectiles/SharedProjectileSystem.cs index 20d1e051a2..f99950c8f1 100644 --- a/Content.Shared/Projectiles/SharedProjectileSystem.cs +++ b/Content.Shared/Projectiles/SharedProjectileSystem.cs @@ -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(component.EmbeddedIntoUid.Value, out var embeddedContainer)) { - if (TryComp(component.EmbeddedIntoUid.Value, out var embeddedContainer)) - { - embeddedContainer.EmbeddedObjects.Remove(uid); - Dirty(component.EmbeddedIntoUid.Value, embeddedContainer); - if (embeddedContainer.EmbeddedObjects.Count == 0) - RemCompDeferred(component.EmbeddedIntoUid.Value); - } + embeddedContainer.EmbeddedObjects.Remove(uid); + Dirty(component.EmbeddedIntoUid.Value, embeddedContainer); + if (embeddedContainer.EmbeddedObjects.Count == 0) + RemCompDeferred(component.EmbeddedIntoUid.Value); } - if (component.DeleteOnRemove && _net.IsServer) + if (component.DeleteOnRemove) { - QueueDel(uid); + PredictedQueueDel(uid); return; } diff --git a/Resources/Changelog/Changelog.yml b/Resources/Changelog/Changelog.yml index ce9e21315f..bd99b299c4 100644 --- a/Resources/Changelog/Changelog.yml +++ b/Resources/Changelog/Changelog.yml @@ -3721,13 +3721,6 @@ id: 9121 time: '2025-10-18T17:58:32.0000000+00:00' url: https://github.com/space-wizards/space-station-14/pull/38871 -- author: Mehnix - changes: - - message: All pens now embed when thrown. - type: Tweak - id: 9122 - time: '2025-10-18T21:39:32.0000000+00:00' - url: https://github.com/space-wizards/space-station-14/pull/39104 - author: JackRyd3r changes: - message: You can now put the Energy Magnum to into jackboots/combat boots and diff --git a/Resources/Prototypes/Entities/Objects/Misc/pen.yml b/Resources/Prototypes/Entities/Objects/Misc/pen.yml index 0eede77db7..02923b3dd2 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/pen.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/pen.yml @@ -26,16 +26,6 @@ maxDistance: 2 - type: UseDelay delay: 1.5 - - type: EmbeddableProjectile - offset: 0.3,0.0 - removalTime: 0.0 - - type: ThrowingAngle - angle: 315 - - type: LandAtCursor - - type: DamageOtherOnHit - damage: - types: - Piercing: 1 - type: Fixtures fixtures: fix1: @@ -53,19 +43,25 @@ - type: entity parent: Pen - id: BasePenFancy + id: PenEmbeddable abstract: true components: + - type: EmbeddableProjectile + offset: 0.3,0.0 + removalTime: 0.0 + - type: ThrowingAngle + angle: 315 + - type: LandAtCursor - type: DamageOtherOnHit damage: types: - Piercing: 3 #nothing shows luxury like inflicting injury + Piercing: 3 #TODO: I want the luxury pen to write a cool font like Merriweather in the future. - type: entity name: luxury pen - parent: BasePenFancy + parent: Pen id: LuxuryPen description: A fancy and expensive pen that you only deserve to own if you're qualified to handle vast amounts of paperwork. components: @@ -76,7 +72,7 @@ - type: entity id: BaseAdvancedPen - parent: BasePenFancy + parent: PenEmbeddable abstract: true components: - type: Tag @@ -124,7 +120,7 @@ - type: entity name: captain's fountain pen - parent: BasePenFancy + parent: PenEmbeddable id: PenCap description: A luxurious fountain pen for the captain of the station. components: @@ -133,7 +129,7 @@ - type: entity name: hop's fountain pen - parent: BasePenFancy + parent: PenEmbeddable id: PenHop description: A luxurious fountain pen for the hop of the station. components: @@ -142,7 +138,7 @@ - type: entity name: wizard's magical pen - parent: [ BasePenFancy, BaseMagicalContraband ] + parent: [ PenEmbeddable, BaseMagicalContraband ] id: PenWiz description: A luxurious fountain pen. Seems to have a magical crystal eraser. components: diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/pen.yml b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/pen.yml index 86e79160bd..b387fd40b0 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/pen.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/pen.yml @@ -1,8 +1,6 @@ - type: entity - name: pen suffix: Exploding parent: Pen - description: A dark ink pen. id: PenExploding components: - type: TimerTrigger @@ -25,6 +23,18 @@ - Trigger - type: EmitSoundOnUse handle: false # don't want the sound to stop the explosion from triggering + - type: AddComponentsOnTrigger # make them embed into the target, but only when activated so that they can't be metagamed + components: # copied from PenEmbeddable + - type: EmbeddableProjectile + offset: 0.3,0.0 + removalTime: 0.0 + - type: ThrowingAngle + angle: 315 + - type: LandAtCursor + - type: DamageOtherOnHit + damage: + types: + Piercing: 3 - type: entity parent: [BaseItem, BaseSyndicateContraband] -- 2.51.2