Module Navigator
Utilities and data relating to wilderness map navigation, both on land and sea.
Basic navigation
-
findWaypoint (targetWaypoint)
line 43
-
Finds bearing and distance to waypoint from current location.
Parameters:
- targetWaypoint
string
Shortname of the waypoint to located.
Returns:
-
float
Bearing to waypoint in degrees.
-
int
Chebyshev distance to waypoint.
-
getPointBearings (_originX, _originY, _targetX, _targetY)
line 66
-
Returns the bearing to target coordinates from origin coordinates.
Parameters:
- _originX
int
Origin point X-coordinate.
- _originY
int
Origin point Y-coordinate.
- _targetX
int
Target point X-coordinate.
- _targetY
int
Target point Y-coordinate.
Returns:
float
Bearing to target coordinate in degrees.
Usage:
local bearing = myNavigator.getPointBearings( 418,443 , 553,221 )
-
getChebyshevDistance (originX, originY, targetX, targetY)
line 127
-
Returns the Chebyshev distance between two points.
Does not account for impassable seas or obstacles.
Parameters:
- originX
int
Origin point X-coordinate.
- originY
int
Origin point Y-coordinate.
- targetX
int
Target point X-coordinate.
- targetY
int
Target point Y-coordinate.
Returns:
int
Chebyshev distance to target point.
Usage:
local distance = myNavigator.getChebyshevDistance(374,804,447,878)
-
getNearestHarbours (numReturns)
line 142
-
Locates an arbitrary number of the nearest harbours.
Gathers the name, distance, and bearings of the nearest harbours, and organises them for further processing.
Limited in number of returns by numReturns.
Parameters:
- numReturns
int
The number of nearest harbours to return results for, after sorting.
Returns:
table
Indexed table containing information for the numReturns nearest harbours, sorted by ascending distance..
Usage:
local nearestHarbour = myNavigator.getNearestHarbours(1)[1]
-
getWaypointTable ()
line 172
-
Returns a copy of the full waypoint table.
Returns:
table
A full copy of the master Navigator.waypoints table.
Usage:
for k,v in pairs(myNavigator.getWaypointTable()) do echo(v.name.."\n") end
-
calculateMovementSpeed ()
line 178
-
Something to do with movement speed.
Getters/setters
For creating and initialising Navigator object.
-
getEasting ()
line 226
-
Returns the player's current easting.
Returns:
int
Current Navigator easting.
-
getSouthing ()
line 233
-
Returns the player's current southing.
Returns:
int
Current Navigator southing.
-
getError ()
line 240
-
Returns the player's current CEP.
Returns:
int
Current Navigator CEP.
-
setEasting (input)
line 248
-
Sets the player's current easting.
Parameters:
- input
int
New Navigator easting.
Usage:
myNavigator.setEasting(261)
-
setSouthing (input)
line 257
-
Sets the player's current southing.
Parameters:
- input
int
New Navigator southing.
Usage:
myNavigator.setSouthing(729)
-
setError (input)
line 266
-
Sets the player's current CEP.
Parameters:
- input
int
New Navigator CEP.
Usage:
myNavigator.setError(2)
Location status
-
aboardShip ()
line 286
-
Returns true if user is aboard a ship.
Does its best to avoid false positives, such as ferries, using a table of failure states as its metric.
Returns:
bool
Whether user is aboard a ship.
See also:
Usage:
if myNavigator.aboardShip() then...
-
havePosition ()
line 311
-
Returns true if Navigator has a valid position set.
Returns:
bool
True, if valid position set.
Usage:
if myNavigator.havePosition() then...
-
inSubdivision ()
line 321
-
Returns true if user is in a subdivision.
Returns:
bool
True, if in subdivision.
Usage:
if myNavigator.inSubdivision() then...
-
inWildernessMap ()
line 338
-
Returns true if user is in the wilderness map.
Does not count being aboard a vessel as being in the wilderness map.
Returns:
bool
True, if in subdivision.
See also:
Usage:
if myNavigator.aboardShip() then...
-
onSeafloor ()
line 351
-
Returns true if user is in in a seafloor area.
Useful to keep us from zeroing out data when we don't actually want to.
Returns:
bool
True, if in seafloor area.
See also:
Usage:
if myNavigator.onSeafloor() then...
Conversions
-
cardinalToHeading (_cardinalDirection)
line 380
-
Converts a cardinal-direction string to heading in degrees.
Parameters:
- _cardinalDirection
string
Direction (e.g. "north", "e", "south-southwest", "ene")
Returns:
float
Heading in degrees
-
roomNumToCoords (_roomNum)
line 413
-
Converts standard three-parameter ATP coordinates to screen coordinates.
Used in setting our position when we have a wilderness room number.
Parameters:
- _roomNum
int
The room number we wish to convert.
Returns:
-
int
Easting in screen coordinates.
-
int
Southing in screen coordinates.
Auto-calibration
-
adjustCoords (_dirMoved, _inputEasting, _inputSouthing)
line 476
-
Returns current coordinates adjusted for input direction.
Also invoked by Figurehead for wavecall.
Parameters:
- _dirMoved
string
Short-form direction string.
- _inputEasting
int
Current Navigator easting.
- _inputSouthing
int
Current Navigator southing.
Returns:
-
int
Adjusted easting.
-
int
Adjusted southing.
Usage:
myNavigator.adjustCoords("n",625,715)
-
autoCal (inputEasting, inputSouthing)
line 523
-
Doesn't actually autocalibrate, just takes in stuff to pass to self variables.
Parameters:
- inputEasting
int
New easting to set.
- inputSouthing
int
New southing to set.
-
buildSearchTable (doFullSearch)
line 548
-
Populates searchTable with the relevant rows of text, before we begin finding candidates.
Parameters:
- doFullSearch
bool
True, to search the entire map for candidates. False if building a limited array to search through.
-
checkCandidates (locationCandidates, shipColumn)
line 574
-
It checks candidates?
Parameters:
- locationCandidates
- shipColumn
-
doShipAutocal ()
line 657
-
Old autocal
-
findLineDelta ()
line 767
-
Finds nearest Δ candidate in
Navigator.currentMap
.
Returns:
-
string
Contents of the line containing the located reference. Used in later steps to verify location candidates, before heading into confidence calculations.
-
int
Latitudinal distance from the central calibration point, Δ. Negative values are north.
Usage:
local locatorString, lineDelta = myNavigator.findLineDelta()
-
gatherCandidates (searchString)
line 820
-
Gathers the candidates for our line.
Parameters:
- searchString
string
Map line to gather candidates for.
-
getSearchHeight ()
line 843
-
Gets search height.
-
doINSmove ()
line 854
-
Feed our last movement direction to the INS routine. Adjusts current Navigator coords acordingly.
-
isInOpenSeas ()
line 862
-
See if all the lines of our map are blank spaces, to see if we even have any sort of landmarks.
-
trimLocationCandidates (inputTable, distanceLimit)
line 877
-
This finds things.
allegedly, not great though
Parameters:
- inputTable
what.
- distanceLimit
what.
-
updateINS ()
line 901
-
Old INS stuff.
Sailplan stuff
-
isAtDestination ()
line 1037
-
Returns true if current position matches destination position.
Returns:
bool
True if at destination position.
-
steerpointNext ()
line 1056
-
Next steerpoint.
-
steerpointPrevious ()
line 1071
-
Previous steerpoint.
Autopilot
-
autopilot
line 1142
-
Container for autopilot functionality
Fields:
- _autopilotEnabled
If autopilot is enabled
- _stoppedToTurn
If autopilot is stopped for purposes of turning
-
checkAlignment ()
line 1150
-
These do things, I guess.
Yep. I guess.
-
waypointTurn ()
line 1167
-
These do things, I guess.
Yep. I guess.
Maps and map readers
-
maps
line 1261
-
Container for maps
-
Navigator.maps.full
line 1265
-
Full world map as a table. Table indices are 1 higher than their actual coordinate value!
-
Navigator.maps.current
line 1289
-
The last map sent to us by the game.
Usage:
{
"nnnnnnnnnn....wwwwww ",
"nnnnnnnnn.....wwwwwww ",
"nnnnnnnn.......wwwwww ",
"++++++++++++++.w.www ",
"nnnnnn.........wwwww ",
"nnnnnn..........ww ",
"nnnnn..........ww ",
"nnnnn.........ww ",
"nnnnn.......= ",
"nnnnn.........ww ",
"nnnnn..........www ",
"nnnnn.......wwwwww ",
"nnnnn......wwwwww ",
"nnnnnn.....www;www ",
"nnnnnnn...wwwwwwwww ",
"nnnnnnnn..wwwwwwwww ",
"nnnnnnnn..wwwwwwww "
}
-
isOurShip ()
line 1294
-
True if = under the cursor is our ship, as determined by text colour.
-
isSeamonster ()
line 1308
-
True if M under cursor is a seamonster, as determined by the text colour.
-
isTargetShip ()
line 1322
-
True if = under the cursor is our ship, as determined by text colour.