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;
{
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!;
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;
}
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:
- 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:
- 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]