public void RightClick() { Item other = cursor.ReadItem(); Item item = PlayerInventory.Read(Index); if (other == null && item == null) { return; } if (other == null && item != null) { int amount = Mathf.FloorToInt(PlayerInventory.Read(Index).StackSize * 0.5f); if (amount == 0) { cursor.PutItem(PlayerInventory.Remove(Index)); } else { cursor.PutItem(PlayerInventory.Take(amount, Index)); } return; } if (PlayerInventory.Accepts(other, Index) > 0) { PlayerInventory.PutItem(cursor.Take(1), Index); return; } }
public override bool Transfer(IInventory to, Item item, int amount = 1, bool isReal = true, bool isVirtual = true) { if (!offeredItems.Contains(item)) { return(false); } if (!to.Accepts(item)) { return(false); } return(base.Transfer(to, item, amount, isReal, isVirtual)); }