removing embedded projectiles puts them in your hand (#20475)
* tagless fields * put embedded projectile in hand when picked up --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -13,37 +13,37 @@ public sealed partial class EmbeddableProjectileComponent : Component
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Minimum speed of the projectile to embed.
|
/// Minimum speed of the projectile to embed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("minimumSpeed"), AutoNetworkedField]
|
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||||
public float MinimumSpeed = 5f;
|
public float MinimumSpeed = 5f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete the entity on embedded removal?
|
/// Delete the entity on embedded removal?
|
||||||
/// Does nothing if there's no RemovalTime.
|
/// Does nothing if there's no RemovalTime.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("deleteOnRemove"), AutoNetworkedField]
|
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||||
public bool DeleteOnRemove;
|
public bool DeleteOnRemove;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How long it takes to remove the embedded object.
|
/// How long it takes to remove the embedded object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("removalTime"), AutoNetworkedField]
|
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||||
public float? RemovalTime = 3f;
|
public float? RemovalTime = 3f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this entity will embed when thrown, or only when shot as a projectile.
|
/// Whether this entity will embed when thrown, or only when shot as a projectile.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("embedOnThrow"), AutoNetworkedField]
|
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||||
public bool EmbedOnThrow = true;
|
public bool EmbedOnThrow = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How far into the entity should we offset (0 is wherever we collided).
|
/// How far into the entity should we offset (0 is wherever we collided).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("offset"), AutoNetworkedField]
|
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||||
public Vector2 Offset = Vector2.Zero;
|
public Vector2 Offset = Vector2.Zero;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sound to play after embedding into a hit target.
|
/// Sound to play after embedding into a hit target.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("sound"), AutoNetworkedField]
|
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||||
public SoundSpecifier? Sound;
|
public SoundSpecifier? Sound;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
|
using Content.Shared.Hands.EntitySystems;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Projectiles;
|
using Content.Shared.Projectiles;
|
||||||
using Content.Shared.Sound.Components;
|
using Content.Shared.Sound.Components;
|
||||||
@@ -24,6 +25,7 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
|||||||
[Dependency] private readonly INetManager _netManager = default!;
|
[Dependency] private readonly INetManager _netManager = 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 SharedPhysicsSystem _physics = default!;
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
|
|
||||||
@@ -85,6 +87,9 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
|||||||
var landEv = new LandEvent(args.User, true);
|
var landEv = new LandEvent(args.User, true);
|
||||||
RaiseLocalEvent(uid, ref landEv);
|
RaiseLocalEvent(uid, ref landEv);
|
||||||
_physics.WakeBody(uid, body: physics);
|
_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)
|
private void OnEmbedThrowDoHit(EntityUid uid, EmbeddableProjectileComponent component, ThrowDoHitEvent args)
|
||||||
|
|||||||
Reference in New Issue
Block a user