This shows you the differences between two versions of the page.
component:crafting [2014/07/09 23:31] sangar |
component:crafting [2015/01/14 23:40] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | This component is provided by the [[crafting upgrade|Items#crafting-upgrade]] for robots. | ||
- | Component name: `crafting`. | ||
- | Callbacks: | ||
- | |||
- | - `craft([count: number]): boolean` | ||
- | Tries to craft something from the items in the top left 3x3 area of the robot's inventory. If `count` is specified will only craft up that number of items. If `count` is lower than the number of items created in one crafting operation, nothing will be crafted (e.g. trying to craft one stick). Up to one stack can be crafted at a time. The result of the crafting operation will be placed into the selected slot, the first free slot after it, or dropped if the robot's inventory is full. | ||
- | |||
- | Example use: | ||
- | ```lua | ||
- | local component = require("component") | ||
- | local c = component.crafting -- get primary crafting component | ||
- | c.craft(10) -- craft up to 10 items | ||
- | ``` | ||
- | |||
- | ---- | ||
- | |||
- | {{page>component:contents&noheader&noeditbutton&nouser&nofooter}} |