Creating Ships and Stations

From PioneerWiki
Revision as of 08:25, 10 January 2015 by Nozmajner (talk | contribs) (Ship Properties: note on JSON)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

Ship Properties

Note: this is somewhat obsolete now, since ship definitions are in json. The idea is the same, the sintax is a bit different. 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 already existing kanara.lua is the police ship currently.

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 20140411) 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 = "",
    -- Manufacturer of the ship. Only for logo and decal selection currently. 
    -- Valid options are the file names (without extension) from data/icons/manufacturers/
    manufacturer = "",
    -- Ship class. Only for icon and text display in the ship market currently.
    -- Valid options are the file names (without extension) from the data/icons/shipclass/
    ship_class = "",
    -- 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: these values are deprecated fallback values, camera and gun positions are now specified as tag nodes in the model. 
    -- See the article on pioneer wiki about the model system
    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, can not be larger than capacity.
    max_engine = 1, -- set to 0 to prevent fitting a hyperdrive
    max_laser = 2, -- minimum: 0, maximum 2 currently.
    max_missile = 4,
    max_ecm = 1,
    max_scanner = 1,
    max_radarmapper = 1,
    max_hypercloud = 1,
    max_hullautorepair = 1,
    max_energybooster = 1,
    max_atmoshield = 1, -- if it's 0, then the ship can't be bought on surface starports, and NPC ships doesn't try to land on these ports either.
    max_cabin = 2, -- number of passenger cabins
    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 cargo and equipment capacity (in tonnes)
    capacity = 15,
    -- mass of the empty hull (in tonnes) - health of the ship is determined from this value
    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. If it's 0, then it won't show up in the ship market.
    price = 70000,
    -- base hyperdrive fitted as standard (set to 0 if the ship is not hyperspace capable). If it's 0, then it won't be seen flying around as an NC ship.
    hyperdrive_class = 0,
}

Station Properties

To be written...

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