CleverRaven/Cataclysm-DDA — pull request #8229 by BevapDin (2014-07-13 15:06:29+00:00)
Title: Unified consumption system [WIP] [RC]

This moves the requirements (tools, quality, components) for constructions and recipes into a single class called `requirements`. I added the time there, too. Skills are still a separate for crafting and constructions, but that can be added.

This allows constructions to use the same input-requirements as crafting (one can use the same format, but only tools, quality, components are common, skills, book-learned, autolearn, etc. are still separate).

Both actions use the same common display functions the same function to check availability.

The last commit is especially important (the other are just moving code from one place to another). I've gone a bit crazy and used templates to check requirements. Templates are just so powerful.

It allows alternative tool quality specifications (e.g. require "3 tools with level 4 SAW quality" or "2 tools with level 1 HAMMER quality"). The nice effect is that there is one function that goes over the list of requirements and applies a requirement-specific function, instead of having one function that does that for components, one for tools and one for tool qualities. It also moves the actual checks into the requirement classes (e.g. `tool_comp` checks that the player has the tools with charges, `quality_requirement` checks that the player has tools with quality).

----

What about skills: currently constructions can only have one skill requirements.

TODO:

That system is going to be used nicely with vehicle interaction.