Difference between revisions of "Custom Systems"

From PioneerWiki
Jump to: navigation, search
m (link fix (planet heightmaps))
m (CustomSBody is now CustomSystemBody)
Line 3: Line 3:
 
== CustomSystem ==
 
== CustomSystem ==
  
Represents a custom star system. Can be just the star definition, in which case the planets will be randomly generated, or can have <tt>CustomSBody</tt> objects added for complete control over the system construction.
+
Represents a custom star system. Can be just the star definition, in which case the planets will be randomly generated, or can have <tt>CustomSystemBody</tt> objects added for complete control over the system construction.
  
 
=== Constructor ===
 
=== Constructor ===
 
+
<blockquote>s = CustomSystem:new(name, star_types)</blockquote>
<blockquote>s = CustomSystem:new(name, star_types)
+
*'''name''' (string): system name.
</blockquote>
+
*'''type''' (table): up to four star types. Limited to <tt>BodyType</tt> <tt>STAR_*</tt> types, see [http://eatenbyagrue.org/f/pioneer/codedoc/files/LuaConstants-cpp.html#Constants.BodyType Lua constants] for a list.
* '''name''' (string): system name.
+
*'''returns''': a new <tt>CustomSystem</tt> object.
* '''type''' (table): up to four star types. Limited to <tt>BodyType</tt> <tt>STAR_*</tt> types, see [http://eatenbyagrue.org/f/pioneer/codedoc/files/LuaConstants-cpp.html#Constants.BodyType Lua constants] for a list.
 
* '''returns''': a new <tt>CustomSystem</tt> object.
 
  
 
Example:
 
Example:
Line 20: Line 18:
  
 
'''seed'''
 
'''seed'''
 
+
<blockquote>s:seed(value)</blockquote>
<blockquote>s:seed(value)
 
</blockquote>
 
 
Sets the system seed. This is used to initialise the random number generator that is used to select planet types and other system attributes. If not specified, defaults to 0.
 
Sets the system seed. This is used to initialise the random number generator that is used to select planet types and other system attributes. If not specified, defaults to 0.
  
* '''value''' (integer): seed value
+
*'''value''' (integer): seed value
* '''returns''': the <tt>CustomSystem</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystem</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 33: Line 29:
  
 
'''govtype'''
 
'''govtype'''
 
+
<blockquote>s:govtype(type)</blockquote>
<blockquote>s:govtype(type)
 
</blockquote>
 
 
Sets the system government type. It not specified, defaults to Polit.GovType.NONE
 
Sets the system government type. It not specified, defaults to Polit.GovType.NONE
  
* '''type''': government type. Limited to <tt>PolitGovType</tt> types, see [http://eatenbyagrue.org/f/pioneer/codedoc/files/LuaConstants-cpp.html#Constants.PolitGovType Lua constants] for a list.
+
*'''type''': government type. Limited to <tt>PolitGovType</tt> types, see [http://eatenbyagrue.org/f/pioneer/codedoc/files/LuaConstants-cpp.html#Constants.PolitGovType Lua constants] for a list.
* '''returns''': the <tt>CustomSystem</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystem</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 46: Line 40:
  
 
'''short_desc'''
 
'''short_desc'''
 
+
<blockquote>s:short_desc(description)`</blockquote>
<blockquote>s:short_desc(description)`
 
</blockquote>
 
 
Sets the short description of the system. This is shown in star map. If not specified a description is generated based on the population and resources of the system.
 
Sets the short description of the system. This is shown in star map. If not specified a description is generated based on the population and resources of the system.
  
* '''description''' (string): short description
+
*'''description''' (string): short description
* '''returns''': the <tt>CustomSystem</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystem</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 59: Line 51:
  
 
'''long_desc'''
 
'''long_desc'''
 
+
<blockquote>s:long_desc(description)</blockquote>
<blockquote>s:long_desc(description)
 
</blockquote>
 
 
Sets the long description of the system. This is show in the system info view. If not specified no description is displayed.
 
Sets the long description of the system. This is show in the system info view. If not specified no description is displayed.
  
* description '''(string)''': long description. This may span multiple lines.
+
*description '''(string)''': long description. This may span multiple lines.
  
 
Example:
 
Example:
Line 71: Line 61:
  
 
'''bodies'''
 
'''bodies'''
 
+
<blockquote>s:bodies(primary_star, { bodies... })</blockquote>
<blockquote>s:bodies(primary_star, { bodies... })
 
</blockquote>
 
 
Adds custom bodies to the system. If no bodies are added then planets and starports will be randomly generated based on the system seed value.
 
Adds custom bodies to the system. If no bodies are added then planets and starports will be randomly generated based on the system seed value.
  
Note that after this call that bodies passed to it have been &quot;committed&quot;. Further changes to the <tt>CustomSBody</tt> objects from Lua will be ignored.
+
Note that after this call that bodies passed to it have been "committed". Further changes to the <tt>CustomSystemBody</tt> objects from Lua will be ignored.
  
* '''primary_star''' (CustomSBody): a body for the primary star. It must have the same type as the first star passed to <tt>CustomSystem:new</tt>.
+
*'''primary_star''' (CustomSystemBody): a body for the primary star. It must have the same type as the first star passed to <tt>CustomSystem:new</tt>.
* '''bodies''' (table): A table containing zero or more <tt>CustomSBody</tt> objects, or further tables of <tt>CustomSBody</tt> objects. If a table is passed as one of the elements, then its contents will be added as children of the last <tt>CustomSBody</tt> passed.
+
*'''bodies''' (table): A table containing zero or more <tt>CustomSystemBody</tt> objects, or further tables of <tt>CustomSystemBody</tt> objects. If a table is passed as one of the elements, then its contents will be added as children of the last <tt>CustomSystemBody</tt> passed.
* '''returns''': nothing
+
*'''returns''': nothing
  
 
Example:
 
Example:
 +
<pre>lave = CustomSystem:new("Lave", { 'STAR_G' })
  
<pre>
+
lave_star    = CustomSystemBody:new("Lave", 'STAR_G')
lave = CustomSystem:new("Lave", { 'STAR_G' })
+
lave_planet  = CustomSystemBody:new("Planet Lave", 'PLANET_TERRESTRIAL')
 
+
lave_station = CustomSystemBody:new("Lave Station", 'STARPORT_ORBITAL')
lave_star    = CustomSBody:new("Lave", 'STAR_G')
 
lave_planet  = CustomSBody:new("Planet Lave", 'PLANET_TERRESTRIAL')
 
lave_station = CustomSBody:new("Lave Station", 'STARPORT_ORBITAL')
 
  
 
lave:bodies(
 
lave:bodies(
Line 99: Line 85:
 
)
 
)
 
</pre>
 
</pre>
 
 
'''add_to_sector'''
 
'''add_to_sector'''
 
+
<blockquote>s:add_to_sector(x, y, v)</blockquote>
<blockquote>s:add_to_sector(x, y, v)
 
</blockquote>
 
 
Adds the system to the universe.
 
Adds the system to the universe.
  
Note that after this call the system has been &quot;committed&quot;. Further changes to the system or its bodies will be ignored.
+
Note that after this call the system has been "committed". Further changes to the system or its bodies will be ignored.
  
* '''x''' (integer): The x coordinate of the sector to add the system to.
+
*'''x''' (integer): The x coordinate of the sector to add the system to.
* '''y''' (integer): The y coordinate of the sector to add the system to.
+
*'''y''' (integer): The y coordinate of the sector to add the system to.
* '''z''' (integer): The z coordinate of the sector to add the system to.
+
*'''z''' (integer): The z coordinate of the sector to add the system to.
* '''v''' (vector): The precise (x,y,z) location of the system within the sector.
+
*'''v''' (vector): The precise (x,y,z) location of the system within the sector.
  
 
Example:
 
Example:
 
+
<pre>s = CustomSystem:new("Van Maanen's Star", { 'WHITE_DWARF' })
<pre>
 
s = CustomSystem:new("Van Maanen's Star", { 'WHITE_DWARF' })
 
 
s:add_to_sector(2, 0, 0, v(0.279,0.482,-0.330))
 
s:add_to_sector(2, 0, 0, v(0.279,0.482,-0.330))
 
</pre>
 
</pre>
 
+
== CustomSystemBody ==
== CustomSBody ==
 
  
 
Represents a single body within a star system. These can include stars, planets, surface starports and orbital spaceports.
 
Represents a single body within a star system. These can include stars, planets, surface starports and orbital spaceports.
  
 
=== Constructor ===
 
=== Constructor ===
 
+
<blockquote>b = CustomSystemBody:new(name, type)</blockquote>
<blockquote>b = CustomSBody:new(name, type)
+
*'''name''' (string): body name.
</blockquote>
+
*'''type''' (integer): body type. Limited to <tt>BodyType</tt> constants, see [http://eatenbyagrue.org/f/pioneer/codedoc/files/LuaConstants-cpp.html#Constants.BodyType Lua constants] for a list.
* '''name''' (string): body name.
+
*'''returns''': a new <tt>CustomSystem</tt> object.
* '''type''' (integer): body type. Limited to <tt>BodyType</tt> constants, see [http://eatenbyagrue.org/f/pioneer/codedoc/files/LuaConstants-cpp.html#Constants.BodyType Lua constants] for a list.
 
* '''returns''': a new <tt>CustomSystem</tt> object.
 
  
 
Example:
 
Example:
Line 139: Line 117:
  
 
'''seed'''
 
'''seed'''
 
+
<blockquote>b:seed(value)</blockquote>
<blockquote>b:seed(value)
 
</blockquote>
 
 
Sets the body seed. This is used to initialise the random number generator that is used to drive the terrain generator, set body names and other planetary attributes. If not specified it will be generated from the system seed.
 
Sets the body seed. This is used to initialise the random number generator that is used to drive the terrain generator, set body names and other planetary attributes. If not specified it will be generated from the system seed.
  
* '''value''' (integer): seed value
+
*'''value''' (integer): seed value
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 152: Line 128:
  
 
'''radius'''
 
'''radius'''
 
+
<blockquote>b:radius(r)</blockquote>
<blockquote>b:radius(r)
 
</blockquote>
 
 
Sets the body radius.
 
Sets the body radius.
  
* '''r''' (fixed): radius. For stars, 1.0 is the radius of Sol. For planets, 1.0 is the radius of Earth.
+
*'''r''' (fixed): radius. For stars, 1.0 is the radius of Sol. For planets, 1.0 is the radius of Earth.
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 165: Line 139:
  
 
'''mass'''
 
'''mass'''
 
+
<blockquote>b:mass(m)</blockquote>
<blockquote>b:mass(m)
 
</blockquote>
 
 
Sets the body mass.
 
Sets the body mass.
  
* '''m''' (fixed): mass. For stars, 1.0 is the mass of Sol. For planets, 1.0 is the mass of Earth.
+
*'''m''' (fixed): mass. For stars, 1.0 is the mass of Sol. For planets, 1.0 is the mass of Earth.
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 178: Line 150:
  
 
'''temp'''
 
'''temp'''
 
+
<blockquote>b:temp(k)</blockquote>
<blockquote>b:temp(k)
 
</blockquote>
 
 
Sets the body temperature.
 
Sets the body temperature.
  
* '''k''' (integer): average surface temperature in kelvin.
+
*'''k''' (integer): average surface temperature in kelvin.
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 191: Line 161:
  
 
'''semi_major_axis'''
 
'''semi_major_axis'''
 
+
<blockquote>b:semi_major_axis(a)</blockquote>
<blockquote>b:semi_major_axis(a)
 
</blockquote>
 
 
Sets the [http://en.wikipedia.org/wiki/Semi-major_axis semi-major axis] of the body's orbit.
 
Sets the [http://en.wikipedia.org/wiki/Semi-major_axis semi-major axis] of the body's orbit.
  
 
This value is ignored for non-orbital bodies.
 
This value is ignored for non-orbital bodies.
  
* '''a''' (fixed): semi-major axis in AUs
+
*'''a''' (fixed): semi-major axis in AUs
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 206: Line 174:
  
 
'''eccentricity'''
 
'''eccentricity'''
 
+
<blockquote>b:eccentricity(e)</blockquote>
<blockquote>b:eccentricity(e)
 
</blockquote>
 
 
Sets the [http://en.wikipedia.org/wiki/Orbital_eccentricity eccentricity] of the body's orbit.
 
Sets the [http://en.wikipedia.org/wiki/Orbital_eccentricity eccentricity] of the body's orbit.
  
 
This value is ignored for non-orbital bodies.
 
This value is ignored for non-orbital bodies.
  
* '''e''' (fixed): eccentricity
+
*'''e''' (fixed): eccentricity
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 221: Line 187:
  
 
'''inclination'''
 
'''inclination'''
 
+
<blockquote>b:inclination(i)</blockquote>
<blockquote>b:inclination(i)
 
</blockquote>
 
 
Sets the [http://en.wikipedia.org/wiki/Inclination inclination] of the body's orbit.
 
Sets the [http://en.wikipedia.org/wiki/Inclination inclination] of the body's orbit.
  
 
This value is ignored for non-orbital bodies.
 
This value is ignored for non-orbital bodies.
  
* '''i''' (number): inclination in radians
+
*'''i''' (number): inclination in radians
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 236: Line 200:
  
 
'''latitude'''
 
'''latitude'''
 
+
<blockquote>b:latitude(l)</blockquote>
<blockquote>b:latitude(l)
 
</blockquote>
 
 
Sets the latitude of the body's position on its planet.
 
Sets the latitude of the body's position on its planet.
  
 
This value is ignored for orbital bodies.
 
This value is ignored for orbital bodies.
  
* '''l''' (number): latitude in radians
+
*'''l''' (number): latitude in radians
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 251: Line 213:
  
 
'''longitude'''
 
'''longitude'''
 
+
<blockquote>b:longitude(l)</blockquote>
<blockquote>b:longitude(l)
 
</blockquote>
 
 
Sets the longitude of the body's position on its planet.
 
Sets the longitude of the body's position on its planet.
  
 
This value is ignored for orbital bodies.
 
This value is ignored for orbital bodies.
  
* '''l''' (number): longitude in radians
+
*'''l''' (number): longitude in radians
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 266: Line 226:
  
 
'''rotation_period'''
 
'''rotation_period'''
 
+
<blockquote>b:rotation_period(p)</blockquote>
<blockquote>b:rotation_period(p)
 
</blockquote>
 
 
Sets the body's [http://en.wikipedia.org/wiki/Rotation_period rotation period].
 
Sets the body's [http://en.wikipedia.org/wiki/Rotation_period rotation period].
  
 
This value is ignored for non-orbital bodies.
 
This value is ignored for non-orbital bodies.
  
* '''p''' (fixed): rotation period in days
+
*'''p''' (fixed): rotation period in days
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 281: Line 239:
  
 
'''axial_tilt'''
 
'''axial_tilt'''
 
+
<blockquote>b:axial_tilt(t)</blockquote>
<blockquote>b:axial_tilt(t)
 
</blockquote>
 
 
Set's the body's [http://en.wikipedia.org/wiki/Axial_tilt axial tilt].
 
Set's the body's [http://en.wikipedia.org/wiki/Axial_tilt axial tilt].
  
 
This value is ignored for non-orbital bodies.
 
This value is ignored for non-orbital bodies.
  
* '''t''' (fixed): axial tilt in radians
+
*'''t''' (fixed): axial tilt in radians
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 296: Line 252:
  
 
'''height_map'''
 
'''height_map'''
 +
<blockquote>b:height_map(file)</blockquote>
 +
Specifies a [[Planet Heightmaps|planet heightmap]] file to use for the planetary terrain. The planet terrain will be generated based on its composition attributes if this is not specified.
  
<blockquote>b:height_map(file)
+
*'''file''' (string): filename relative to the Pioneer <tt>data</tt> folder.
</blockquote>
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
Specifies a [[Planet_Heightmaps|planet heightmap]] file to use for the planetary terrain. The planet terrain will be generated based on its composition attributes if this is not specified.
 
 
 
* '''file''' (string): filename relative to the Pioneer <tt>data</tt> folder.
 
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
 
  
 
Example:
 
Example:
Line 309: Line 263:
  
 
'''metallicity'''
 
'''metallicity'''
 
+
<blockquote>b:metallicity(m)</blockquote>
<blockquote>b:metallicity(m)
 
</blockquote>
 
 
Sets the metallicity of the planet's crust.
 
Sets the metallicity of the planet's crust.
  
* '''m''' (fixed): metallicity from 0.0 to 1.0, where 0.0 indicates light metals (eg aluminium, silicon dioxide) and 1.0 indicates heavy metals (eg iron).
+
*'''m''' (fixed): metallicity from 0.0 to 1.0, where 0.0 indicates light metals (eg aluminium, silicon dioxide) and 1.0 indicates heavy metals (eg iron).
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 322: Line 274:
  
 
'''volcanicity'''
 
'''volcanicity'''
 
+
<blockquote>b:volcanicity(v)</blockquote>
<blockquote>b:volcanicity(v)
 
</blockquote>
 
 
Sets the volcanicity of the planet's surface.
 
Sets the volcanicity of the planet's surface.
  
* '''v''' (fixed): volcanicity from 0.0 to 1.0, where 0.0 indicates no volcanic activity and 1.0 indicates constant volcanic activity over the entire surface.
+
*'''v''' (fixed): volcanicity from 0.0 to 1.0, where 0.0 indicates no volcanic activity and 1.0 indicates constant volcanic activity over the entire surface.
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 335: Line 285:
  
 
'''atmos_density'''
 
'''atmos_density'''
 
+
<blockquote>b:atmos_density(d)</blockquote>
<blockquote>b:atmos_density(d)
 
</blockquote>
 
 
Sets the atmospheric density of the planet.
 
Sets the atmospheric density of the planet.
  
* '''d''' (fixed): atmospheric density, where 0.0 is no atmosphere and 1.0 is Earth atmospheric density
+
*'''d''' (fixed): atmospheric density, where 0.0 is no atmosphere and 1.0 is Earth atmospheric density
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example: <tt>venus:atmos_density(f(93,1))</tt>
 
Example: <tt>venus:atmos_density(f(93,1))</tt>
  
 
'''atmos_oxidizing'''
 
'''atmos_oxidizing'''
 
+
<blockquote>b:atmos_oxidizing(o)</blockquote>
<blockquote>b:atmos_oxidizing(o)
 
</blockquote>
 
 
Sets the amount of oxidizing gases in the planet's atmosphere.
 
Sets the amount of oxidizing gases in the planet's atmosphere.
  
* '''o''' (fixed): amount of oxidizing gases, where 0.0 is all reducing gases (hydrogen, ammonia, etc) and 1.0 is all oxidizing gases (oxygen, carbon dioxide, etc)
+
*'''o''' (fixed): amount of oxidizing gases, where 0.0 is all reducing gases (hydrogen, ammonia, etc) and 1.0 is all oxidizing gases (oxygen, carbon dioxide, etc)
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 359: Line 305:
  
 
'''ocean_cover'''
 
'''ocean_cover'''
 
+
<blockquote>b:ocean_cover(p)</blockquote>
<blockquote>b:ocean_cover(p)
 
</blockquote>
 
 
Sets the percentage of the planet's surface that is covered by water.
 
Sets the percentage of the planet's surface that is covered by water.
  
* '''p''' (fixed): water coverage, where 0.0 is no water and 1.0 is all water
+
*'''p''' (fixed): water coverage, where 0.0 is no water and 1.0 is all water
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 372: Line 316:
  
 
'''ice_cover'''
 
'''ice_cover'''
 
+
<blockquote>b:ice_cover(p)</blockquote>
<blockquote>b:ice_cover(p)
 
</blockquote>
 
 
Sets the percentage of the planet's surface that is covered by ice.
 
Sets the percentage of the planet's surface that is covered by ice.
  
* '''p''' (fixed): ice coverage, where 0.0 is no ice and 1.0 is all ice
+
*'''p''' (fixed): ice coverage, where 0.0 is no ice and 1.0 is all ice
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
Line 385: Line 327:
  
 
'''life'''
 
'''life'''
 
+
<blockquote>b:life(p)</blockquote>
<blockquote>b:life(p)
 
</blockquote>
 
 
Sets the amount of life on the planet.
 
Sets the amount of life on the planet.
  
* '''p''' (fixed): amount/complexity of life, where 0.0 is no life and 1.0 is everything from single-celled things right up to advanced animals/humans.
+
*'''p''' (fixed): amount/complexity of life, where 0.0 is no life and 1.0 is everything from single-celled things right up to advanced animals/humans.
* '''returns''': the <tt>CustomSBody</tt> object (for call chaining)
+
*'''returns''': the <tt>CustomSystemBody</tt> object (for call chaining)
  
 
Example:
 
Example:
  
 
<tt>earth:life(f(9,10))</tt>
 
<tt>earth:life(f(9,10))</tt>

Revision as of 10:31, 18 January 2014

This page describes the Lua API for defining custom star systems. If you're getting started you should look at the existing definitions in the data/systems folder of your Pioneer installation.

CustomSystem

Represents a custom star system. Can be just the star definition, in which case the planets will be randomly generated, or can have CustomSystemBody objects added for complete control over the system construction.

Constructor

s = CustomSystem:new(name, star_types)

  • name (string): system name.
  • type (table): up to four star types. Limited to BodyType STAR_* types, see Lua constants for a list.
  • returns: a new CustomSystem object.

Example:

sol = CustomSystem:new('Sol', { 'STAR_G' })

Methods

seed

s:seed(value)

Sets the system seed. This is used to initialise the random number generator that is used to select planet types and other system attributes. If not specified, defaults to 0.

  • value (integer): seed value
  • returns: the CustomSystem object (for call chaining)

Example:

sol:seed(42)

govtype

s:govtype(type)

Sets the system government type. It not specified, defaults to Polit.GovType.NONE

  • type: government type. Limited to PolitGovType types, see Lua constants for a list.
  • returns: the CustomSystem object (for call chaining)

Example:

sol:govtype('EARTHDEMOC')

short_desc

s:short_desc(description)`

Sets the short description of the system. This is shown in star map. If not specified a description is generated based on the population and resources of the system.

  • description (string): short description
  • returns: the CustomSystem object (for call chaining)

Example:

sol:short_desc('The historical birthplace of humankind')

long_desc

s:long_desc(description)

Sets the long description of the system. This is show in the system info view. If not specified no description is displayed.

  • description (string): long description. This may span multiple lines.

Example:

lave:long_desc('Lave is most famous for its vast rain forests and the Lavian tree grub.)

bodies

s:bodies(primary_star, { bodies... })

Adds custom bodies to the system. If no bodies are added then planets and starports will be randomly generated based on the system seed value.

Note that after this call that bodies passed to it have been "committed". Further changes to the CustomSystemBody objects from Lua will be ignored.

  • primary_star (CustomSystemBody): a body for the primary star. It must have the same type as the first star passed to CustomSystem:new.
  • bodies (table): A table containing zero or more CustomSystemBody objects, or further tables of CustomSystemBody objects. If a table is passed as one of the elements, then its contents will be added as children of the last CustomSystemBody passed.
  • returns: nothing

Example:

lave = CustomSystem:new("Lave", { 'STAR_G' })

lave_star    = CustomSystemBody:new("Lave", 'STAR_G')
lave_planet  = CustomSystemBody:new("Planet Lave", 'PLANET_TERRESTRIAL')
lave_station = CustomSystemBody:new("Lave Station", 'STARPORT_ORBITAL')

lave:bodies(
    lave_star, {
        lave_planet, {
            lave_station,
        },
    },
)

add_to_sector

s:add_to_sector(x, y, v)

Adds the system to the universe.

Note that after this call the system has been "committed". Further changes to the system or its bodies will be ignored.

  • x (integer): The x coordinate of the sector to add the system to.
  • y (integer): The y coordinate of the sector to add the system to.
  • z (integer): The z coordinate of the sector to add the system to.
  • v (vector): The precise (x,y,z) location of the system within the sector.

Example:

s = CustomSystem:new("Van Maanen's Star", { 'WHITE_DWARF' })
s:add_to_sector(2, 0, 0, v(0.279,0.482,-0.330))

CustomSystemBody

Represents a single body within a star system. These can include stars, planets, surface starports and orbital spaceports.

Constructor

b = CustomSystemBody:new(name, type)

  • name (string): body name.
  • type (integer): body type. Limited to BodyType constants, see Lua constants for a list.
  • returns: a new CustomSystem object.

Example:

earth = CustomSystem:new('Earth', { 'PLANET_TERRESTRIAL' })

Methods

seed

b:seed(value)

Sets the body seed. This is used to initialise the random number generator that is used to drive the terrain generator, set body names and other planetary attributes. If not specified it will be generated from the system seed.

  • value (integer): seed value
  • returns: the CustomSystemBody object (for call chaining)

Example:

b:seed(42)

radius

b:radius(r)

Sets the body radius.

  • r (fixed): radius. For stars, 1.0 is the radius of Sol. For planets, 1.0 is the radius of Earth.
  • returns: the CustomSystemBody object (for call chaining)

Example:

mars:radius(f(533,1000))

mass

b:mass(m)

Sets the body mass.

  • m (fixed): mass. For stars, 1.0 is the mass of Sol. For planets, 1.0 is the mass of Earth.
  • returns: the CustomSystemBody object (for call chaining)

Example:

mars:mass(f(107,1000))

temp

b:temp(k)

Sets the body temperature.

  • k (integer): average surface temperature in kelvin.
  • returns: the CustomSystemBody object (for call chaining)

Example:

mars:temp(274)

semi_major_axis

b:semi_major_axis(a)

Sets the semi-major axis of the body's orbit.

This value is ignored for non-orbital bodies.

  • a (fixed): semi-major axis in AUs
  • returns: the CustomSystemBody object (for call chaining)

Example:

mars:semi_major_axis(f(152,100))

eccentricity

b:eccentricity(e)

Sets the eccentricity of the body's orbit.

This value is ignored for non-orbital bodies.

  • e (fixed): eccentricity
  • returns: the CustomSystemBody object (for call chaining)

Example:

mars:eccentricity(f(933,10000))

inclination

b:inclination(i)

Sets the inclination of the body's orbit.

This value is ignored for non-orbital bodies.

  • i (number): inclination in radians
  • returns: the CustomSystemBody object (for call chaining)

Example:

mars:inclination(math.deg2rad(1.85))

latitude

b:latitude(l)

Sets the latitude of the body's position on its planet.

This value is ignored for orbital bodies.

  • l (number): latitude in radians
  • returns: the CustomSystemBody object (for call chaining)

Example:

shanghai:latitude(math.deg2rad(31))

longitude

b:longitude(l)

Sets the longitude of the body's position on its planet.

This value is ignored for orbital bodies.

  • l (number): longitude in radians
  • returns: the CustomSystemBody object (for call chaining)

Example:

shanghai:longitude(math.deg2rad(-121))

rotation_period

b:rotation_period(p)

Sets the body's rotation period.

This value is ignored for non-orbital bodies.

  • p (fixed): rotation period in days
  • returns: the CustomSystemBody object (for call chaining)

Example:

mars:rotation_period(f(1027,1000))

axial_tilt

b:axial_tilt(t)

Set's the body's axial tilt.

This value is ignored for non-orbital bodies.

  • t (fixed): axial tilt in radians
  • returns: the CustomSystemBody object (for call chaining)

Example:

mars:axial_tilt(math.fixed.deg2rad(f(2519,100)))

height_map

b:height_map(file)

Specifies a planet heightmap file to use for the planetary terrain. The planet terrain will be generated based on its composition attributes if this is not specified.

  • file (string): filename relative to the Pioneer data folder.
  • returns: the CustomSystemBody object (for call chaining)

Example:

earth:height_map('earth.hmap')

metallicity

b:metallicity(m)

Sets the metallicity of the planet's crust.

  • m (fixed): metallicity from 0.0 to 1.0, where 0.0 indicates light metals (eg aluminium, silicon dioxide) and 1.0 indicates heavy metals (eg iron).
  • returns: the CustomSystemBody object (for call chaining)

Example:

earth:metallicity(f(1,2))

volcanicity

b:volcanicity(v)

Sets the volcanicity of the planet's surface.

  • v (fixed): volcanicity from 0.0 to 1.0, where 0.0 indicates no volcanic activity and 1.0 indicates constant volcanic activity over the entire surface.
  • returns: the CustomSystemBody object (for call chaining)

Example:

venus.volcanicity(f(8,10))

atmos_density

b:atmos_density(d)

Sets the atmospheric density of the planet.

  • d (fixed): atmospheric density, where 0.0 is no atmosphere and 1.0 is Earth atmospheric density
  • returns: the CustomSystemBody object (for call chaining)

Example: venus:atmos_density(f(93,1))

atmos_oxidizing

b:atmos_oxidizing(o)

Sets the amount of oxidizing gases in the planet's atmosphere.

  • o (fixed): amount of oxidizing gases, where 0.0 is all reducing gases (hydrogen, ammonia, etc) and 1.0 is all oxidizing gases (oxygen, carbon dioxide, etc)
  • returns: the CustomSystemBody object (for call chaining)

Example:

venus:atmos_oxidizing(f(8,10))

ocean_cover

b:ocean_cover(p)

Sets the percentage of the planet's surface that is covered by water.

  • p (fixed): water coverage, where 0.0 is no water and 1.0 is all water
  • returns: the CustomSystemBody object (for call chaining)

Example:

earth:ocean_cover(f(7,10))

ice_cover

b:ice_cover(p)

Sets the percentage of the planet's surface that is covered by ice.

  • p (fixed): ice coverage, where 0.0 is no ice and 1.0 is all ice
  • returns: the CustomSystemBody object (for call chaining)

Example:

earth:ice_cover(f(3,100))

life

b:life(p)

Sets the amount of life on the planet.

  • p (fixed): amount/complexity of life, where 0.0 is no life and 1.0 is everything from single-celled things right up to advanced animals/humans.
  • returns: the CustomSystemBody object (for call chaining)

Example:

earth:life(f(9,10))