Home

Module ship

Lua bindings to interact with ships. This will allow you to create and manipulate ships in-game. An example would be:
 s = ship.get( "Empire Lancelot" ) -- Gets the ship
 cpu_free = s:cpu() -- Gets the CPU
 

Functions

ship.__eq (s1, s2) Checks to see if two ships are the same.
ship.baseType (s) Gets the ship's base type.
ship.class (s) Gets the name of the ship's class.
ship.cpu (s) Gets the ship available CPU.
ship.get (s) Gets a ship.
ship.gfx (s) Gets the ship's graphics.
ship.gfxTarget (s) Gets the ship's target graphics.
ship.name (s) Gets the name of the ship.
ship.outfitCPU (outfit) Gets the outfit CPU usage.
ship.price (s) Gets the ship's price, with and without default outfits.
ship.slots (s) Gets the amount of the ship's slots.


Functions

ship.__eq (s1, s2)
Checks to see if two ships are the same.

Parameters

  • s1: First ship to compare.
  • s2: Second ship to compare.

Usage:

if s1 == s2 then -- Checks to see if ship s1 and s2 are the same

Return value:

true if both ships are the same.
ship.baseType (s)
Gets the ship's base type. For example "Empire Lancelot" and "Lancelot" are both of the base type "Lancelot".

Parameters

  • s: Ship to get the ship base type.

Usage:

type = s:baseType()

Return value:

The name of the ship base type.
ship.class (s)
Gets the name of the ship's class.

Parameters

  • s: Ship to get ship class name.

Usage:

shipclass = s:class()

Return value:

The name of the ship's class.
ship.cpu (s)
Gets the ship available CPU.

Parameters

  • s: Ship to get available CPU of.

Usage:

cpu_left = s:cpu()

Return value:

The CPU available on the ship.
ship.get (s)
Gets a ship.

Parameters

  • s: Name of the ship to get.

Usage:

s = ship.get( "Hyena" ) -- Gets the hyena

Return value:

The ship matching name or nil if error.
ship.gfx (s)
Gets the ship's graphics. Will not work without access to the Tex module. These are nearly always a sprite sheet.

Parameters

  • s: Ship to get graphics of.

Usage:

gfx = s:gfx()

Return value:

The graphics of the ship.
ship.gfxTarget (s)
Gets the ship's target graphics. Will not work without access to the Tex module.

Parameters

  • s: Ship to get target graphics of.

Usage:

gfx = s:gfxTarget()

Return value:

The target graphics of the ship.
ship.name (s)
Gets the name of the ship.

Parameters

  • s: Ship to get ship name.

Usage:

shipname = s:name()

Return value:

The name of the ship.
ship.outfitCPU (outfit)
Gets the outfit CPU usage.

Parameters

  • outfit: Name of the outfit to get CPU usage of.

Usage:

cpu_used += s.outfitCPU( "Heavy Ion Turret" ) -- Adds the used cpu by the outfit

Return value:

CPU the outfit uses.
ship.price (s)
Gets the ship's price, with and without default outfits.

Parameters

  • s: Ship to get the price of.

Usage:

price, base = s:price()

Return value:

The ship's final purchase price and base price.
ship.slots (s)
Gets the amount of the ship's slots.

Parameters

  • s: Ship to get ship slots of.

Usage:

slots_weapon, slots_utility, slots_structure = p:slots()

Return value:

Number of weapon, utility and structure slots.

Valid XHTML 1.0!