quantum-space-buddies/QSB/ItemSync/WorldObjects/Sockets/QSBOWItemSocket.cs
Mister_Nebula 266b6147fc aaaaa
2021-11-01 15:49:00 +00:00

28 lines
812 B
C#

using QSB.ItemSync.WorldObjects.Items;
using QSB.WorldSync;
namespace QSB.ItemSync.WorldObjects.Sockets
{
internal class QSBOWItemSocket<T> : WorldObject<T>, IQSBOWItemSocket
where T : OWItemSocket
{
public override void Init(T attachedObject, int id) { }
public virtual bool AcceptsItem(IQSBOWItem item)
{
var itemType = item.GetItemType();
var acceptableType = AttachedObject._acceptableType;
return (itemType & acceptableType) == itemType;
}
public virtual bool IsSocketOccupied()
=> AttachedObject.IsSocketOccupied();
public virtual bool PlaceIntoSocket(IQSBOWItem item)
=> AttachedObject.PlaceIntoSocket((OWItem)(item as IWorldObject).ReturnObject());
public virtual IQSBOWItem RemoveFromSocket()
=> ItemManager.GetObject(AttachedObject.RemoveFromSocket());
}
}