Refactor the way containers track their contents in memory.

This prepares data structures for adding parts stored with their
individual state, and also makes sure that resource mass is counted
in the total mass of the container.
Implement storing the full state of some parts within containers.

Parts that contain resources or have irreversible state transitions
like breaking cannot be stored into the container by just incrementing
a counter, because that introduces a way to cheat. This implements
an option to store the complete state for some part types.

Full backwards compatibility is provided by representing current
stock for each part type with a pristine counter plus a list of fully
specified second-hand instances, and ensuring that the brand-new part
counts are stored in exactly same way as before.

Since the UI does not provide any way to distinguish parts of the same
type, a somewhat cumbersome but workable way to select a specific item
is provided by ensuring that Store and Take work in a FIFO order.
Enable stateful mode for storable stock parts with resources.