2021-02-27 04:12:09 +01:00
|
|
|
using System;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Hands;
|
2020-07-06 14:27:03 -07:00
|
|
|
using JetBrains.Annotations;
|
2021-01-23 22:45:23 +01:00
|
|
|
using Robust.Shared.Analyzers;
|
2020-07-06 14:27:03 -07:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Inventory
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
2020-12-13 14:28:20 -08:00
|
|
|
/// This interface gives components behavior when their entity is put in a non-hand inventory slot,
|
|
|
|
|
/// regardless of where it came from. This includes moving the entity from a hand slot into a non-hand slot
|
|
|
|
|
/// (which would also fire <see cref="IUnequippedHand"/>).
|
|
|
|
|
///
|
|
|
|
|
/// This DOES NOT fire when putting the entity into a hand slot (<see cref="IEquippedHand"/>), nor
|
|
|
|
|
/// does it fire when putting the entity into held/equipped storage.
|
2020-07-06 14:27:03 -07:00
|
|
|
/// </summary>
|
2021-01-23 20:00:29 +01:00
|
|
|
[RequiresExplicitImplementation]
|
2020-07-06 14:27:03 -07:00
|
|
|
public interface IEquipped
|
|
|
|
|
{
|
2021-04-29 03:23:15 +10:00
|
|
|
[Obsolete("Use EquippedMessage instead")]
|
2020-07-06 14:27:03 -07:00
|
|
|
void Equipped(EquippedEventArgs eventArgs);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-13 14:28:20 -08:00
|
|
|
public abstract class UserEventArgs : EventArgs
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
2020-12-13 14:28:20 -08:00
|
|
|
public IEntity User { get; }
|
|
|
|
|
|
|
|
|
|
protected UserEventArgs(IEntity user)
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
User = user;
|
2020-12-13 14:28:20 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class EquippedEventArgs : UserEventArgs
|
|
|
|
|
{
|
|
|
|
|
public EquippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot) : base(user)
|
|
|
|
|
{
|
2020-07-06 14:27:03 -07:00
|
|
|
Slot = slot;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public EquipmentSlotDefines.Slots Slot { get; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2021-05-22 21:06:40 -07:00
|
|
|
/// Raised when equipping an entity in an inventory slot.
|
2020-07-06 14:27:03 -07:00
|
|
|
/// </summary>
|
|
|
|
|
[PublicAPI]
|
2021-05-22 21:06:40 -07:00
|
|
|
public class EquippedEvent : HandledEntityEventArgs
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Entity that equipped the item.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IEntity User { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Item that was equipped.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IEntity Equipped { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2021-05-22 21:06:40 -07:00
|
|
|
/// Slot that the item was placed into.
|
2020-07-06 14:27:03 -07:00
|
|
|
/// </summary>
|
|
|
|
|
public EquipmentSlotDefines.Slots Slot { get; }
|
|
|
|
|
|
2021-05-22 21:06:40 -07:00
|
|
|
public EquippedEvent(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot)
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
User = user;
|
|
|
|
|
Equipped = equipped;
|
|
|
|
|
Slot = slot;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|