using System.Numerics;
using Content.Shared.Hands.Components;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
namespace Content.Shared.Hands
{
///
/// Raised directed on an entity when attempting to drop its hand items.
///
public sealed class DropAttemptEvent : CancellableEntityEventArgs
{
public readonly EntityUid Uid;
}
///
/// Raised directed at an item that needs to update its in-hand sprites/layers.
///
public sealed class GetInhandVisualsEvent : EntityEventArgs
{
///
/// Entity that owns the hand holding the item.
///
public readonly EntityUid User;
public readonly HandLocation Location;
///
/// The layers that will be added to the entity that is holding this item.
///
///
/// Note that the actual ordering of the layers depends on the order in which they are added to this list;
///
public List<(string, PrototypeLayerData)> Layers = new();
public GetInhandVisualsEvent(EntityUid user, HandLocation location)
{
User = user;
Location = location;
}
}
///
/// Raised directed at an item after its visuals have been updated.
///
///
/// Useful for systems/components that modify the visual layers that an item adds to a player. (e.g. RGB memes)
///
public sealed class HeldVisualsUpdatedEvent : EntityEventArgs
{
///
/// Entity that is holding the item.
///
public readonly EntityUid User;
///
/// The layers that this item is now revealing.
///
public HashSet RevealedLayers;
public HeldVisualsUpdatedEvent(EntityUid user, HashSet revealedLayers)
{
User = user;
RevealedLayers = revealedLayers;
}
}
///
/// Raised when an entity item in a hand is deselected.
///
[PublicAPI]
public sealed class HandDeselectedEvent : HandledEntityEventArgs
{
///
/// Entity that owns the deselected hand.
///
public EntityUid User { get; }
public HandDeselectedEvent(EntityUid user)
{
User = user;
}
}
///
/// Raised when an item entity held by a hand is selected.
///
[PublicAPI]
public sealed class HandSelectedEvent : HandledEntityEventArgs
{
///
/// Entity that owns the selected hand.
///
public EntityUid User { get; }
public HandSelectedEvent(EntityUid user)
{
User = user;
}
}
[Serializable, NetSerializable]
public sealed class RequestSetHandEvent : EntityEventArgs
{
///
/// The hand to be swapped to.
///
public string HandName { get; }
public RequestSetHandEvent(string handName)
{
HandName = handName;
}
}
[Serializable, NetSerializable]
public sealed class PickupAnimationEvent : EntityEventArgs
{
public EntityUid ItemUid { get; }
public EntityCoordinates InitialPosition { get; }
public Vector2 FinalPosition { get; }
public Angle InitialAngle { get; }
public PickupAnimationEvent(EntityUid itemUid, EntityCoordinates initialPosition,
Vector2 finalPosition, Angle initialAngle)
{
ItemUid = itemUid;
FinalPosition = finalPosition;
InitialPosition = initialPosition;
InitialAngle = initialAngle;
}
}
///
/// Raised directed on both the blocking entity and user when
/// a virtual hand item is deleted.
///
public sealed class VirtualItemDeletedEvent : EntityEventArgs
{
public EntityUid BlockingEntity;
public EntityUid User;
public VirtualItemDeletedEvent(EntityUid blockingEntity, EntityUid user)
{
BlockingEntity = blockingEntity;
User = user;
}
}
///
/// Raised when putting an entity into a hand slot
///
[PublicAPI]
public abstract class EquippedHandEvent : HandledEntityEventArgs
{
///
/// Entity that equipped the item.
///
public EntityUid User { get; }
///
/// Item that was equipped.
///
public EntityUid Equipped { get; }
///
/// Hand that the item was placed into.
///
public Hand Hand { get; }
public EquippedHandEvent(EntityUid user, EntityUid equipped, Hand hand)
{
User = user;
Equipped = equipped;
Hand = hand;
}
}
///
/// Raised when removing an entity from an inventory slot.
///
[PublicAPI]
public abstract class UnequippedHandEvent : HandledEntityEventArgs
{
///
/// Entity that equipped the item.
///
public EntityUid User { get; }
///
/// Item that was unequipped.
///
public EntityUid Unequipped { get; }
///
/// Hand that the item is removed from.
///
public Hand Hand { get; }
public UnequippedHandEvent(EntityUid user, EntityUid unequipped, Hand hand)
{
User = user;
Unequipped = unequipped;
Hand = hand;
}
}
public sealed class GotEquippedHandEvent : EquippedHandEvent
{
public GotEquippedHandEvent(EntityUid user, EntityUid unequipped, Hand hand) : base(user, unequipped, hand) { }
}
public sealed class GotUnequippedHandEvent : UnequippedHandEvent
{
public GotUnequippedHandEvent(EntityUid user, EntityUid unequipped, Hand hand) : base(user, unequipped, hand) { }
}
public sealed class DidEquipHandEvent : EquippedHandEvent
{
public DidEquipHandEvent(EntityUid user, EntityUid unequipped, Hand hand) : base(user, unequipped, hand) { }
}
public sealed class DidUnequipHandEvent : UnequippedHandEvent
{
public DidUnequipHandEvent(EntityUid user, EntityUid unequipped, Hand hand) : base(user, unequipped, hand) { }
}
///
/// Event raised by a client when they want to use the item currently held in their hands.
///
[Serializable, NetSerializable]
public sealed class RequestUseInHandEvent : EntityEventArgs
{
}
///
/// Event raised by a client when they want to activate the item currently in their hands.
///
[Serializable, NetSerializable]
public sealed class RequestActivateInHandEvent : EntityEventArgs
{
public string HandName { get; }
public RequestActivateInHandEvent(string handName)
{
HandName = handName;
}
}
///
/// Event raised by a client when they want to use the currently held item on some other held item
///
[Serializable, NetSerializable]
public sealed class RequestHandInteractUsingEvent : EntityEventArgs
{
public string HandName { get; }
public RequestHandInteractUsingEvent(string handName)
{
HandName = handName;
}
}
///
/// Event raised by a client when they want to move an item held in another hand to their currently active hand
///
[Serializable, NetSerializable]
public sealed class RequestMoveHandItemEvent : EntityEventArgs
{
public string HandName { get; }
public RequestMoveHandItemEvent(string handName)
{
HandName = handName;
}
}
///
/// Event raised by a client when they want to alt interact with the item currently in their hands.
///
[Serializable, NetSerializable]
public sealed class RequestHandAltInteractEvent : EntityEventArgs
{
public string HandName { get; }
public RequestHandAltInteractEvent(string handName)
{
HandName = handName;
}
}
public sealed class HandCountChangedEvent : EntityEventArgs
{
public HandCountChangedEvent(EntityUid sender)
{
Sender = sender;
}
public EntityUid Sender { get; }
}
}