Currently we support two crafting systems: the tinker recipe system used for Tinkers and the UAS Armor Forge, and the Item Components system introduced in API 29
The new Item Components system allows more flexibility in specifying the required items (e.g. the component list can be randomized so different items are required in each play through). However, the older recipe system currently has more features for controling the price and applying enhancements etc. to the crafted item.
Current Use
As of 1.8a2 (API 37) the systems are available:
- Tinkers supports both recipes (stored in the
<Recipes>GlobalData on thesvTinkerssovereign) and components (for any items with thetinkersattribute) - UAS Armor Forge recipes (stored in the
<Recipes>GlobalData on theunidUASArmorForgetype) - Mechanist Foundry components (for any items with the
erebienFoundryattribute)
Components
The components needed to craft an item are defined in the XML. For example:
<ItemType unid="&itNanoforgedTitaniumArmor;"
...
/>
<Components>
<Item count="6" item="&itTitaniumOre;"/>
</Components>
</ItemType>
NOTE: It is perfectly valid to have the component list be randomized. In that case, the engine determines the actual list of components at the beginning of the game and keeps it consistent throughout.
Crafting Cost
The cost to craft from components depends on the total cost of all the components (if the component is a device we assue a damaged device):
- When crafting armor, the work price is 25% of the component cost
- When crafting a device, the work price is 50% of the component cost
- Otherwise, the work price is 20% of the component cost
Recipes
Crafting recipes are specified with a struct using the following supported elements:
itemitem to craftcountnumber of items in batch (for ammo etc)enhancementenhancements to apply to the itemcomponentslist of items required to craft the itemmarkUpmarkup relative to component price either as an integers (interpreted as a percentage e.g. 10 = 10%) or as a double (such that 0.1 = 10%)extraCostconstant price added to work pricetotalCostspecifies a total price (markUpandextraCostignored)
Crafting Cost
- If a
totalCostis specified in the recipe we use that value and skip all other cost calculations - If
markUpis specified then crafting cost is:markUp * componentPrice + extraCost - Otherwise crafting cost is:
itemCost - componentPrice + extraCost
Also see: Tinker updates
This is awesome! Thank you.