Differences

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

Link to this comparison view

component:navigation:zh [2023/11/26 14:04]
hfsr created
component:navigation:zh [2023/11/26 14:54] (current)
hfsr [Component: Navigation]
Line 1: Line 1:
-Component: Navigation+组件:导航
 =================== ===================
-This is the component provided by the [[item:​navigation_upgrade|Navigation Upgrade]].+此组件由[[item:​navigation_upgrade:zh|导航升级]]提供。
  
-Component name: `navigation`  +组件名:`navigation`。 
-Callbacks:+   
 +回调函数:
  
 - `getPosition():​ number, number, number or nil, string`  ​ - `getPosition():​ number, number, number or nil, string`  ​
-  ​Gets the current relative position of the robot. This is the position relative to the center of the map item that was used to craft the upgrade. Note that the upgrade can be re-crafted with another map to change it's point of reference. Returns ​`nil` and the string ​`out of range` ​if the robot is too far away from the point of reference (i.e. when it is out of bounds of the map that was used to craft the upgrade).+  ​获取机器人当前的相对坐标,此坐标相对于合成升级时使用地图的中心点。请注意此升级可以与另一张地图一起重新合成,这样可以改变其参考原点。若机器人离开参考点太远(即超出用于合成升级的地图范围)则会返回`nil`与字符串`out of range`。   
 +\\
 - `getFacing():​ number`  ​ - `getFacing():​ number`  ​
-  ​Gets the current facing of the robot, as one of the `sides` ​constants.+  ​获取机器人的当前朝向,取值为`sides`常量的其中之一。 ​  
 +\\
 - `getRange():​ number`  ​ - `getRange():​ number`  ​
-  ​Gets the effective range of the upgrade. If the absolute value of the relative ​or coordinate becomes larger than this, `getPosition()` ​will fail. +  ​获取升级的作用范围。若机器人相对原点的XZ偏移量绝对值大于此结果,`getPosition()`函数将会执行失败。 ​  
-- `findWaypoints(range:​ number): table` ​ __//**Note:** Requires version ​1.5.9 of OpenComputers.//__+\\ 
 +- `findWaypoints(range:​ number): table`  ​ 
 +__//**注意:**需要1.5.9以上版本的OpenComputers//__
  
-  ​Finds all [[block:​waypoint|waypoint blocks]] within the specified range. ​   +  ​查找指定范围内的所有[[block:​waypoint:zh|路径点方块]]。此函数的返回值为内含第二层表的表。外层表为检测到的所有信标的编号索引。外层表的每个条目均为一个内层表,其中的每行都是对应信标的一个参数:"​position"​"​redstone"​"​label"​。  ​
-This returns a table that contains other tables. The top table has only numbered indices corresponding to each detected beacon. In each of this entries is another table, each row various aspects of the specified beacon: ​"​position"​"​redstone"​"​label"​.+
  
-  * position ​returns a table with numbered indices in which is xis y, and is z. These numbers are the distance from the navigation component to the beacon in terms of block coordinates. +  * `position`(位置)参数为一个数字索引的表,其中1x2y3z。这些数字代表了导航组件到对应信标的相对距离,形式为方块坐标。 
-  * redstone ​returns a single number that is the current strength of the redstone signal +  * `redstone`(红石)参数为单个数字。代表当前输入路径点方块的红石信号强度。 
-  * label returns a string that is the label of the beacon you can set by right clicking on it.   +  * `label`(标签)参数为一个字符串。代表了信标的标签。你可以右键单击信标以修改。  ​
   ​   ​
-Below is an example of how the tables are set up. A single beacon'​s results are shown. +下面是上文所述表的格式样例,其中展示了一个信标的结果。 
-^table: main  ||| | +^table: main ||| | 
-^table: 1  ^ table: position ​   ^ 1: | number: x distance +^table: 1  ^ table: position ​   ^ 1: | number: x轴距离
-|:::  |::: ​ ^ 2: | number: y distance +|:::  |::: ​ ^ 2: | number: y轴距离
-|:::​ |:::​ ^ 3: | number: z distance +|:::​ |:::​ ^ 3: | number: z轴距离
-|::: ^ redstone || number: ​redstone strength || +|::: ^ redstone || number: ​红石信号强度 || 
-|::: ^ label || string: ​beacon label ||+|::: ^ label || string: ​信标标签 ||