Creating Ships and Stations

From PioneerWiki
Revision as of 02:49, 19 February 2013 by Jpab (talk | contribs) (Add stub for Station Properties section)
Jump to: navigation, search

Before a ship or station can appear in the game, you have to specify its properties.

Ship Properties

Ship definitions live in data/ships. Each .lua file in this directory contains one ship definition. The file name (minus the .lua extension) is used as a unique identifier for the ship type (e.g., "wave"), so that code (e.g., mission scripts) can refer to a particular ship type. That identifier is case sensitive -- it is best to stick to the convention used for existing ships (all lower case, using underscores instead of spaces).

The easiest way to create a ship is to copy an existing ship definition and then edit it. The properties you can set (as of alpha 31) are:

define_ship {
    -- Name of the ship shown to the player (e.g., in the shipyard)
    name = "",

    -- Name of the model used for the ship (minus the ".model" extension. This is case sensitive)
    model = "",

    -- Linear thruster power in Newtons
    forward_thrust = 65e5,
    reverse_thrust = 12e5,
    up_thrust = 18e5,
    down_thrust = 18e5,
    left_thrust = 18e5,
    right_thrust = 18e5,

    -- Angular thruster power
    -- This currently uses non-standard units, but is proportional to Newton-metres
    -- It is best to find the right value by experimenting in-game
    angular_thrust = 25e5,

    -- Table of gun mount positions
    -- note: in the future, gun positions will be specified as tag nodes in the model
    gun_mounts =
    {
        { v(0,-2,-46), v(0,0,-1), 5, 'HORIZONTAL' },
        { v(0,0,0), v(0,0,1), 5, 'HORIZONTAL' },
    },

    -- Equipment limits
    -- Each type of item or equipment has a particular slot that it can fit into;
    -- equipment can only be fitted if the ship has the right slot available,
    -- and also has enough capacity to carry the extra mass
    -- For most types of equipment, the slot limit should be set to
    -- 0 (to disable that equipment) or 1 (to enable it)
    -- Some types of equipment could have limits greater than 1 (e.g., cabins, shields)

    -- note: in the future, these slots will change, because a new Lua-driven equipment
    -- system is being created (see github issue 1719)

    max_cargo = 100, -- usually the same as the 'capacity' value
    max_engine = 1, -- set to 0 to prevent fitting a hyperdrive
    max_laser = 2, -- should be <= the number of gun mounts you have specified
    max_missile = 4,
    max_ecm = 1,
    max_scanner = 1,
    max_radarmapper = 1,
    max_hypercloud = 1,
    max_hullautorepair = 1,
    max_energybooster = 1,
    max_atmoshield = 1,
    max_cabin = 2,
    max_shield = 5,
    max_fuelscoop = 1,
    max_cargoscoop = 1,
    max_lasercooler = 1,
    max_cargolifesupport = 1,
    max_autopilot = 1,

    -- crew limits
    -- note: in the future, the ship will not be able to launch with fewer than min_crew crew-members
    min_crew = 1,
    max_crew = 2,

    -- total capacity (in tonnes)
    capacity = 15,
    -- mass of the empty hull (in tonnes)
    hull_mass = 10,
    -- size of the propellant tank (in tonnes)
    fuel_tank_mass = 15,

    -- Exhaust velocity Vc [m/s] is equivalent of engine efficiency and depend on used technology.
    -- Higher Vc means lower fuel consumption. Smaller ships built for speed often mount engines
    -- with higher Vc. Another way to make faster ship is to increase fuel_tank_mass.
    effective_exhaust_velocity = 59167e3,

    -- base price of a ship with just a hyperdrive
    price = 70000,
    -- base hyperdrive fitted as standard (set to 0 if the ship is not hyperspace capable)
    hyperdrive_class = 0,
}

Station Properties

To be written...

Note: The way that docking bays work is currently being improved. See github issue 2058