Some things looks strange to me with the store refactoring, is that intentional:
-
Using
getCapacitywith a not valid resource returnsnull, while usinggetUsedCapacitywith the same resource returns0.extension.store.getCapacity("power") // => null extension.store.getUsedCapacity("power") // => 0It seems inconsistent to me, maybe it should be aligned on one or the other behavior (I personally think returning
0in both cases makes more sense, but the spec/doc seems to expectnullin both cases). -
Using
getCapacityon tombstones returnsnull(I guess it is the same for ruins).
I think there is actually no limit, so returningNumber.MAX_SAFE_INTEGERorInfinitywould make more sense and be more useful.
For example, having this behavior looks inconsistent to me:tombstone.store.getUsedCapacity("energy") // => 500 tombstone.store.getCapacity("energy") // => null (even though there is actually some energy in the tombstone...)Note that mostly, the issue is that when getting
null, we don't know if the store does not accept this resource at all, or if the limit is actually infinity. So if my first point is taken into account so thatgetCapacityreturns0when the store does not accept the resource, then it would be kind of ok to keepnullfor infinity...