]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
removing embedded projectiles puts them in your hand (#20475)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Sun, 24 Sep 2023 20:33:36 +0000 (21:33 +0100)
committerGitHub <noreply@github.com>
Sun, 24 Sep 2023 20:33:36 +0000 (16:33 -0400)
* tagless fields

* put embedded projectile in hand when picked up

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Content.Shared/Projectiles/EmbeddableProjectileComponent.cs
Content.Shared/Projectiles/SharedProjectileSystem.cs

index cde7e637d4a8a59fe652d6dc2a724d8771842115..008b7c2ced4d25b35a6a6cdcb6c81ab213ed561d 100644 (file)
@@ -13,37 +13,37 @@ public sealed partial class EmbeddableProjectileComponent : Component
     /// <summary>
     /// Minimum speed of the projectile to embed.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField("minimumSpeed"), AutoNetworkedField]
+    [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
     public float MinimumSpeed = 5f;
 
     /// <summary>
     /// Delete the entity on embedded removal?
     /// Does nothing if there's no RemovalTime.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField("deleteOnRemove"), AutoNetworkedField]
+    [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
     public bool DeleteOnRemove;
 
     /// <summary>
     /// How long it takes to remove the embedded object.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField("removalTime"), AutoNetworkedField]
+    [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
     public float? RemovalTime = 3f;
 
     /// <summary>
     ///     Whether this entity will embed when thrown, or only when shot as a projectile.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField("embedOnThrow"), AutoNetworkedField]
+    [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
     public bool EmbedOnThrow = true;
 
     /// <summary>
     /// How far into the entity should we offset (0 is wherever we collided).
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField("offset"), AutoNetworkedField]
+    [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
     public Vector2 Offset = Vector2.Zero;
 
     /// <summary>
     /// Sound to play after embedding into a hit target.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField("sound"), AutoNetworkedField]
+    [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
     public SoundSpecifier? Sound;
 }
index 6c5d7897c234c94947e5fb772fd76ee7d6441391..1df743bc0b1d2e6d6573b67e638c9c1573ead410 100644 (file)
@@ -1,6 +1,7 @@
 using System.Numerics;
 using Content.Shared.Damage;
 using Content.Shared.DoAfter;
+using Content.Shared.Hands.EntitySystems;
 using Content.Shared.Interaction;
 using Content.Shared.Projectiles;
 using Content.Shared.Sound.Components;
@@ -24,6 +25,7 @@ public abstract partial class SharedProjectileSystem : EntitySystem
     [Dependency] private readonly INetManager _netManager = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
     [Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
+    [Dependency] private readonly SharedHandsSystem _hands = default!;
     [Dependency] private readonly SharedPhysicsSystem _physics = default!;
     [Dependency] private readonly SharedTransformSystem _transform = default!;
 
@@ -85,6 +87,9 @@ public abstract partial class SharedProjectileSystem : EntitySystem
         var landEv = new LandEvent(args.User, true);
         RaiseLocalEvent(uid, ref landEv);
         _physics.WakeBody(uid, body: physics);
+
+        // try place it in the user's hand
+        _hands.TryPickupAnyHand(args.User, uid);
     }
 
     private void OnEmbedThrowDoHit(EntityUid uid, EmbeddableProjectileComponent component, ThrowDoHitEvent args)