| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System.Numerics;
- using Robust.Shared.GameStates;
- using Robust.Shared.Physics.Components;
- using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
- namespace Content.Shared.Weapons.Melee.Components;
- /// <summary>
- /// This is used for a melee weapon that throws whatever gets hit by it in a line
- /// until it hits a wall or a time limit is exhausted.
- /// </summary>
- [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
- [Access(typeof(MeleeThrowOnHitSystem))]
- public sealed partial class MeleeThrowOnHitComponent : Component
- {
- /// <summary>
- /// The speed at which hit entities should be thrown.
- /// </summary>
- [DataField, AutoNetworkedField]
- public float Speed = 10f;
- /// <summary>
- /// The maximum distance the hit entity should be thrown.
- /// </summary>
- [DataField, AutoNetworkedField]
- public float Distance = 20f;
- /// <summary>
- /// Whether or not anchorable entities should be unanchored when hit.
- /// </summary>
- [DataField, AutoNetworkedField]
- public bool UnanchorOnHit;
- /// <summary>
- /// How long should this stun the target, if applicable?
- /// </summary>
- [DataField, AutoNetworkedField]
- public TimeSpan? StunTime;
- /// <summary>
- /// Should this also work on a throw-hit?
- /// </summary>
- [DataField, AutoNetworkedField]
- public bool ActivateOnThrown;
- }
- /// <summary>
- /// Raised a weapon entity with <see cref="MeleeThrowOnHitComponent"/> to see if a throw is allowed.
- /// </summary>
- [ByRefEvent]
- public record struct AttemptMeleeThrowOnHitEvent(EntityUid Target, EntityUid? User, bool Cancelled = false, bool Handled = false);
- /// <summary>
- /// Raised a target entity before it is thrown by <see cref="MeleeThrowOnHitComponent"/>.
- /// </summary>
- [ByRefEvent]
- public record struct MeleeThrowOnHitStartEvent(EntityUid Weapon, EntityUid? User);
|