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

View File

@@ -3721,13 +3721,6 @@
id: 9121 id: 9121
time: '2025-10-18T17:58:32.0000000+00:00' time: '2025-10-18T17:58:32.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/38871 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 - author: JackRyd3r
changes: changes:
- message: You can now put the Energy Magnum to into jackboots/combat boots and - message: You can now put the Energy Magnum to into jackboots/combat boots and

View File

@@ -26,16 +26,6 @@
maxDistance: 2 maxDistance: 2
- type: UseDelay - type: UseDelay
delay: 1.5 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 - type: Fixtures
fixtures: fixtures:
fix1: fix1:
@@ -53,19 +43,25 @@
- type: entity - type: entity
parent: Pen parent: Pen
id: BasePenFancy id: PenEmbeddable
abstract: true abstract: true
components: components:
- type: EmbeddableProjectile
offset: 0.3,0.0
removalTime: 0.0
- type: ThrowingAngle
angle: 315
- type: LandAtCursor
- type: DamageOtherOnHit - type: DamageOtherOnHit
damage: damage:
types: 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. #TODO: I want the luxury pen to write a cool font like Merriweather in the future.
- type: entity - type: entity
name: luxury pen name: luxury pen
parent: BasePenFancy parent: Pen
id: LuxuryPen id: LuxuryPen
description: A fancy and expensive pen that you only deserve to own if you're qualified to handle vast amounts of paperwork. description: A fancy and expensive pen that you only deserve to own if you're qualified to handle vast amounts of paperwork.
components: components:
@@ -76,7 +72,7 @@
- type: entity - type: entity
id: BaseAdvancedPen id: BaseAdvancedPen
parent: BasePenFancy parent: PenEmbeddable
abstract: true abstract: true
components: components:
- type: Tag - type: Tag
@@ -124,7 +120,7 @@
- type: entity - type: entity
name: captain's fountain pen name: captain's fountain pen
parent: BasePenFancy parent: PenEmbeddable
id: PenCap id: PenCap
description: A luxurious fountain pen for the captain of the station. description: A luxurious fountain pen for the captain of the station.
components: components:
@@ -133,7 +129,7 @@
- type: entity - type: entity
name: hop's fountain pen name: hop's fountain pen
parent: BasePenFancy parent: PenEmbeddable
id: PenHop id: PenHop
description: A luxurious fountain pen for the hop of the station. description: A luxurious fountain pen for the hop of the station.
components: components:
@@ -142,7 +138,7 @@
- type: entity - type: entity
name: wizard's magical pen name: wizard's magical pen
parent: [ BasePenFancy, BaseMagicalContraband ] parent: [ PenEmbeddable, BaseMagicalContraband ]
id: PenWiz id: PenWiz
description: A luxurious fountain pen. Seems to have a magical crystal eraser. description: A luxurious fountain pen. Seems to have a magical crystal eraser.
components: components:

View File

@@ -1,8 +1,6 @@
- type: entity - type: entity
name: pen
suffix: Exploding suffix: Exploding
parent: Pen parent: Pen
description: A dark ink pen.
id: PenExploding id: PenExploding
components: components:
- type: TimerTrigger - type: TimerTrigger
@@ -25,6 +23,18 @@
- Trigger - Trigger
- type: EmitSoundOnUse - type: EmitSoundOnUse
handle: false # don't want the sound to stop the explosion from triggering 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 - type: entity
parent: [BaseItem, BaseSyndicateContraband] parent: [BaseItem, BaseSyndicateContraband]