Module jump
This module allows you to handle the jumps from Lua.
Generally you do something like:
j = jump.get("Gamma Polaris", "Apez") -- Get the jump from Gamma Polaris to Apez if j:known() then -- The jump is known v = j:pos() -- Get the position -- Do other stuff end
Functions
get (src, dest) | Gets a jump. |
__eq (j, comp) | You can use the '==' operator within Lua to compare jumps with this. |
__tostring (j) | Converts a jump to readable form. |
reverse (j) | Gets the opposite jump. |
radius (j) | Gets the jump's radius. |
pos (j) | Gets the position of the jump in the system. |
hide (j) | Gets the hide value of a jump in radians. |
angle (j) | Gets the angle of a jump in radians. |
hidden (j) | Checks whether a jump is hidden. |
exitonly (j) | Checks whether a jump is exit-only. |
system (j) | Gets the system that a jump point exists in. |
dest (j) | Gets the system that a jump point exits into. |
dest (j, p) | Gets the distance from the jump point at which the pilot can jump. |
known (j) | Checks to see if a jump is known by the player. |
setKnown (j[, value=true]) | Sets a jump's known state. |
Functions
- get (src, dest)
-
Gets a jump.
Possible values of params:
- string : Gets the jump by system name.
- system : Gets the jump by system.
Parameters:
Returns:
- Jump Returns the jump.
- Jump Returns the inverse.
Usage:
j,r = jump.get( "Ogat", "Goddard" ) -- Returns the Ogat to Goddard and Goddard to Ogat jumps.
- __eq (j, comp)
-
You can use the '==' operator within Lua to compare jumps with this.
Parameters:
- j Jump Jump comparing.
- comp Jump jump to compare against.
Returns:
-
boolean
true if both jumps are the same.
Usage:
if j:__eq( jump.get( "Rhu", "Ruttwi" ) ) then -- Do something
- __tostring (j)
-
Converts a jump to readable form. Mainly meant to be used for
printing.
Parameters:
- j Jump Jump to print.
- reverse (j)
-
Gets the opposite jump.
Parameters:
- j Jump Jump to get the reverse jump of.
Returns:
-
Jump
The jump in the opposite direction.
- radius (j)
-
Gets the jump's radius.
Parameters:
- j Jump Jump to get the radius of.
Returns:
-
number
The jump's radius.
Usage:
radius = j:radius()
- pos (j)
-
Gets the position of the jump in the system.
Parameters:
- j Jump Jump to get the position of.
Returns:
-
Vec2
The position of the jump in the system.
Usage:
v = j:pos()
- hide (j)
-
Gets the hide value of a jump in radians.
Parameters:
- j Jump Jump to get the hide value of.
Returns:
-
number
The hide value.
Usage:
v = j:hide()
- angle (j)
-
Gets the angle of a jump in radians.
Parameters:
- j Jump Jump to get the angle of.
Returns:
-
number
The angle.
Usage:
v = j:angle()
- hidden (j)
-
Checks whether a jump is hidden.
Parameters:
- j Jump Jump to get the hidden status of.
Returns:
-
boolean
Whether the jump is hidden.
Usage:
if not j:hidden() then -- Exclude hidden jumps.
- exitonly (j)
-
Checks whether a jump is exit-only.
Parameters:
- j Jump Jump to get the exit-only status of.
Returns:
-
boolean
Whether the jump is exit-only.
Usage:
if jump.exitonly("Eneguoz", "Zied") then -- The jump point in Eneguoz cannot be entered.
- system (j)
-
Gets the system that a jump point exists in.
Parameters:
- j Jump Jump to get the system of.
Returns:
-
System
The jump's system.
Usage:
s = j:system()
- dest (j)
-
Gets the system that a jump point exits into.
Parameters:
- j Jump Jump to get the destination of.
Returns:
-
System
The jump's destination system.
Usage:
v = j:dest()
- dest (j, p)
-
Gets the distance from the jump point at which the pilot can jump.
Parameters:
- j Jump Jump to get the jump distance of.
- p Pilot Pilot to get information for.
Returns:
-
number
The distance from the jump at which the pilot can jump.
Usage:
d = j:jumpDist( player.pilot() )
- known (j)
-
Checks to see if a jump is known by the player.
Parameters:
- j Jump Jump to check if the player knows.
Returns:
-
boolean
true if the player knows the jump.
Usage:
b = j:known()
- setKnown (j[, value=true])
-
Sets a jump's known state.
Note that this affects both sides of the jump connection to avoid getting the player locked away.
Parameters:
- j Jump Jump to set known.
- value boolean Whether or not to set as known. (default true)
Usage:
j:setKnown( false ) -- Makes jump unknown.