Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
component:crafting:zh [2023/11/03 18:39]
hfsr created
component:crafting:zh [2023/11/03 20:10]
hfsr [Example]
Line 1: Line 1:
-Component: Crafting+组件:合成
 ================= =================
-This component allows a robot to craft items and is provided by the [[item:​crafting_upgrade|crafting upgrade]]. The component can be accessed via `component.crafting`.+此组件由[[item:​crafting_upgrade:zh|合成升级]]提供,让机器人得以合成物品。此组件可通过`component.crafting`访问。
  
-When activated the robot considers the top-left area the crafting area and will attempt to craft any layed-out crafting recipe in that area. The requirements for a successful crafting attempt are exactly the same as if you would attempt to craft the item in a crafting table.+当组件启用时,机器人会将物品栏的左上角当作合成区域,并尝试在此区域中通过摆放的材料合成物品。若要成功合成,材料的摆放需要与使用合成台合成时完全一致。
  
 {{component:​crafting_area.png|Crafting area}}\\ {{component:​crafting_area.png|Crafting area}}\\
-//(free slots are the crafting area)// +//(图中的空余槽位即为合成区域)//
- +
-It is recommended (but not required) to use this upgrade in combination with an [[item:​inventory_controller_upgrade|Inventory Controller Upgrade]]. It allows to read the names and types of items and therefore makes it a lot easier to find the required crafting resources.+
  
 +推荐(但不必须)将此升级与[[item:​inventory_controller_upgrade:​zh|物品栏控制器升级]]配合使用。这样做可以读取物品的名称和类型,以便于找到所需的合成资源。
 ===== Functions ===== ===== Functions =====
-==== craft([count:​ number]): boolean ​====+`craft([count:​ number]): boolean`
 Crafts up to count numbers or a full stack. Crafts up to count numbers or a full stack.
  
Line 21: Line 20:
 If successful the crafting result will be placed in the currently selected slot, or (if occupied by something else) will be placed into the next slot containing similar items or in the next free slot. This can be one of the slots of the crafting area, which would make it impossible to craft the same item again until that area is cleared. If successful the crafting result will be placed in the currently selected slot, or (if occupied by something else) will be placed into the next slot containing similar items or in the next free slot. This can be one of the slots of the crafting area, which would make it impossible to craft the same item again until that area is cleared.
  
-==== Example ​====+====样例====
 ```lua ```lua
 local component = require("​component"​) local component = require("​component"​)
-local c = component.crafting -- get primary crafting component +local c = component.crafting --获取首选合成组件 
-c.craft(10) -- craft up to 10 items+c.craft(10) --合成至多10个物品
 ``` ```