CleverRaven/Cataclysm-DDA — pull request #6580 by BevapDin (2014-03-12 16:06:35+00:00)
Title: Implements Component Tracking.

> [from #4334]
> Part 2: Component Tracking
> Crafted items should track which items were included in their construction, and this should overwrite the default disassembly rules. This will also require recipes to distinguish between items that are "components" and items that are "consumed", which it currently does not.

The used items are added as a separate item vector. They are used when disassembling. If the recovered item is not in the components list, the default item is used (e.g. when disassembling a generated (not crafted by the player) item).

The flag `UNRECOVERABLE` (already functional) handles the other thing.

This should also work recursively: craft X from Y, craft A from X, uncraft A (gives X), uncraft that X gives Y.

A spawned go bag will disassemble into a flashlight with charges, and a lighter with charges. A go bag crafted from a lighter with 50 charges will disassemble into a lighter with 50 charges.

Resulting items (that you get from disassembling a spawned item) are always create with their default charges.

------

What is the purpose of the `use_container` parameter to the various `use_amount` functions? I can read the source and understand how it works, but *why* is it there in the first place? Why would you ever want to destroy the container with the content?

Why can I use the batteries (or any ammo actually) out of tools directly? This leads to this bug #3161. It does not even check for the NOUNLOAD flag.

Another thing: itype has a count_by_charges function. So has item. But they differ. Why? Shouldn't that be consistent?