]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Hotfix: Not all pens embed, exploding pens embed when activated (#41105)
authorslarticodefast <161409025+slarticodefast@users.noreply.github.com>
Sun, 26 Oct 2025 00:37:41 +0000 (02:37 +0200)
committerGitHub <noreply@github.com>
Sun, 26 Oct 2025 00:37:41 +0000 (17:37 -0700)
* Revert "All pens embed (#39104)"

This reverts commit 3c1982a85fedb8a38a7bcf51ea05a22b1eea5a99.

* only activated pens embed

* fix disembedding during prediction

Content.Shared/Projectiles/SharedProjectileSystem.cs
Resources/Changelog/Changelog.yml
Resources/Prototypes/Entities/Objects/Misc/pen.yml
Resources/Prototypes/Entities/Objects/Weapons/Bombs/pen.yml

index 20d1e051a2995e6e3269b13e075198558083976f..f99950c8f1c09efad289939bd76749a5b46967a7 100644 (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;
         }
 
index ce9e21315f2f59094fee590644522bc43f107d2a..bd99b299c423ae3aead3ec2ee0cc249c7fc3a793 100644 (file)
   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
index 0eede77db740318863a8ee866e89f68e520082d3..02923b3dd2e4e10a11c5e1c34d80bf4f3687c2f6 100644 (file)
         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:
 
 - 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
 
 - 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:
 
 - 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:
 
 - 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:
index 86e79160bda9c5b108256d5399ade2189c5e1bf3..b387fd40b03b3cdf75791bc6e7f3942fa38d5c02 100644 (file)
@@ -1,8 +1,6 @@
 - type: entity
-  name: pen
   suffix: Exploding
   parent: Pen
-  description: A dark ink pen.
   id: PenExploding
   components:
   - type: TimerTrigger
     - 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]