Module starsystem
Functions for starsystems
Global functions
Starsystem.getFromCoordinates (xval, yval) | finds (or generates) any starsystem by coordinates |
Starsystem.getFromName (name) | finds any starsystem by name |
Class Starsystem
starsystem:echoToSystem (text) | echo to all ships in the system, visible to any players in cockpits/viewports/turrets/etc |
starsystem:getBlackout () | get whether a system is affected by comms blackout. |
starsystem:getCoords () | get the X coordinate of the starsystem |
starsystem:getHidden () | get whether a system is hidden and inaccessible without a navchart. |
starsystem:getMaxShipClass () | get the maximum ship class allowed in this system. |
starsystem:getName () | get the name of the starsystem |
starsystem:getNoCaps () | get whether a system is inaccessible to frigates or larger. |
starsystem:getNoHyper () | get whether a system blocks hyperspace travel. |
starsystem:getNoPvp () | get whether a system blocks PVP in its space. |
starsystem:getNotPublic () | get whether a system is hidden from public starsystem lists. |
starsystem:getVirtualSys () | get whether a starsystem is a virtual system. |
starsystem:setBlackout (blackout) | set whether a system is affected by comms blackout. |
starsystem:setHidden (hidden) | set whether a system is hidden and inaccessible without a navchart. |
starsystem:setMaxShipClass (maxShipClass) | set the maximum ship class allowed in this system. |
starsystem:setNoCaps (noCaps) | set whether a system is inaccessible to frigates or larger. |
starsystem:setNoHyper (noHyper) | set whether a system blocks hyperspace travel. |
starsystem:setNoPvp (noPvp) | set whether a system blocks PVP in its space. |
starsystem:setNotPublic (noCaps) | set whether a system is hidden from public starsystem lists. |
starsystem:ships () | get an iterator over ships in the starsystem |
Global functions
- Starsystem.getFromCoordinates (xval, yval)
-
finds (or generates) any starsystem by coordinates
Parameters:
- xval integer the x coordinate
- yval integer the y coordinate
Returns:
-
Starsystem
the system, or nil if not found and cannot be created
- Starsystem.getFromName (name)
-
finds any starsystem by name
Parameters:
- name
string
the system name. Works with the full name or a prefix, like
Corusca
orCorusca Sector
.
Returns:
-
Starsystem
the system, or nil if not found
- name
string
the system name. Works with the full name or a prefix, like
Class Starsystem
Functions on starsystem variables
- starsystem:echoToSystem (text)
-
echo to all ships in the system, visible to any players in cockpits/viewports/turrets/etc
Parameters:
- text string the text to echo
- starsystem:getBlackout ()
-
get whether a system is affected by comms blackout.
This effectively acts the same as disrupt_network but for the entire system.
Returns:
-
boolean
true if under comms blackout, false otherwise.
- starsystem:getCoords ()
-
get the X coordinate of the starsystem
Returns:
- integer the X coordinate for this starsystem
- integer the Y coordinate for this starsystem
Usage:
local x, y = system:getCoords() ch:echoAt("The system is at "..x..", "..y)
- starsystem:getHidden ()
-
get whether a system is hidden and inaccessible without a navchart.
Systems with this set can't be accessed without a navchart. Attempting to navigate by
coordinate will bring you (-1, -1) from the system instead. It'll also not show on
starsystem lists to players.
Returns:
-
boolean
true if hidden, false otherwise.
- starsystem:getMaxShipClass ()
-
get the maximum ship class allowed in this system.
Uses the same class numbers as the
images
andsetship
commands: 0 = fighter, 1 = transport, etc. All systems default to 10 (satellite) to allow all ships.Returns:
-
integer
the maximum ship class allowed in the system.
- starsystem:getName ()
-
get the name of the starsystem
Returns:
-
string
the name of the starsystem. For uncharted space, this will be a random number.
- starsystem:getNoCaps ()
-
get whether a system is inaccessible to frigates or larger.
Returns:
-
boolean
true if inaccessible to frigates or larger, false otherwise.
- starsystem:getNoHyper ()
-
get whether a system blocks hyperspace travel.
This blocks hyperspace which passes through any part of the system, effectively turning
it into a space wall. Ships within the system can't do any hyperspace jumps at all.
Returns:
-
boolean
true if the system blocks hyperspace travel, false otherwise.
- starsystem:getNoPvp ()
-
get whether a system blocks PVP in its space.
This affects only ship targeting. For a full no-PVP system, also add the flag to its planets.
Returns:
-
boolean
true if PVP ship combat is disabled here, false otherwise.
- starsystem:getNotPublic ()
-
get whether a system is hidden from public starsystem lists.
If true,
starsystems
will hide this from players. They can still navigate to it if they know the name or coordinates, however.Returns:
-
boolean
true if hidden from starsystem lists, false otherwise.
- starsystem:getVirtualSys ()
-
get whether a starsystem is a virtual system.
Returns:
-
boolean
true if the system was created by jumping to coordinates, false if it's a manually created system
- starsystem:setBlackout (blackout)
-
set whether a system is affected by comms blackout.
This effectively acts the same as disrupt_network but for the entire system.
Parameters:
- blackout boolean whether the system is affected by comms blackout
- starsystem:setHidden (hidden)
-
set whether a system is hidden and inaccessible without a navchart.
Systems with this set can't be accessed without a navchart. Attempting to navigate by
coordinate will bring you (-1, -1) from the system instead. It'll also not show on
starsystem lists to players.
Parameters:
- hidden boolean whether to hide and block access to the system without a navchart
- starsystem:setMaxShipClass (maxShipClass)
-
set the maximum ship class allowed in this system.
Uses the same class numbers as the
images
andsetship
commands: 0 = fighter, 1 = transport, etc. All systems default to 10 (satellite) to allow all ships.Parameters:
- maxShipClass integer the maximum ship class allowed in the system
- starsystem:setNoCaps (noCaps)
-
set whether a system is inaccessible to frigates or larger.
Parameters:
- noCaps boolean whether the system is inaccessible to frigates or larger
- starsystem:setNoHyper (noHyper)
-
set whether a system blocks hyperspace travel.
This blocks hyperspace which passes through any part of the system, effectively turning
it into a space wall. Ships within the system can't do any hyperspace jumps at all.
Parameters:
- noHyper boolean whether the system blocks hyperspace travel
- starsystem:setNoPvp (noPvp)
-
set whether a system blocks PVP in its space.
This affects only ship targeting. For a full no-PVP system, also add the flag to its planets.
Parameters:
- noPvp boolean whether the system blocks PVP in its space
- starsystem:setNotPublic (noCaps)
-
set whether a system is hidden from public starsystem lists.
Parameters:
- noCaps boolean whether the system is hidden from starsystem lists
- starsystem:ships ()
-
get an iterator over ships in the starsystem
Returns:
-
an iterator of Ship
Usage:
for ship in system:ships() do -- do something end