Mister_Nebula ccde13fc68 cleanup
2021-03-26 21:03:55 +00:00

28 lines
805 B
C#

using OWML.Utils;
using QSB.WorldSync;
namespace QSB.ItemSync.WorldObjects
{
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.GetValue<ItemType>("_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());
}
}