Navigation Upgrade: Difference between revisions

From OpenComputers: Rebooted
Jump to navigation Jump to search
imported>OCDoc Import
Imported from legacy OpenComputers documentation at ocdoc.cil.li
 
Unify item and component API pages
Line 2: Line 2:


[[File:navigation_upgrade.png|128px]]
[[File:navigation_upgrade.png|128px]]
'''Provides''': [[Component/navigation|navigation]] component.


Allows the robot to tell its current position and facing. The position is relative to the center of the map that was used to craft the upgrade. The range in which the upgrade works depends on the size of the map that was used to craft the upgrade. The upgrade can be crafted together with another map to re-configure it and get the old map back.
Allows the robot to tell its current position and facing. The position is relative to the center of the map that was used to craft the upgrade. The range in which the upgrade works depends on the size of the map that was used to craft the upgrade. The upgrade can be crafted together with another map to re-configure it and get the old map back.
Line 17: Line 15:
[[File:navigation.png|200px]]
[[File:navigation.png|200px]]


== Contents ==
= Component API =
Component name: <code>navigation</code>. Callbacks:
{{APICallback|name=getPosition|signature=(): number, number, number or nil, string|description=
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).
}}
{{APICallback|name=getFacing|signature=(): number|description=
Gets the current facing of the robot, as one of the sides constants.
}}
{{APICallback|name=getRange|signature=(): number|description=
Gets the effective range of the upgrade. If the absolute value of the relative X or Z coordinate becomes larger than this, <code>getPosition()</code> will fail.
}}
{{APICallback|name=findWaypoints|signature=(range: number): table|description=
Finds all [[Block/waypoint|waypoint blocks]] within the specified range.
 
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 1 is x, 2 is y, and 3 is z. These numbers are the distance from the navigation component to the beacon in terms of block coordinates.
* redstone returns a single number that is the current strength of the redstone signal
* label returns a string that is the label of the beacon you can set by right clicking on it.
 
Below is an example of how the tables are set up. A single beacon's results are shown.
}}
 
{| class="wikitable"
! table: main
!
!
!
!
|-
| rowspan="5" | table: 1
| rowspan="3" | table: position
| 1:
| number: x distance
|
|-
| 2:
| number: y distance
|
|-
| 3:
| number: z distance
|
|-
| redstone
|
| number: redstone strength
|
|-
| label
|
| string: beacon label
|
|}
 
= Contents =


{{:Item/contents}}
{{:Item/contents}}

Revision as of 20:38, 15 September 2026

Navigation Upgrade

Allows the robot to tell its current position and facing. The position is relative to the center of the map that was used to craft the upgrade. The range in which the upgrade works depends on the size of the map that was used to craft the upgrade. The upgrade can be crafted together with another map to re-configure it and get the old map back.

The Navigation upgrade is crafted using the following recipe:

  • 4 x Gold Ingot
  • 1 x Compass
  • 2 x Microchip (Tier 2)
  • 1 x Map
  • 1 x Potion / Filled Water Bottle

Component API

Component name: navigation. Callbacks:

getPosition

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).

getFacing

getFacing(): number

Gets the current facing of the robot, as one of the sides constants.

getRange

getRange(): number

Gets the effective range of the upgrade. If the absolute value of the relative X or Z coordinate becomes larger than this, getPosition() will fail.

findWaypoints

findWaypoints(range: number): table

Finds all waypoint blocks within the specified range.

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 1 is x, 2 is y, and 3 is z. These numbers are the distance from the navigation component to the beacon in terms of block coordinates.
  • redstone returns a single number that is the current strength of the redstone signal
  • label returns a string that is the label of the beacon you can set by right clicking on it.

Below is an example of how the tables are set up. A single beacon's results are shown.

table: main
table: 1 table: position 1: number: x distance
2: number: y distance
3: number: z distance
redstone number: redstone strength
label string: beacon label

Contents

Items
Components Data Card - Debug Card - Graphics Card - Internet Card - Linked Card - Network Card - Redstone Card - Wireless Network Card
Storage Devices Floppy Disk - EEPROM - Hard Disk Drive - Memory
Upgrades Angel Upgrade - Battery Upgrade - Chunkloader Upgrade - Database Upgrade - Experience Upgrade - Generator Upgrade - Hover Upgrade - Inventory Controller Upgrade - Inventory Upgrade - Leash Upgrade - Navigation Upgrade - Piston Upgrade - Sign I/O Upgrade - Solar Generator Upgrade - Tank Upgrade - Tank Controller Upgrade - Tractor Beam Upgrade
Containers Card Container - Upgrade Container - Disk Drive
Others Analyzer - Texture Picker - Component Bus - CPU - APU - Drone Case - Manual - Microcontroller Case - Nanomachines - Remote Terminal - Terminal Server - Server - Tablet Case - Tablet - Crafting Materials - Ink Cartridge - Scrench - Hover Boots - Grog - Loot Disks