Naev

Module safelanes

Lua accessor functions to safe lane information.

A "safe lane" is an intra-system route patrolled by a faction.

This module is in development; its interface should not be considered final.

Functions

get ([f[, standing[, s=system.cur()]]]) Return a table of matching lanes (format described below).
intersect (center, radius, p1, p2) Computes the intersection of a line segment and a circle.


Functions

get ([f[, standing[, s=system.cur()]]])
Return a table of matching lanes (format described below).

Parameters:

  • f Faction If present, only return this faction's lanes. (optional)
  • standing string What type of lanes to get. Either nil for specific faction only, "friendly", "neutral", "hostile", "non-friendly", or "non-hostile". (optional)
  • s System The system whose lanes we want. (default system.cur())

Returns:

    table The list of matching safe lanes, each of which is a table where: lane[1] and lane[2] are the endpoints (type vec2), and lane.faction is the owner's Faction.

Usage:

  • safelanes.get() -- Everyone's in current system
  • safelanes.get( "Empire" ) -- Empire's lanes in current system
  • safelanes.get( faction.get("Empire"), system.get("Gamma Polaris") ) -- Empire's lanes through Gamma Polaris.
intersect (center, radius, p1, p2)
Computes the intersection of a line segment and a circle.

Parameters:

  • center Vector Center of the circle.
  • radius number Radius of the circle.
  • p1 Vector First point of the line segment.
  • p2 Vector Second point of the line segment.

Returns:

  1. Vector or nil First point of collision or nil if no collision.
  2. Vector or nil Second point of collision or nil if single-point collision.
generated by LDoc 1.4.6 Last updated 2021-07-27 21:51:06