Refined Storage

Refined Storage

77M Downloads

Feature Request | Add support for Disk Drive storage/capacity to OC integration

zangai opened this issue ยท 7 comments

commented

Feature request for OC Integration:

Add the capability to read a connected disk drive's total storage usage and capacity.
Having the ability to get a list of each harddisk and its usage/capacity would be a plus.

I could create this, but I'd like to know if you'd accept a pull request on this, otherwise i'd make it as an separate mod implementing the driver.

commented

Yes, I'd accept a pull request for this. Also make sure it supports storage blocks, then.

commented

Would anyone like to weigh in to what the interface for this would be? I'm currently thinking of adding a getStorageCapacity() for the whole lot (any storage disk or block attached to the network), getFluidStorageCapacity for fluids, and getItemStorageCapacity for just the item storage.

Might be a bit too much, could also consider getStorageCapacity(bool:includeItems, bool:includeFluids)

commented

getStorageCapacity(bool:includeItems, bool:includeFluids) sounds like a bad idea, since if an object can store both fluids and items then we get a nonsensical value. If no blocks exist that can store both I'd suggest going with a single function getStorageCapacity(void). Otherwise I would go with the separate approach.

commented

@MauriceH1 I can see where you're coming from, but there is actually no block or item that can store both items and fluids. The most simple way of getting the currently available capacity is by querying the StorageCacheItem object that is defined in the current node's network (TileController).

The basic idea was to return a table with the response structured something like this in JSON:

{
  "total": {
    "usage": 74,
    "capacity": 16000
  },
  "devices" {
    "0001-0001": { "usage": 64, "capacity": 4000 },
    "0002-0002": { "usage": 8, "capacity": 4000 },
    "0003-0003": { "usage": 2, "capacity": 4000 },
    "0004-0004": { "usage": 0, "capacity": 4000 }
  }
}

However, even though a block/item can't store both items and fluids, you might be right that adding them together might give a nonsensical value, since fluids are expressed in mB (micro buckets) and one bucket already amounts to 1000 mB. That would completely disturb the usability of the total value.

I am leaning towards the separate calls approach, but I would like some input from @raoulvdberge first since he owns most of the mod.

commented

@zangai Your approach sounds ok, but I would change the table to be this:

{
  "total": {
    "item:" {"usage": 74, "capacity": 16000},
    "fluid": {"usage": 0, capacity: 0}
  },
  "devices" {
    "0001-0001": { "type": "fluid", "usage": 64, "capacity": 4000 },
    "0002-0002": { "type": "item", "usage": 8, "capacity": 4000 },
    "0003-0003": { "type": "fluid", "usage": 2, "capacity": 4000 },
    "0004-0004": { "type": "item", "usage": 0, "capacity": 4000 }
  }
}
commented

Look in the storage disk manager class (API.instance().getStorageDiskManager(world)). You may have to edit it a bit.

commented

@raoulvdberge Thanks for your contribution/thoughts. I've resumed work on this, and I see you've implemented unique Id's for StorageDisks in the new code. What would the preferred/most performant way of accessing this UUID be?